Skip to content

WebGPU compilation errors: "unknown SPIR-V builtin: 24" #10908

Closed

Description

@ScottTodd

What happened?

Several of our tests are failing to compile using the WebGPU compiler target, during compilation from SPIR-V to WGSL using Tint.

From tests/e2e/xla_ops/:

  • reverse.mlir
  • scatter.mlir
  • sort.mlir

Steps to reproduce your issue

Either add a test suite to tests/e2e/xla_ops/ or tests/e2e/tosa_ops/ with

  TARGET_BACKEND
    "webgpu"
  # Only test compilation for now, the WebGPU driver is not stable/tested yet.
  # DRIVER
  #   "webgpu"

OR just run the compiler on one of those files directly, e.g.

iree-compile --iree-hal-target-backends=webgpu \
  --iree-input-type=mhlo tests/e2e/xla_ops/sort.mlir \
  --iree-hal-dump-executable-sources-to=/tmp/iree/webgpu_sort/ \
  --iree-hal-dump-executable-intermediates-to=/tmp/iree/webgpu_sort/ \
  --iree-hal-dump-executable-binaries-to=/tmp/iree/webgpu_sort/ \
  -o /dev/null \

What component(s) does this issue relate to?

Compiler

Version information

Tip of tree, 29b1e88

Additional context

From https://registry.khronos.org/SPIR-V/specs/1.0/SPIRV.html#_a_id_builtin_a_builtin, Builtin 24 is:

NumWorkgroups
Number of workgroups in GLCompute or Kernel Execution Models. See OpenCL, Vulkan, or OpenGL API specifications for more detail.

See also SpvBuiltInNumWorkgroups = 24, in spirv-headers.

Tint's reader/spirv/enum_converter.cc does not (yet?) have a case for SpvBuiltInNumWorkgroups: , but ast/builtin_value.h does have kNumWorkgroups.

This gist has the .spvasm that IREE feeds to Tint for sort.mlir:
https://gist.github.com/ScottTodd/266a1d152ced378bd2f600da57f803d8

Activity

  1. self-assigned this
    on Oct 25, 2022
  2. added
    codegen/spirv
    platform/web 🌐
    and removed on Oct 25, 2022
  3. antiagainst commented on Oct 26, 2022

    @antiagainst
    Member

    Yeah. Should be a simple fix to just add an entry in the enum_converter.cc for this builtin?

  4. antiagainst commented on Nov 3, 2022

    @antiagainst
    Member

    @dneto0 as FYI.

  5. dneto0 commented on Nov 15, 2022

    @dneto0

    The issue is now fixed upstream as of today. Dawn will have to be rolled into Chromium, and then it will appear in Canary.

  6. ScottTodd commented on Nov 18, 2022

    @ScottTodd
    MemberAuthor

    The issue is now fixed upstream as of today. Dawn will have to be rolled into Chromium, and then it will appear in Canary.

    Thanks, @dneto0 ! How frequently are changes from Dawn imported into Tint? I don't see the fix in https://dawn.googlesource.com/tint yet.

  7. moved this to Done in IREEon Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug 🐞codegen/spirvplatform/web 🌐

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions