Skip to content

Improve buffer handling in WebGPU sample. - #14163

Merged
ScottTodd merged 1 commit into
iree-org:mainfrom
ScottTodd:webgpu-buffers
Jul 10, 2023
Merged

ScottTodd merged 1 commit into
iree-org:mainfrom
ScottTodd:webgpu-buffers

Conversation

@ScottTodd

Copy link
Copy Markdown
Member

Progress on #13809

  • Some errors were not being fully propagated
  • Some code attempted to access handles without going through iree_hal_buffer_allocated_buffer()

This code still has bugs:

  • multiple_results.mlir: absf(-1.23, -4.56) returns (4.56, 0) at first, then (1.23, 4.56) on future calls with the same loaded program state
  • mobilebert, posenet, mobilessd: no errors, correct number of outputs, incorrect numerical results (way off llvm-cpu/local-task, stable across runs)

* Some errors were not being fully propagated
* Some code attempted to access handles without going through `iree_hal_buffer_allocated_buffer()`
@ScottTodd ScottTodd added hal/webgpu Runtime WebGPU HAL backend platform/web 🌐 Web-specific build, execution, benchmarking, and deployment labels Jun 20, 2023
@ScottTodd
ScottTodd requested a review from benvanik as a code owner June 20, 2023 22:39
Comment on lines -761 to +769
.source_buffer = source_buffer,
.source_offset = data_offset,
.source_buffer = source_buffer_allocated,
.source_offset = source_offset,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of this async / loop-based readback code could be moved to a shared place with the rest of the C runtime code, where it would be easier to test.

@ScottTodd
ScottTodd merged commit fc521f9 into iree-org:main Jul 10, 2023
@ScottTodd
ScottTodd deleted the webgpu-buffers branch July 10, 2023 17:04
ScottTodd added a commit that referenced this pull request Aug 10, 2023
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
  ```
nhasabni pushed a commit to plaidml/iree that referenced this pull request Aug 24, 2023
Progress on iree-org#13809

* Some errors were not being fully propagated
* Some code attempted to access handles without going through
`iree_hal_buffer_allocated_buffer()`

__This code still has bugs:__

* multiple_results.mlir: `absf(-1.23, -4.56)` returns `(4.56, 0)` at
first, then `(1.23, 4.56)` on future calls with the same loaded program
state
* mobilebert, posenet, mobilessd: no errors, correct number of outputs,
incorrect numerical results (way off `llvm-cpu`/`local-task`, stable
across runs)
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

hal/webgpu Runtime WebGPU HAL backend platform/web 🌐 Web-specific build, execution, benchmarking, and deployment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants