Skip to content

Support SaturatedToLargestFloat8NormalConversionEXT decoration#3767

Open
vmaksimo wants to merge 3 commits into
KhronosGroup:mainfrom
vmaksimo:SPV_EXT_float8-decoration
Open

Support SaturatedToLargestFloat8NormalConversionEXT decoration#3767
vmaksimo wants to merge 3 commits into
KhronosGroup:mainfrom
vmaksimo:SPV_EXT_float8-decoration

Conversation

@vmaksimo
Copy link
Copy Markdown
Contributor

@vmaksimo vmaksimo commented Jun 1, 2026

Add round-trip handling for SPV_EXT_float8's saturating FP-to-FP8 conversion.

At the LLVM IR level it is represented via _sat suffix on the existing __builtin_spirv_Convert<Src>To<E4M3|E5M2>EXT interface. When _sat is present, the resulting OpFConvert is decorated with SaturatedToLargestFloat8NormalConversionEXT.

AI-assisted: Claude Opus 4.7 (commercial SaaS)

Add round-trip handling for `SPV_EXT_float8`'s saturating FP-to-FP8
conversion.

At the LLVM IR level it is represented via `_sat` suffix on the
existing `__builtin_spirv_Convert<Src>To<E4M3|E5M2>EXT` interface.
When `_sat` is present, the resulting OpFConvert is decorated with
`SaturatedToLargestFloat8NormalConversionEXT`.

AI-assisted: Claude Opus 4.7 (commercial SaaS)
@MrSidims
Copy link
Copy Markdown
Contributor

MrSidims commented Jun 1, 2026

At the LLVM IR level it is represented via _sat suffix on the existing __builtin_spirv_ConvertTo<E4M3|E5M2>EXT

Shouldn't it be __builtin_spirv_ClampConvert<Src>To<E4M3|E5M2> instead?

@vmaksimo
Copy link
Copy Markdown
Contributor Author

vmaksimo commented Jun 1, 2026

At the LLVM IR level it is represented via _sat suffix on the existing __builtin_spirv_ConvertTo<E4M3|E5M2>EXT

Shouldn't it be __builtin_spirv_ClampConvert<Src>To<E4M3|E5M2> instead?

I believe it can be both, wanted to publish this for discussion to choose the preferrable one.

@MrSidims
Copy link
Copy Markdown
Contributor

MrSidims commented Jun 1, 2026

I'd not create instances without necessity :)

vmaksimo added 2 commits June 2, 2026 03:57
Address review feedback on the previous commit: instead of introducing a
`_sat` suffix on `__builtin_spirv_Convert<Src>To<E4M3|E5M2>EXT`, reuse the
existing `__builtin_spirv_ClampConvert<Src>To<E4M3|E5M2>INTEL` interface
from `SPV_INTEL_fp_conversions`.

When `SPV_EXT_float8` is enabled, those four FP8-result entries are now
emitted as `OpFConvert` decorated with
`SaturatedToLargestFloat8NormalConversionEXT` instead of
`OpClampConvertFToFINTEL`, and round-trip back to the same builtin names.

The reverse translator also rejects modules where this decoration targets
a non-FP8 conversion: per spec it may only decorate
`OpFConvert`/`OpConvertSToF`/`OpConvertUToF` with an `Float8E4M3EXT` or
`Float8E5M2EXT` Result Type, and `spirv-val` does not enforce this yet.

AI-assisted: Claude Opus 4.7 (commercial SaaS)
@vmaksimo
Copy link
Copy Markdown
Contributor Author

vmaksimo commented Jun 2, 2026

CI failures are caused by llc change llvm/llvm-project#200791

@vmaksimo vmaksimo closed this Jun 3, 2026
@vmaksimo vmaksimo reopened this Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants