Skip to content

[HLSL] Map FP8 and packed 8-bit types for LinAlg matrix conversion - #8866

Merged
Jack Elliott (JoeCitizen) merged 1 commit into
microsoft:mainfrom
JoeCitizen:linalg-hlk-fp8-datatype-mapping
Sep 1, 2026
Merged

[HLSL] Map FP8 and packed 8-bit types for LinAlg matrix conversion#8866
Jack Elliott (JoeCitizen) merged 1 commit into
microsoft:mainfrom
JoeCitizen:linalg-hlk-fp8-datatype-mapping

Conversation

@JoeCitizen

@JoeCitizen Jack Elliott (JoeCitizen) commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

toLinAlgDataType mapped only six component types and hit a hard VERIFY_IS_TRUE(false) for the rest, which made Convert_F16_ToE4M3FN_AndBack and Convert_F16_ToE5M2_AndBack fail while still working out which datatype to query about, before either capability query ran.

Assisted-by: GitHub Copilot

toLinAlgDataType handled only F16, F32, I16, U16, I32 and U32, falling through
to a VERIFY_IS_TRUE(false) for everything else. That made
Convert_F16_ToE4M3FN_AndBack and Convert_F16_ToE5M2_AndBack fail outright: they
never reached a capability query, and instead tripped the assert while still
resolving which datatype to ask about.

The function is a second, independent mapping of the same D3D12 enum that
toCapabilityDataType already maps in full. queryConvertTypesSupport
deliberately cross-checks the two against each other before issuing any query,
so the incomplete one is what fires. That guard behaved correctly; the mapping
behind it was simply missing entries.

Add the four cases the other mapping already had: I8, U8, F8_E4M3FN and
F8_E5M2. The enumerators are present in the D3D12 header and their values are
already pinned against it by the ASSERT_RUNTIME_ENUM block, so the two mappings
now agree by construction for every type either can be asked about.

Both conversion tests pass on preview WARP rather than merely getting past the
assert, so the FP8 round-trip oracle is exercising real converted values.
Removing either new case individually returns exactly its own test to the
original assert failure and leaves the other passing.

I8 and U8 have no test reaching them today. They are included because leaving
one mapping a strict subset of the other is what produced this bug, and a
partial fix would leave the same trap set for the next type.

Assisted-by: GitHub Copilot

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 83725f5d-8e98-4c1d-91ee-ad47629e007b
@JoeCitizen
Jack Elliott (JoeCitizen) marked this pull request as ready for review August 31, 2026 23:02
Copilot AI balanced review requested due to automatic review settings August 31, 2026 23:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates LinAlg test datatype conversion so FP8 and 8-bit integer cases reach capability queries correctly.

Changes:

  • Maps I8/U8 to SINT8/UINT8.
  • Maps both FP8 formats to their D3D12 equivalents.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@JoeCitizen
Jack Elliott (JoeCitizen) merged commit c5e7397 into microsoft:main Sep 1, 2026
15 checks passed
@github-project-automation github-project-automation Bot moved this from New to Done in HLSL Roadmap Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants