Skip to content

Work around scalar support bug in webgpu compilation. - #14629

Merged
ScottTodd merged 1 commit into
iree-org:mainfrom
ScottTodd:webgpu-multiple-results-workaround
Aug 10, 2023
Merged

ScottTodd merged 1 commit into
iree-org:mainfrom
ScottTodd:webgpu-multiple-results-workaround

Conversation

@ScottTodd

Copy link
Copy Markdown
Member

See #11054 (comment) - this multiple_results.mlir test program uses scalars, and #13711 changed the code path that scalar dispatches go down. This alternate code path does not appear to have the same SPIR-V -> WGSL compatibility patches as the tensor path, so we see compilation errors with messages like entry point 'd0' references multiple variables that use the same resource binding. We should fix that (and add tests so it doesn't regress again), but I want to keep webgpu runtime debugging work unblocked.

This modified program exhibits the same runtime-related issue as reported on #13809 / #14163:

  • The first invocation incorrectly returns
    2xf32=2.23 2.45
    2xf32=0 0
    
  • The second invocation correctly returns
    2xf32=1.23 1.45
    2xf32=2.23 2.45
    

@ScottTodd ScottTodd added codegen/spirv SPIR-V code generation compiler backend platform/web 🌐 Web-specific build, execution, benchmarking, and deployment labels Aug 10, 2023
@ScottTodd
ScottTodd requested a review from KoolJBlack August 10, 2023 20:27
@ScottTodd
ScottTodd merged commit 038d2ba into iree-org:main Aug 10, 2023
@ScottTodd
ScottTodd deleted the webgpu-multiple-results-workaround branch August 10, 2023 20:54
@ScottTodd

Copy link
Copy Markdown
Member Author

Oh, I found another solution to this: don't pass --iree-stream-resource-alias-mutable-bindings=true. Could be worth figuring out what's up with that pass (#13323 enabled it by default, and that had CUDA regressions and Android improvements)

@ScottTodd

Copy link
Copy Markdown
Member Author

Oh, nevermind. Omitting that pass still produces runtime errors for the scalar program:

Writable storage buffer binding aliasing found between [BindGroup] set at bind group index 0, binding index 2, and [BindGroup] set at bind group index 0, binding index 3, with overlapping ranges (offset: 0, size: 128) and (offset: 0, size: 128) in [Buffer].
 - While encoding [ComputePassEncoder].DispatchWorkgroups(1, 1, 1).

nhasabni pushed a commit to plaidml/iree that referenced this pull request Aug 24, 2023
See iree-org#11054 (comment)
- this `multiple_results.mlir` test program uses scalars, and
iree-org#13711 changed the code path that
scalar dispatches go down. This alternate code path does not appear to
have the same SPIR-V -> WGSL compatibility patches as the tensor path,
so we see compilation errors with messages like `entry point 'd0'
references multiple variables that use the same resource binding`. We
should fix that (and add tests so it doesn't regress again), but I want
to keep webgpu runtime debugging work unblocked.

This modified program exhibits the same runtime-related issue as
reported on iree-org#13809 /
iree-org#14163:
* The first invocation incorrectly returns 
  ```
  2xf32=2.23 2.45
  2xf32=0 0
  ```
* The second invocation correctly returns
  ```
  2xf32=1.23 1.45
  2xf32=2.23 2.45
  ```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codegen/spirv SPIR-V code generation compiler backend platform/web 🌐 Web-specific build, execution, benchmarking, and deployment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants