Hello,
I have a problem with running some metal tests in TVM. I tried to add new tests on Metal and use decorator @tvm.testing.requires_metal
to specify that this test should be run only for Metal. But when I run this test, it is skipped, because it didn’t find GPU. I commented *requires_gpu()
in requires_metal
and after this the test was executed.
Could you help me, what should I do to run this test without commenting *requres_gpu()
?
I’m working on MacOS. And build TVM with the following keys:
-DUSE_OPENCL=ON
\ -DUSE_METAL=ON
\ -DUSE_RPC=ON
\ -DUSE_GRAPH_RUNTIME=ON
\ -DUSE_GRAPH_EXECUTOR_DEBUG=ON
\ -DUSE_LLVM=ON
\ -DUSE_RANDOM=ON
\ -DUSE_SORT=ON
\ -DUSE_RELAY_DEBUG=ON
\ -DUSE_MKLDN=${HOME}/Soft/dnnl_mac_1.7.0_cpu_iomp
\ -DUSE_BNNS=ON
Also, I tried to register device_api.gpu
in metal_device_api.mm
in the same way as it done in cuda_device_api.cc
:
TVM_REGISTER_GLOBAL("device_api.gpu").set_body([](TVMArgs args, TVMRetValue* rv) {
DeviceAPI* ptr = MetalWorkspace::Global();
*rv = static_cast<void*>(ptr);
});
And with this declaration the test also was executed without commenting requires_gpu()
. But I don’t think that it is a good fix because will happen if I try to build tvm with cuda and metal support?