Hello @haozech. There are two ways you can go about benchmarking a single 
operator. You can either 1. benchmark a specific implementation of the operator 
or 2. benchmark all implementations of the operator.

For 1, follow the [Tuning High Performance Convolution on NVIDIA 
GPUs](https://tvm.apache.org/docs/tutorials/autotvm/tune_conv2d_cuda.html) 
tutorial, but skip section 1. In section two, replace 
`"tutorial/conv2d_no_batching"` in `task = 
autotvm.task.create("tutorial/conv2d_no_batching", args=(N, H, W, CO, CI, KH, 
KW, strides, padding), target="cuda")` with the name of the implementation you 
want to benchmark. You can find the name of the implementation by greping the 
codebase for `@autotvm.register_topi_compute`. You'll also have to modify the 
inputs to they match what the function is expecting. Furthermore, you'll have 
to change `conv2d_no_batching` and `conv2d_nchw_python` in the last code block 
with the correct function names (these should be the name of the function 
annotated with `@autotvm.register_topi_compute`).

For 2, follow the [Auto-tuning a convolutional network for NVIDIA 
GPU](https://tvm.apache.org/docs/tutorials/autotvm/tune_relay_cuda.html) 
tutorial. Replace `get_network` with a function that returns a relay function 
with a single operator like so:
```
x = relay.Var("x", tvm.relay.TensorType([40, 40]))
y = relay.Var("y", tvm.relay.TensorType([40, 40]))
mod = relay.Function(
    [x, y],
    relay.my_function(x, y)
)
```





---
[Visit 
Topic](https://discuss.tvm.apache.org/t/how-can-i-test-the-performance-of-a-single-operator/8362/2)
 to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click 
here](https://discuss.tvm.apache.org/email/unsubscribe/b74575d4c7f5d2b0894f8cf942f2ce25244e267cad638a71bc9b4cf1da48c22c).

Reply via email to