Skip to content

Add packed integer dot product sample - #572

Merged
kainino0x merged 6 commits into
webgpu:mainfrom
lyonsno:cc/dp4a-recovery-0915
Sep 16, 2026
Merged

kainino0x merged 6 commits into
webgpu:mainfrom
lyonsno:cc/dp4a-recovery-0915

Conversation

@lyonsno

@lyonsno lyonsno commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Adds a small dot4I8Packed compute example toward #350.

The sample packs four signed 8-bit components into each u32, computes four example dot products, and reads the results back from the GPU. A dat.gui selector displays the input vectors and result for each example.

It requires packed_4x8_integer_dot_product and displays a requirement message when that WGSL language feature is unavailable. There is one packed compute pipeline, with no scalar fallback or in-sample result validation.

Testing

  • Lint, source typecheck, and the Node 20.20.2 build pass. The build emits existing typed-array warnings in unrelated samples.
  • Chrome 153.0.8010.48, headless with --enable-unsafe-webgpu, on an Apple Metal adapter: all four examples returned the expected results, and the dat.gui selector was exercised.
  • Desktop and narrow-screen layouts inspected. Injecting feature unavailability displayed the requirement message without requesting an adapter or compiling a shader.

No new dependencies or external assets.

Comment thread test/packedIntegerDotProduct.test.mjs Outdated
Comment thread sample/packedIntegerDotProduct/reference.ts Outdated
Comment thread sample/packedIntegerDotProduct/reference.ts Outdated
Comment thread sample/packedIntegerDotProduct/index.html
Comment thread sample/packedIntegerDotProduct/main.ts Outdated
Comment thread sample/packedIntegerDotProduct/main.ts Outdated
@kainino0x
kainino0x force-pushed the cc/dp4a-recovery-0915 branch from 5bbef30 to 0495650 Compare September 16, 2026 21:15
@kainino0x
kainino0x enabled auto-merge (squash) September 16, 2026 21:15
@kainino0x
kainino0x disabled auto-merge September 16, 2026 21:17
@kainino0x
kainino0x enabled auto-merge (squash) September 16, 2026 21:39
@kainino0x
kainino0x merged commit 5d76bb2 into webgpu:main Sep 16, 2026
1 check passed
@kainino0x

Copy link
Copy Markdown
Collaborator

Decided to add back a GUI to let people actually play with the inputs of the function, and remove the batched execution because there's just one input. It's a really barebones sample so will be interested still in replacing it at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants