Represent FP4 E2M1 with SPV_EXT_ocp_microscaling_types#3828
Open
vmaksimo wants to merge 6 commits into
Open
Conversation
1d18f64 to
64eb474
Compare
Add the multi-vendor SPV_EXT_ocp_microscaling_types extension as the preferred representation for the FP4 (E2M1) type, alongside the existing Intel-only SPV_INTEL_float4 extension. Plain FP4 conversion builtins are recognized with both the EXT postfix (e.g. ConvertE2M1ToFP16EXT, mapping to the Float4E2M1EXT encoding and Float4EXT capability) and the INTEL postfix (ConvertE2M1ToFP16INTEL, mapping to the Float4E2M1INTEL encoding and capability). The two encodings translate independently in both directions, so a module using either extension round-trips to the matching builtin. Stochastic-rounding builtins keep the INTEL postfix as their operation belongs to SPV_INTEL_fp_conversions. The Float4EXT capability and the Float4E2M1EXT floating-point encoding are published in the core enums by SPV_EXT_ocp_microscaling_types, so bump the SPIRV-Headers pin to that revision and reference the published symbols directly instead of internal copies, matching how the other EXT float encodings are used. AI-assisted: Claude Opus 4.8 (commercial SaaS)
64eb474 to
303ea6f
Compare
Complete the switch to SPV_EXT_ocp_microscaling_types by removing the SPV_INTEL_float4 representation of the FP4 (E2M1) type: the Float4E2M1INTEL encoding (6214) and capability (6212), the INTEL-postfix conversion builtins, and the reader paths that recognized them. FP4 values are now represented exclusively with the Float4E2M1EXT encoding; FP4 matrix operands are still passed as packed integers. Float4E2M1CooperativeMatrixINTEL is retained: it gates FP4 cooperative-matrix component types, which use the Float4E2M1EXT encoding. AI-assisted: Claude Opus 4.8 (commercial SaaS)
303ea6f to
28ac54b
Compare
This reverts commit 28ac54b.
Contributor
|
@YuriPlyakhin 2nd commit reverted |
YuriPlyakhin
reviewed
Jul 8, 2026
YuriPlyakhin
reviewed
Jul 8, 2026
YuriPlyakhin
reviewed
Jul 8, 2026
YuriPlyakhin
reviewed
Jul 8, 2026
YuriPlyakhin
reviewed
Jul 8, 2026
YuriPlyakhin
reviewed
Jul 8, 2026
YuriPlyakhin
reviewed
Jul 8, 2026
04e8d1c to
ce3f220
Compare
| ; for scalar | ||
|
|
||
| ; RUN: llvm-spirv %s -o %t.spv --spirv-ext=+SPV_EXT_float8,+SPV_INTEL_float4,+SPV_INTEL_int4,+SPV_KHR_bfloat16,+SPV_INTEL_fp_conversions | ||
| ; RUN: llvm-spirv %s -o %t.spv --spirv-ext=+SPV_EXT_float8,+SPV_EXT_ocp_microscaling_types,+SPV_INTEL_int4,+SPV_KHR_bfloat16,+SPV_INTEL_fp_conversions |
| __builtin_spirv_ConvertE2M1ToFP16EXT, __builtin_spirv_ConvertE2M1ToBF16EXT, | ||
| __builtin_spirv_ConvertFP16ToE2M1EXT, __builtin_spirv_ConvertBF16ToE2M1EXT | ||
|
|
||
| For backward compatibility the equivalent INTEL-postfix builtins (e.g. *__builtin_spirv_ConvertE2M1ToFP16INTEL*) |
Contributor
There was a problem hiding this comment.
nit
Suggested change
| For backward compatibility the equivalent INTEL-postfix builtins (e.g. *__builtin_spirv_ConvertE2M1ToFP16INTEL*) | |
| For backward compatibility, the equivalent INTEL-postfix builtins (e.g. *__builtin_spirv_ConvertE2M1ToFP16INTEL*) |
YuriPlyakhin
approved these changes
Jul 10, 2026
YuriPlyakhin
left a comment
Contributor
There was a problem hiding this comment.
LGTM (just couple nits left)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Switch the FP4 (E2M1) type from
SPV_INTEL_float4extension to the multi-vendorSPV_EXT_ocp_microscaling_typesextension.Plain FP4 conversion builtins get the EXT postfix (e.g. ConvertE2M1ToFP16EXT);
stochastic-rounding builtins keep the INTEL postfix as their operation belongs to
SPV_INTEL_fp_conversions.Specs:
SPV_INTEL_float4- now it only allows FP4 type for cooperative matrix components.Note:
In this patch we still accept both SPV_INTEL_float4 and SPV_EXT_ocp_microscaling_types encodings for E2M1; each encoding round-trips to its own builtin. The reason is not all producers/consumers are ready to switch to the new extension yet. At the same time, we want to introduce E2M1 through SPV_EXT_ocp_microscaling_types ASAP for those who are ready and willing to switch to it.
AI-assisted: Claude Opus 4.8 (commercial SaaS)