Repository navigation
Description
1. Introduction
In this issue we propose an extension to enable FP16, the 16-bit floating point types, to be allowed in WGSL for proposed usages. To keep the issue in a reasonable length, detailed information of each backend’s (D3D12, Metal, Vulkan, and OpenGL) support for each usage is omitted, and can be found in a more detailed proposal design doc for this extension.
Although other low-bit-width data types, e.g. INT16 and INT8, may also be supported by backends, we focus on FP16 in this extension.
2. Proposal usages
This proposed extension, tentatively named fp16-in-shaders-and-storage, enables certain usages of FP16 in WGSL.
The considered usages of FP16 in WGSL and their support of different backends can be summarized in the table below. We propose to enable all usages except atomic FP16, using in uniform storage class and pipeline input/output in this extension, as a tradeoff between functionality and capability (some Vulkan devices support using FP16 types within shaders and storage buffer, but don’t support using them in uniform buffer). Usages of uniform storage class and pipeline input/output can also be emulated on devices that don’t support them natively. If such emulation is enabled, we can enable all usages except atomic FP16 in this extension, making this extension more general. Otherwise, the uniform storage class or pipeline input/output usages may be enabled by other extensions.
| WGSL usage | Vulkan (SPIR-V) | D3D12 (HLSL) | Metal (MSL) | OpenGL (GLSL) |
| Defining FP16 scalar, vector and matrix types | Requiring at least one Vulkan feature listed in this column | Require SM6.2 or higher, using DXIL, and Native16BitShaderOpsSupported == true
|
Support | Requiring extension AMD_gpu_shader_half_float
|
| Defining array and structure types with FP16 | ||||
| Conversion and bit-casting between FP16 and other types | ||||
| Atomic type/operation of FP16 | No support | |||
Using variables of FP16 types in private, function and workgroup storage classes
|
Require Vulkan feature shaderFloat16 (overall support rate 39.6%, reported by gpuinfo.org, the same for others in this column)
|
Require SM6.2 or higher, using DXC, and Native16BitShaderOpsSupported == true
|
Support | Requiring extension AMD_gpu_shader_half_float
|
| Using FP16 as parameters and results of user-defined value | ||||
| Using FP16 with built-in function (arithmetical) | ||||
Using FP16 types in uniform storage class
|
Require Vulkan feature uniformAndStorageBuffer16BitAccess (overall support rate 53.1%)
|
|||
Using FP16 types in Storage storage class
|
Require Vulkan feature storageBuffer16BitAccess (overall support rate 58.6%)
|
|||
| Using FP16 types in pipeline input/output user-defined variables | Require Vulkan feature storageInputOutput16 (overall support rate 24.4%)
|
|||
Please see the capability chapter in the proposed design doc for detailed investigation of different backends’ support for different usages.
The following sections will describe these usages.
3. FP16 data types
FP16 data types are supported with different requirements on each backend.If the backend supports above features, we will be able to enable using FP16 types in WGSL. We also propose to add value conversion and bitcast expressions for FP16.
Atomic type or operation for FP16 is not allowed.
3.1. Scalar, vector and matrix types of FP16
Currently in WGSL we only have 32-bits floating scalar type, f32, floating point vectors and matrices all have component type of f32. Here we propose the 16-bit floating point scalar type, f16, and corresponding vector and matrix types. If the backend meets the requirement of supporting FP16, the proposed WGSL types may be used in WGSL code.
A brief list of WGSL f16 types enabled by this extension is shown below. A detailed table for WGSL FP16 types and corresponding backend types is listed in the appendix of design doc.
| WGSL Type | Description |
f16
|
The f16 type is the set of 16-bit floating point values of the IEEE-754 binary16 (half precision) format.
|
vecN<f16>
|
Vector of N elements of type f16
|
matNxM<f16>
|
Matrix of N columns and M rows
|
3.2. Array and structure with FP16 types
HLSL, MSL, SPIRV, and GLSL all support defining FP16 members in arrays and structures, if FP16 is supported. Therefore, we may enable FP16 types in arrays and structures when FP16 scalar, vector and matrix types are enabled.
Using FP16 types in uniform buffers and storage buffers may have additional memory layout restrictions, please see the corresponding chapters in the proposed design doc(uniform, storage).
3.3. Type constructor expressions and conversion expressions
This extension proposes the scalar, vector and matrix constructor expressions for f16 in WGSL in the same ways as f32.
We also propose value conversion expressions between f16 and any other types (f32, u32, i32 and bool). Value conversion expressions between matrix types (f16 and f32 matrices) are introduced in this extension, which do not exist before as there is only f32 type of matrix in WGSL. Please see the appendix for a detailed table.
Bit-casting between f16 and u32 can be done by packing and unpacking WGSL built-in functions. The most natural bit-casting, between f16 and u16, are not proposed in this extension because we don’t have u16 types yet. Bit-casting between f16 and types other than u16 or u32 shall not be allowed in WGSL.
3.4. Atomic type of FP16
No backend has a useful support of atomic FP16 types and/or operations. Therefore, we are unlikely going to support atomic type for FP16. The details for each backend are summarized in the table below.
| Backend | Details |
| D3D12 | HLSL does not support atomic operations for float16. |
| Vulkan | SPIR-V only supports OpAtomicFAddEXT for 32-bit and 64-bit floating point, requiring AtomicFloat32AddEXT and AtomicFloat64AddEXT. The extension SPV_EXT_shader_atomic_float_min_max adds atomic min and max instruction on floating-point numbers, and the extension SPV_EXT_shader_atomic_float16_add proposes supporting atomically adding to 16-bit floating-point numbers in memory. However these are still in internal status.
Vulkan extension VK_EXT_shader_atomic_float2 (features) suggests 16-bit floating-point atomic operations on buffer and workgroup memory as well as floating-point atomic minimum and maximum operations on buffer, workgroup, and image memory. However, such features are generally unsupported (reported 99.8%).
|
| Metal | MSL only supports atomic types of int, uint and bool.
|
| OpenGL | OpenGL only supports atomic types of int, uint and bool.
OpenGL only has the atomic counter of integer type. |
3.5. FP16 literal
In WGSL we have floating suffix f for f32. Following the GLSL extension, we propose the suffix hf for f16. The form of a numeric literal will be as shown below.
| Type | form |
decimal_float_literal
|
/((-?[0-9]*\.[0-9]+|-?[0-9]+\.[0-9]*)((e|E)(\+|-)?[0-9]+)?(h?f)?)|(-?[0-9]+(e|E)(\+|-)?[0-9]+(h?f)?)/
|
hex_float_literal
|
/-?0[x|X]((([0-9a-fA-F]*\.[0-9a-fA-F]+|[0-9a-fA-F]+\.[0-9a-fA-F]*)((p|P)(\+|-)?[0-9]+(h?f)?)?)|([0-9a-fA-F]+(p|P)(\+|-)?[0-9]+(h?f)?))/
|
Some examples for the proposed FP16 literal are -.23E+8hf, 123e-4hf, 0xABC.DEFhf and 1A2BP-3hf.
Note
HLSL and MSL use the suffix
hinstead ofhffor FP16.
4. Defining FP16 variables in private, function and workgroup storage class
This extension will enable using FP16 types in defining variables in private, function and workgroup storage classes. If a backend device is suitable to enable this extension, we can directly translate the variable definitions of these storage classes into the backend’s shader code.
5. Using FP16 types as function parameter and result
This extension enables using FP16 types as parameters and results of built-in and user-defined functions, in the same way of using FP32 types. Some FP16-specific built-in functions should be added into WGSL. In this section we will discuss this usage.
5.1. User defined function
All backends support defining functions with 16-bit floating point parameters and/or return values, as long as they support using fp16 in function storage class. Therefore, WGSL functions using fp16 as input/output can map to backends as same as other functions.
5.2. Built-in functions
All WGSL built-in functions that take f32 should support using f16 as parameters and results, as most floating point built-in functions have half-precision reload on all backends.
All data packing and unpacking built-in functions should have overloads that take FP16 types as parameters and results where originally f32 goes. Bit-casting between f16 and u32 can be done by these packing and unpacking functions. HLSL seems to have no packing/unpacking functions for FP16, nor bitCast between FP16 and uint32, and we may manually implement them.
6. Using FP16 types in uniform and storage storage class
The variables with uniform and storage storage classes work as the interactions between gpu and host memory, therefore they have to meet more requirements. We will propose the memory layout requirements for FP16 in this chapter.
6.1. Alignment and Size
The following table should be merged into WGSL Spec table Alignment and size for host-shareable types.
| WGSL Type | Alignment (bytes) | Size (bytes) |
f16
|
2 | 2 |
vec2<f16>
|
4 | 4 |
vec3<f16>
|
8 | 6 |
vec4<f16>
|
8 | 8 |
mat2x2<f16>
|
4 | 8 |
mat2x3<f16>
|
8 | 16 |
mat2x4<f16>
|
8 | 16 |
mat3x2<f16>
|
4 | 12 |
mat3x3<f16>
|
8 | 24 |
mat3x4<f16>
|
8 | 24 |
mat4x2<f16>
|
4 | 16 |
mat4x3<f16>
|
8 | 32 |
mat4x4<f16>
|
8 | 32 |
These values match the MSL and Vulkan Spec. If the size or alignment of structure members is not explicitly defined in WGSL code, the listed value should be used. If explicitly defined, they should satisfy the layout constraints for corresponding storage classes shown below.
Note
The Internal Layout of Values in WGSL Spec should be also updated.
6.2. Using FP16 types in uniform storage class
When using FP16 types in uniform storage class, besides the alignment requirement above should be met, the extra buffer layout constraints for uniform is also required, as is shown below. These requirements are identical to the current WGSL spec.
| Host-shareable type S | RequiredAlignOf(S, uniform)
|
i32, u32, f32, or f16
|
AlignOf(S) |
atomic<T>, T is i32, u32, or f32
|
AlignOf(S) |
vecN<T>
|
AlignOf(S) |
matNxM<T>, T is f32 or f16
|
AlignOf(S) |
array<T, N>
|
round(16, AlignOf(S)) |
array<T>
|
round(16, AlignOf(S)) |
struct S
|
round(16, AlignOf(S)) |
The matrix matNxM<f16> types should be stored as N distinct vecM<f16> (not an array of vectors), and constructed back to a matrix by generated code. In this way we workaround the matrix stride requirements in different backends.
We can do emulation for Vulkan devices with no native support for this usage (uniformAndStorageBuffer16BitAccess) by packing FP16 into UINT32 in the backend buffer structure and do the unpacking in the backend when loading in WGSL.
6.3. Using FP16 types in storage storage class
When using FP16 types in the storage storage class, the buffer layout constraints for storage are validated, as is shown below.
| Host-shareable type S | RequiredAlignOf(S, storage)
|
i32, u32, f32, or f16
|
AlignOf(S) |
atomic<T>, T is i32, u32, or f32
|
AlignOf(S) |
vecN<T>
|
AlignOf(S) |
matNxM<T>, T is f32 or f16
|
AlignOf(S) |
array<T, N>
|
AlignOf(S) |
array<T>
|
AlignOf(S) |
struct S
|
AlignOf(S) |
In fact this is just requesting everything aligned to its type's alignment.
7. Using FP16 as pipeline input and output
It is possible to use FP16 in user-defined pipeline input/output variables. However some Vulkan devices, which support other usages in this extension like FP16 built-in function and storage buffer, don’t support this usage. For capabilities reasons, we may suggest not enabling using FP16 as pipeline input or output with this extension. However, this usage can also be emulated on Vulkan devices with no native support for this usage (storageInputOutput16).
7.1. Built-in input/output variable
Built-in floating-point pipeline input and output variables (e.g. position and frag_depth) should be kept as f32.
7.2. User-defined input/output variable
Using user-defined variables of FP16 types as shader input and output (and intra-shader variables) is partially supported by backends. MSL, HLSL (if supporting native 16-bit mode) and GLSL (with AMD_gpu_shader_half_float extension) supports this usage, but Vulkan devices diverged. E.g., Nvidia Vulkan Windows drivers, Intel Linux Mesa drivers, and Google Pixel (before Pixel 6) all don’t support the required Vulkan feature storageInputOutput16. It is possible to emulate using FP16 types as intra-shader variables for devices not supporting storageInputOutput16.
8. Capability
Different vendors seem to have different support for FP16 related features, and different backend drivers of a vendor also have different support competence.
Detailed investigation on devices’ support are shown in the proposed design doc.
Activity
dneto0 commentedon Jan 18, 2022
f16 is definitely a desirable feature.
Google's position is:
This proposal is missing:
We (Google) haven't discussed the literal suffix specifically.
I dislike 'hf' as a suffix, because it doesn't generalize clearly. I guess 'h' is for 'half' which itself is a weird name.
I hope that we can avoid needing a type-specific suffix; that is one of the benefits of the "literal unification" #2227 proposal that we very recently got consensus on. Or, if we really want type-specific suffix then I would like to see a general scheme for it, e.g. 1234'f16 (that is not a proposal, but an illustration). I think this aspect should be avoided or decoupled and deferred.
kdashg commentedon Jan 22, 2022
WGSL meeting minutes 2022-01-18
storageBuffer16BitAccessis supported and also shaderFloat16.jiangzhaoming commentedon Jan 26, 2022
This comment proposes:
Bulit-in functions supporting
f16I have tested all float, matrix and vector built-in functions on D3D12 (using DXC) and check the SPIR-V Spec for them.
In conclusion, all these built-in functions defined in WGSL for
f32can be used withf16, except forquantizeToF16(which is just an no-op forf16inputs).We propose not to support using
f16with derivative built-in functions, since currently SPIR-V spec required their operands to be 32-bits (although DXIL allow using 16-bits variables in derivative operators).The detailed table of all built-in functions having
f16overload is shwon below.Tisf16orvecN<f16>T) ->TTisf16orvecN<f16>T) ->TTisf16orvecN<f16>T) ->TTisf16orvecN<f16>T) ->TTisf16orvecN<f16>T,e2:T) ->TTisf16orvecN<f16>T) ->TTisf16orvecN<f16>T,e2:T,e3: T) ->TTisf16orvecN<f16>T) ->TTisf16orvecN<f16>T) ->TTisf16vec3<T>,e2:vec3<T>) ->vec3<T>Tisf16orvecN<f16>T) ->TTisf16orvecN<f16>T,e2:T) ->f16Tisf16orvecN<f16>T) ->TTisf16orvecN<f16>T) ->TTisvecN<f16>T,e2:T,e3:T) ->TTisf16orvecN<f16>T) ->TTisf16orvecN<f16>T,e2:T,e3:T) ->TTisf16orvecN<f16>T) ->TTisf16T) ->__frexp_resultTisvecN<f16>T) ->__frexp_result_vecNTisf16orvecN<f16>T) ->TTisf16orvecN<f16>,Iisi32orvecN<i32>, whereIis a scalar ifTis a scalar, or a vector whenTis a vectorT,e2:I) ->TTisf16orvecN<f16>T) ->f16Tisf16orvecN<f16>T) ->TTisf16orvecN<f16>T) ->TTisf16orvecN<f16>T,e2:T) ->TTisf16orvecN<f16>T,e2:T) ->TTisf16orvecN<f16>T,e2:T,e3: T) ->TTisvecN<f16>T,e2:T,e3:f16) ->TTisf16T) ->__modf_resultTisvecN<f16>T) ->__modf_result_vecNTisf16vecN<T>) ->vecN<T>Tisf16orvecN<f16>T,e2:T) ->TTisf16orvecN<f16>T) ->TTisvecN<f16>T,e2:T) ->TTisvecN<f16>, I isf16T,e2:T,e3: I ) ->TTisf16orvecN<f16>T) ->TTisf16orvecN<f16>T) ->TTisf16orvecN<f16>T) ->TTisf16orvecN<f16>T) ->TTisf16orvecN<f16>T,e2:T,e3:T) ->TTisf16orvecN<f16>T) ->TTisf16orvecN<f16>T,e2:T) ->TTisf16orvecN<f16>T) ->TTisf16orvecN<f16>T) ->TTisf16orvecN<f16>T) ->TTisf16matNxN<T>) ->TTisf16matMxN<T>) ->matNxM<T>Tisf16vecN<T>, e2:vecN<T>) ->TAccuracy requirements for basic operations and built-in functions with
f16The precision requirements of FP16 instructions should follow the precision requirements in Vulkan spec.
In conclusion, the precision requirements for operations and built-in functions for
f16are the same with precision requirements forf32currently listed in WGSL spec (which are aligned with requirements in Vulkan spec), except for the functions listed below.f32f163 + 2 * |x|ULP1 + 2 * |x|ULPlitherum commentedon Feb 2, 2022
Polyfilling
I wanted to answer the question "what if, instead of adding FP16 as an optional feature, we put it in non-optional core, and polyfilled it on devices which don't support it?" Here, I'm considering "polyfilling" to mean "execute more instructions to produce the exact same result as you would have gotten", rather than "silently promote all FP16 to FP32 and just get the extra precision" as HLSL does.
For polyfilling math on FP16, and for using FP16 in input/output user-defined variables, the polyfill would be pretty straightforward - you'd just do the operation on FP32 and then do some bit manipulation to clear out bits that wouldn't occur in a FP16 value. So that's probably not a big deal.
For polyfilling FP16 reads on buffers, polyfilling would also be straightforward - just load more data than you need, and throw away the extra information. No problem.
However, polyfilling FP16 writes is more complicated, because if two threads write two adjacent FP16 values, those writes should not race.
Google recently described how the polyfill for FP16 writes would work - the write would be implemented by an atomic xor which would flip just the bits in the destination that need to be flipped. In order to determine which bits need to be flipped, the polyfill first has to read the value in the destination, and because Metal uses atomic types rather than atomic operations, on Metal the read would have to be atomic too.
Benchmark
So I wrote a little benchmark that compares the performance of real FP16 stores against the performance of the polyfill. It's a super simple benchmark - it just does
nwrites to a buffer, filling it up.(Note that, if this polyfill were actually employed, regular reads would have to be promoted to atomic loads too so they could see the results of the atomic xor. This benchmark doesn't measure that. The benchmark just measures stores.)
The benchmark compares the speeds of doing n writes to fill a buffer, in 3 different ways:
Results
The results here are the ratio of the runtime of version 2 divided by the runtime of version 1.
Here are some graphs. For all the graphs, the X axis is the number of writes into the buffer, and the Y axis is runtime (lower is better). The top row of graphs is comparing the runtime of version 1 against version 3 - that is, FP16 writes against FP32 writes. The bottom row of graphs is comparing the runtime of version 1 against version 2 - that is, FP16 writes against the Xor polyfill.
The left column of graphs is plotting the raw amount of time it takes to execute that many writes. The right column of graphs is plotting how long it takes to execute each individual write (aka the right graph is the left graph divided by x)
Intel Iris Pro Graphics:

NVIDIA GeForce GT 750M:

AMD Radeon Pro 580X:

AMD Radeon Pro Vega 56:

Apple M1:

Conclusion
The Nvidia and AMD devices show that it takes just as long to write FP16 as FP32, which I thought was interesting, because the FP32 writes should involve twice as many cache flushes since it’s writing 2x as much data.
On the other hand, the M1 shows it’s faster to write an FP16 than an FP32, but the Intel device shows the opposite - it’s faster there to write an F32 than an F16. Maybe Intel is internally doing some kind of polyfill?
Anyway, here are some possible options:
shaderFloat16,uniformAndStorageBuffer16BitAccess, andstorageInputOutput16non-optionally into core, and putstorageBuffer16BitAccessin a WGSL extension.I don't want to say just yet whether option 3 or option 4 seems better, but this evidence does suggest that option 1 and option 2 should probably not be used.
jiangzhaoming commentedon Feb 10, 2022
Updated extension requirement proposal
While still suggesting to enable all FP16 usages in one extension, we propose that this extension can be available on devices that meeting the following requirements.
shaderFloat16andstorageBuffer16BitAccessare both required.Vulkan device feature
uniformAndStorageBuffer16BitAccessorstorageInputOutput16is optional.Native16BitShaderOpsSupportedinD3D12_FEATURE_D3D12_OPTIONS4should betrue. DXIL is required. (I.e., we must be able to generate executable DXIL code)AMD_gpu_shader_half_floatrequired.Some investigation on FP16 support of Vulkan devices
In the design doc appendix some typical Vulkan devices are checked (based on GPUInfo database).
kvark commentedon Feb 14, 2022
I finally had a chance to review the proposal here. Thanks Intel for the titanic work of collecting this, and Google with Apple for help in unifying the proposal to a single extension!
General approach sounds good! TL;DR: expose an optional f16 extension that allows using the WGSL type pretty much everywhere in the shader (inter-stage, vertex in, fragment out, uniform and storage buffers, privates and workgroups, builtin functions). Poly-filling for uniform but not storage buffers sounds good as well.
A few minor notes:
pack2x16floatandunpack2x16floatoverloads that work withvec2<f16>instead? That seems straightforward and implementable.f16suffix just makes it materialize in place.kdashg commentedon Feb 16, 2022
WGSL meeting minutes 2022-02-09
dneto0 commentedon Feb 24, 2022
The pack/unpack are good ideas.
There is still a bitcast that does make sense, which is between
vec2<f16>and u32 (or any other 32-bit type), andvec4<f16>andvec2<T>where T is 32-bit. Those are supported directly by SPIR-V OpBitcast, and they do make sense.The bit representations are spelled out by the "internal layout of values" section, and so the bitcast conversions like these are well defined and useful.
jiangzhaoming commentedon Feb 25, 2022
Extension draft
I have wrote a draft for FP16 spec extension here, wishing to discuss in the next WGSL WG meeting.
Some changes in this draft from last meeting are listed below:
fp16-in-shader-and-buffer.__frexp_result_f16,__frexp_result_vecN_f16,__modf_result_f16, and__modf_result_vecN_f16forfrexpandmodfbuilt-in function usingf16. Details here.vec2<f16>orvec4<f16>and other types that having the same bits number, e.g.vec2<f16>tof32, andvec2<i32>tovec4<f16>. Packing and unpacking built-in functionspack2x16float(vec2<f16>) -> u32andunpack2x16floatf16(u32) -> vec2<f16>are identical tobitcast<u32>(vec2<f16>) -> u32andbitcast<vec2<f16>>(u32) -> vec2<f16>. E.g.,pack2x16float(vec2<f16>) -> u32andbitcast<u32>(vec2<f16>) -> u32both map the first element V.x of input f16 vector V into the low 16 bits of result u32 (bits 0 through 15).Hoping to have your comments and suggestions, thanks!
kdashg commentedon Mar 2, 2022
WGSL meeting minutes 2022-03-01
FP16 Extension: Part 1
jiangzhaoming commentedon Mar 18, 2022
Can pipeline-overridable constant be of f16?
Currently according to WGSL spec a pipeline-overridable constant can be of any scalar type (currently bool, i32, u32, and f32), although in WebGPU spec these four types is spelled out. If the FP16 extension (as currently proposed) is enabled, f16 will be one of the WGSL scalar types too, so we may decide if we allow a pipeline-overridable constant being of f16.
One problem is that ECMAScript use Number, i.e. f64, and WebGPU states that the conversion to corresponding WGSL data type is via an IDL value, but there is no f16/half in IDL types.
A possible solution is rephrase the WGSL spec to disable f16 pipeline-overridable constants, like:
litherum commentedon Mar 18, 2022
It’s probably valuable to allow f16 overridable constants. We can spec our own conversion rules for it.
jiangzhaoming commentedon Mar 21, 2022
If f16 pipeline-overridable constants is allowed, a possible WebGPU spec changes in this extension may be:
The algorithm above is adapted from conversion algorithm for float in Web IDL.
Edited: The TypeError is not a WebGPU concept. We should specific what WebGPU should do when a GPUPipelineConstantValue can not be converted into an IDL value, i.e. a type error occurred, for example rise a validation error.
Kangz commentedon Mar 21, 2022
We can't use JS exception in the algorithm that are for shader / pipeline compilation because it happens on the GPU process asynchronously with respect to JS execution.
If we add support for F16 in overridable constants, does this mean that the implementations will need some emulation of f16 for arithmetic operations on the CPU? This could be complicated to implement.
jiangzhaoming commentedon Mar 27, 2022
To reduce the complexity of conversion from
GPUPipelineConstantValuetof16, we suggest that an implementation can first convert thedoublevalues into float via standard IDL conversion, then do the binary32 to binary16 conversion in the backend (e.g. GPU process).The updated proposal for f16 pipeline-overridable constants in WebGPU spec changes in this extension:
jiangzhaoming commentedon Mar 30, 2022
Update
In the PR against spec (#2696), following changes are made:
f32tof16conversion defined in WGSL spec floating point conversion sectionAbstractFloattof16andAbstractInttof16feasible automatic conversions in the "ConversionRank from one type to another" table, right after the corresponding f32 conversion. The proposed ConversionRank are:dneto0 commentedon Apr 5, 2022
I like this!
I like having a regular scheme on the API side for naming shader extensions:
shader, then hyphen, then the enable-name in the shader.The update to the conversion rank table looks right. Backward compatibility of "existing" code requires that conversion from abstract type T to f16 have higher rank than T to f32.
dneto0 commentedon Apr 5, 2022
I know we gave guidance to add an
hsuffix for f16 literals.There was discussion in an office hour last week to avoid adding
h. The use case is to give authors a mechanism to very easily write source that uses f16 conversions. There was some idea of adding a syntax to indicate that the source that follows should use a different conversion rank table, conversions to f16 have lower rank than f32. Then no suffix is required; the reader just has to remember the context.jiangzhaoming commentedon Apr 14, 2022
The PR against spec #2696 has been merged, and the document PR #2647 is closed. Thanks!
kdashg commentedon Apr 15, 2022
Awesome work!
kdashg commentedon Apr 26, 2022
I think this is done then?
wgsl: Fix result type of distance built-in
wgsl: Fix result type of distance built-in (#3242)
wgsl: Fix result type of distance built-in (gpuweb#3242)