-
Notifications
You must be signed in to change notification settings - Fork 22.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add information on packed_4x8_integer_dot_product extension #36898
base: main
Are you sure you want to change the base?
Add information on packed_4x8_integer_dot_product extension #36898
Conversation
Preview URLs External URLs (2)URL:
(comment last updated: 2024-11-22 09:31:15) |
@@ -21,6 +21,11 @@ The `WGSLLanguageFeatures` object is accessed via the {{domxref("GPU.wgslLanguag | |||
## Available features | |||
|
|||
The available WGSL language extensions can vary across implementations and physical devices and may also change over time; we have therefore not listed them here. For a complete list, refer to [WGSL language extensions](https://gpuweb.github.io/gpuweb/wgsl/#language-extension) in the WGSL specification. | |||
The following WGSL language extensions are defined at [WGSL language extensions](https://gpuweb.github.io/gpuweb/wgsl/#language-extension) in the WGSL specification. Bear in mind that the exact set of features available will vary across implementations and physical devices, and may change over time. | |||
|
|||
| Feature name | Description | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what the reasoning for this format is.
- It's much harder to edit or read the source than a Markdown
<dl>
or just headings. - It means you have to embed HTML in the source to get paragraphs
- We have something that looks to users like a link, that doesn't go anywhere if you click it
- The
<a>
element usesname
which is deprecated according to our docs. - You only get about 2/3 of the page width for the description text.
Why not use a Markdown <dl>
, or just headings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used tables on the other similar WebGPU pages, so I decided to follow suit here. The link-looking things are anchors (<a name="foo">
) that I inserted so I would be able to link to link to those exact row. Thinking about it now, I should have used <span id="foo">
instead. Old habits die hard ;-)
So, this table has already been put live by other PRs. At this point I would suggest getting it merged, and then we can convert to a <dl>
in a fresh PR?
This pull request has merge conflicts that must be resolved before it can be merged. |
| Feature name | Description | | ||
| ----------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[mdn-linter] reported by reviewdog 🐶
| Feature name | Description | | |
| ----------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | |
| Feature name | Description | | |
| --------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| <a name="unrestricted_pointer_parameters">`unrestricted_pointer_parameters`</a> | <p>Loosens restrictions on pointers being passed to WGSL functions. When available, the following are allowed:</p><ul><li>Parameter pointers to storage, uniform, and workgroup address spaces being passed to user-declared functions.</li><li>Pointers to structure members and array elements being passed to user-declared functions.</li></ul><p>See [Pointers As Function Parameters](https://google.github.io/tour-of-wgsl/types/pointers/passing_pointers/) for more details.</p> | | ||
| Feature name | Description | | ||
| ----------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| <span id="packed_4x8_integer_dot_product">`packed_4x8_integer_dot_product`</span> | <p>Allows **DP4a** (Dot Product of 4 Elements and Accumulate) GPU instructions to be used via your WGSL code. These efficiently perform 8-bit integer dot products to accelerate computation, saving memory (up to 75%) and network bandwidth and improving performance compared with the equivalent `f32` versions. They are commonly used in machine learning models in inferencing, within AI frameworks.</p><p>Specifically, when `packed_4x8_integer_dot_product` is available, WGSL code can use 32-bit integer scalars packing 4-component vectors of 8-bit integers to be used as inputs to dot product instructions (via the `dot4U8Packed()` and `dot4I8Packed()` built-in functions), and use packing and unpacking instructions with packed 4-component vectors of 8-bit integers (via built-in functions such as `pack4xI8()` and `pack4xI8Clamp()`).</p> | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[markdownlint] reported by reviewdog 🐶
MD033/no-inline-html Inline HTML [Element: span]
| Feature name | Description | | ||
| ----------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| <span id="packed_4x8_integer_dot_product">`packed_4x8_integer_dot_product`</span> | <p>Allows **DP4a** (Dot Product of 4 Elements and Accumulate) GPU instructions to be used via your WGSL code. These efficiently perform 8-bit integer dot products to accelerate computation, saving memory (up to 75%) and network bandwidth and improving performance compared with the equivalent `f32` versions. They are commonly used in machine learning models in inferencing, within AI frameworks.</p><p>Specifically, when `packed_4x8_integer_dot_product` is available, WGSL code can use 32-bit integer scalars packing 4-component vectors of 8-bit integers to be used as inputs to dot product instructions (via the `dot4U8Packed()` and `dot4I8Packed()` built-in functions), and use packing and unpacking instructions with packed 4-component vectors of 8-bit integers (via built-in functions such as `pack4xI8()` and `pack4xI8Clamp()`).</p> | | ||
| <span id="readonly_and_readwrite_storage_textures">`readonly_and_readwrite_storage_textures`</span> | When available, allows the `"read-only"` and `"read-write"` [`storageTexture.access`](/en-US/docs/Web/API/GPUDevice/createBindGroupLayout#access) values to be set when specifying storage texture bind group entry types in a bind group layout. These enable WSGL code to read storage textures, and read/write storage textures, respectively. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[markdownlint] reported by reviewdog 🐶
MD033/no-inline-html Inline HTML [Element: span]
| ----------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| <span id="packed_4x8_integer_dot_product">`packed_4x8_integer_dot_product`</span> | <p>Allows **DP4a** (Dot Product of 4 Elements and Accumulate) GPU instructions to be used via your WGSL code. These efficiently perform 8-bit integer dot products to accelerate computation, saving memory (up to 75%) and network bandwidth and improving performance compared with the equivalent `f32` versions. They are commonly used in machine learning models in inferencing, within AI frameworks.</p><p>Specifically, when `packed_4x8_integer_dot_product` is available, WGSL code can use 32-bit integer scalars packing 4-component vectors of 8-bit integers to be used as inputs to dot product instructions (via the `dot4U8Packed()` and `dot4I8Packed()` built-in functions), and use packing and unpacking instructions with packed 4-component vectors of 8-bit integers (via built-in functions such as `pack4xI8()` and `pack4xI8Clamp()`).</p> | | ||
| <span id="readonly_and_readwrite_storage_textures">`readonly_and_readwrite_storage_textures`</span> | When available, allows the `"read-only"` and `"read-write"` [`storageTexture.access`](/en-US/docs/Web/API/GPUDevice/createBindGroupLayout#access) values to be set when specifying storage texture bind group entry types in a bind group layout. These enable WSGL code to read storage textures, and read/write storage textures, respectively. | | ||
| <span id="unrestricted_pointer_parameters">`unrestricted_pointer_parameters`</span> | <p>Loosens restrictions on pointers being passed to WGSL functions. When available, the following are allowed:</p><ul><li>Parameter pointers to storage, uniform, and workgroup address spaces being passed to user-declared functions.</li><li>Pointers to structure members and array elements being passed to user-declared functions.</li></ul><p>See [Pointers As Function Parameters](https://google.github.io/tour-of-wgsl/types/pointers/passing_pointers/) for more details.</p> | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[markdownlint] reported by reviewdog 🐶
MD033/no-inline-html Inline HTML [Element: span]
Description
Chrome 123 supports the
readonly_and_readwrite_storage_textures
language extension (seeWGSLLanguageFeatures
), which allows:In your WGSL shader code.
This PR adds an entry to the "Available features" table on the
WGSLLanguageFeatures
ref page for this feature. I'm copying the same structure as I used in #36880, and will deal with merging them as they start to get published.See https://developer.chrome.com/blog/new-in-webgpu-123#dp4a_built-in_functions_support_in_wgsl for the data source.
Motivation
Additional details
Related issues and pull requests
Project issue: #36349