From d7524456e9dfd434953a02f7d74fcea67c99828c Mon Sep 17 00:00:00 2001 From: Chris Mills Date: Mon, 25 Nov 2024 18:45:44 +0000 Subject: [PATCH] Add information on packed_4x8_integer_dot_product extension (#36898) * Add information on packed_4x8_integer_dot_product extension * fix linting error * Change table to dl * attempt to make text less confusing --- .../web/api/wgsllanguagefeatures/index.md | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/files/en-us/web/api/wgsllanguagefeatures/index.md b/files/en-us/web/api/wgsllanguagefeatures/index.md index 435a0b6f27bfb75..8575d33e2ac0047 100644 --- a/files/en-us/web/api/wgsllanguagefeatures/index.md +++ b/files/en-us/web/api/wgsllanguagefeatures/index.md @@ -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 | -| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `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:

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

| +- `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