Skip to content

Commit

Permalink
Add information on packed_4x8_integer_dot_product extension (mdn#36898)
Browse files Browse the repository at this point in the history
* Add information on packed_4x8_integer_dot_product extension

* fix linting error

* Change table to dl

* attempt to make text less confusing
  • Loading branch information
chrisdavidmills authored Nov 25, 2024
1 parent 6989fc7 commit d752445
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions files/en-us/web/api/wgsllanguagefeatures/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,27 @@ The `WGSLLanguageFeatures` object is accessed via the {{domxref("GPU.wgslLanguag

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 |
| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <a name="readonly_and_readwrite_storage_textures">`readonly_and_readwrite_storage_textures`</a> | 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. |
| <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> |
- `packed_4x8_integer_dot_product`

- : 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 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.

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).
- Packing and unpacking instructions with packed 4-component vectors of 8-bit integers (via built-in functions such as `pack4xI8()` and `pack4xI8Clamp()`).

- `readonly_and_readwrite_storage_textures`

- : 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.

- `unrestricted_pointer_parameters`

- : Loosens restrictions on pointers being passed to WGSL functions. When available, the following are allowed:

- Parameter pointers to storage, uniform, and workgroup address spaces being passed to user-declared functions.
- Pointers to structure members and array elements being passed to user-declared functions.

See [Pointers As Function Parameters](https://google.github.io/tour-of-wgsl/types/pointers/passing_pointers/) for more details.

## Instance properties

Expand Down

0 comments on commit d752445

Please sign in to comment.