qsqqsqqsq commented on a change in pull request #9784:
URL: https://github.com/apache/tvm/pull/9784#discussion_r775826008
##########
File path: tests/python/unittest/test_target_target.py
##########
@@ -63,22 +63,77 @@ def test_all_targets_device_type_verify():
def test_target_dispatch():
with tvm.target.cuda():
assert mygeneric(1) == 3
+ assert mygeneric.get_packed_func()(1) == 3
with tvm.target.rocm():
assert mygeneric(1) == 4
+ assert mygeneric.get_packed_func()(1) == 4
with tvm.target.Target("cuda"):
assert mygeneric(1) == 3
+ assert mygeneric.get_packed_func()(1) == 3
with tvm.target.arm_cpu():
assert mygeneric(1) == 11
+ assert mygeneric.get_packed_func()(1) == 11
with tvm.target.Target("metal"):
assert mygeneric(1) == 3
+ assert mygeneric.get_packed_func()(1) == 3
assert tvm.target.Target.current() is None
[email protected]_native_generic_func("test_target_temp_strategy")
+def target_generic(data):
+ # default generic function
+ return data + 1
+
+
+@target_generic.register(["cuda", "gpu"])
+def target_cuda_func(data):
+ return data + 2
+
+
+def temp_target_cuda_func(data):
+ return data + 3
+
+
+def test_target_temp_strategy():
Review comment:
I add a test_target_temp_strategy case to illustrate the usecase of
get_packed_func() interface.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]