altanh commented on a change in pull request #8030:
URL: https://github.com/apache/tvm/pull/8030#discussion_r632736914
##########
File path: python/tvm/topi/cuda/sparse.py
##########
@@ -105,13 +105,22 @@ def _callback(op):
return s
-def schedule_cuda_transpose(s, out):
+def schedule_transpose(outs):
Review comment:
feels a bit weird to have this in `sparse.py`
##########
File path: python/tvm/relay/op/strategy/cuda.py
##########
@@ -1068,3 +1070,23 @@ def unique_strategy_cuda(attrs, inputs, out_type,
target):
name="unique.cuda",
)
return strategy
+
+
+@schedule_transpose.register(["cuda", "gpu", "rocm"])
+def schedule_transpose_cuda(attrs, outs, target):
+ """
+ Transpose cuda strategy
+ Dispatches to and optimized schedule if the transpose is standalone (not
fused).
+ """
+ warp_size = int(Target.current(allow_none=False).thread_warp_size)
+ if (
Review comment:
is there a more principled way to do this? like maybe with an OpStrategy
or something
##########
File path: vta/tutorials/autotvm/tune_relay_vta.py
##########
@@ -357,7 +357,7 @@ def tune_and_evaluate(tuning_opt):
)
# filter out non-packed conv2d task
- tasks = list(filter(lambda t: len(t.args[0][1]) > 4, tasks))
+ tasks = list(filter(lambda t: len(t.args[0][1]) > 4 and "conv" in t.name,
tasks))
Review comment:
what happened here, did this transpose change introduce a new task or
something?
##########
File path: tests/python/topi/python/test_topi_transform.py
##########
@@ -870,6 +871,30 @@ def test_transpose():
verify_transpose((3, 10), None)
[email protected]_targets
+def test_transpose_schedule(target, dev):
+ shape = (100, 34)
+ x = relay.var("x", relay.TensorType(shape, "float32"))
+ f = relay.transpose(x)
+ ex = relay.create_executor(
+ kind="graph", mod=tvm.IRModule.from_expr(relay.Function([x], f)),
device=dev, target=target
+ )
+ r = np.random.rand(*shape)
+ tvm.testing.assert_allclose(ex.evaluate()(r).asnumpy(), np.transpose(r))
+
+ # make sure schedule does not fire here
Review comment:
is this a TODO? Also I wonder if it would be good to parametrize the
test shape by warp size (rather than hard coding) for future proofing
--
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]