barry-jin commented on pull request #20006:
URL: https://github.com/apache/incubator-mxnet/pull/20006#issuecomment-815119093
> > Adopt PackedFunc based FFI on imperative invoke to reduce overhead.
>
> Have you measured the improvement for this PR? Previously I thought you
intend to convert the remaining operators to the new FFI, rendering the generic
imperative invoke unneeded?
Yes, some operators that takes no stringified params as invocation input
will benefit a bit from it.
copyto
```python
setup = """
from mxnet import np, npx
npx.set_np()
a = np.zeros((2,2))
b = np.ones((2,2))
"""
stmt = """
c = a.copyto(b)
"""
timer = timeit.Timer(setup=setup,
stmt=stmt)
num_repeat = 1000
print(min(timer.repeat(repeat=10, number=num_repeat)) / num_repeat)
legacy
5.821948400000032e-05
New FFI
5.494140500000011e-05
```
npx.gather_nd
```python
setup = """
from mxnet import np, npx
npx.set_np()
a = np.zeros((2,2))
b = np.ones((2,2))
"""
stmt = """
c = npx.gather_nd(a, b)
"""
timer = timeit.Timer(setup=setup,
stmt=stmt)
num_repeat = 1000
print(min(timer.repeat(repeat=10, number=num_repeat)) / num_repeat)
legacy
8.739984900000009e-05
New FFI
7.992273099999991e-05
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]