tvm icon indicating copy to clipboard operation
tvm copied to clipboard

[Bug] target WebGPU cannot enable spirv support

Open yanghaku opened this issue 3 years ago • 1 comments
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?

yanghaku avatar Sep 21 '22 03:09 yanghaku

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.

yanghaku avatar Sep 21 '22 03:09 yanghaku

Welcome to send a PR.

masahi avatar Dec 08 '22 08:12 masahi