tvm
tvm copied to clipboard
[Bug] target WebGPU cannot enable spirv support
trafficstars
When I compile the model with target ' webgpu -keys=webgpu,gpu -max_num_threads=256 '; runtime = ' llvm --system-lib -mtriple=wasm32-emscripten -mattr=+bulk-memory ', I get the error: Check failed: target->kind->device_type == kDLVulkan (15 vs. 7) : SPIRVSupport can only be checked for vulkan device type.
I saw the source code in src/target/spirv/spirv_support.cc L35
SPIRVSupport::SPIRVSupport(tvm::Target target) {
ICHECK_EQ(target->kind->device_type, kDLVulkan)
<< "SPIRVSupport can only be checked for vulkan device type";
if (target->GetAttr<Integer>("vulkan_api_version")) {
vulkan_api_version = target->GetAttr<Integer>("vulkan_api_version").value().IntValue();
}
......
Does the assert check not take into account the situation of the webgpu?
when I change the assert check to:
ICHECK_EQ(target->kind->device_type == kDLVulkan || target->kind->device_type == kDLWebGPU, true)
<< "SPIRVSupport can only be checked for vulkan or WebGPU device type";
Compiling the model is successful.
Welcome to send a PR.