Skip to content

[HLSL] Add CopyConvert and Convert coverage for LinAlg - #8772

Merged
Jack Elliott (JoeCitizen) merged 1 commit into
microsoft:mainfrom
JoeCitizen:linalg-hlk-convert-copyconvert
Aug 14, 2026
Merged

[HLSL] Add CopyConvert and Convert coverage for LinAlg#8772
Jack Elliott (JoeCitizen) merged 1 commit into
microsoft:mainfrom
JoeCitizen:linalg-hlk-convert-copyconvert

Conversation

@JoeCitizen

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

Copy link
Copy Markdown
Collaborator

Proposal 0035 specifies CopyConvert as a converting copy between matrix layouts and Convert as an element-wise conversion with RTNE and saturation. Neither had cross-component coverage.

These four tests convert between component types at one advertised wave size and read the source matrix back so a destructive implementation is caught. Rectangular and transposed cases make the destination shape and stride observable. Expected values are derived on the host: exact I16 widening, and hand-derived RTNE and saturation vectors for F32 to I16.

FP8 coverage is held back for a follow-up. The gate here now asks whether a destination type is advertised as a vector input rather than whether FP8 matrices can be constructed. That is the right question, but it also makes the FP8 cases executable on WARP, where they fail. That result deserves its own change rather than being buried in this one.

Copilot AI balanced review requested due to automatic review settings August 13, 2026 18:26

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

Adds cross-component LinAlg execution coverage for CopyConvert and Convert.

Changes:

  • Tests F16/F32 matrix conversion, transpose, and source preservation.
  • Tests integer RTNE/saturation and both FP8 formats.
  • Adds capability selection and host-side conversion oracles.

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

Comment thread tools/clang/unittests/HLSLExec/LinAlgTests.cpp Outdated
Comment thread tools/clang/unittests/HLSLExec/LinAlgTests.cpp Outdated
Copilot AI review requested due to automatic review settings August 13, 2026 22:58
@JoeCitizen
Jack Elliott (JoeCitizen) force-pushed the linalg-hlk-convert-copyconvert branch from 2e1a252 to 73246d7 Compare August 13, 2026 22:58

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Suppressed comments (2)

tools/clang/unittests/HLSLExec/LinAlgTests.cpp:2339

  • The PR description promises six cross-component tests covering both FP8 formats, but only four tests are registered here, and none of the added test shaders invokes Convert with F8_E4M3FN or F8_E5M2. The advertised FP8 encode/decode coverage is therefore missing; please add and register those cases with the independent host inputs described in the PR, or revise the stated scope if they were intentionally dropped.
  // CopyConvert / Convert coverage
  TEST_METHOD(CopyConvert_Wave_4x8_F16_ToF32);
  TEST_METHOD(CopyConvert_Wave_4x8_F32_ToF16_Transpose);
  TEST_METHOD(Convert_I16_ToI32_Exact);
  TEST_METHOD(Convert_F32_ToI16_RTNE_Saturate);

tools/clang/unittests/HLSLExec/LinAlgTests.cpp:5287

  • These declarations mirror an unreleased D3D12 ABI outside the repository's dedicated linalg_abi compatibility layer, and the assertions below check only total size. An SDK change that preserves size but changes alignment or field offsets would compile and then pass malformed data to CheckFeatureSupport. HlslExecTestUtils.h:169-239 establishes the convention of pinning mirrored types by enum value, size, alignment, and every field offset; please add these feature/enumeration definitions and checks there as well.
struct ConvertThreadVectorMatrixMultiplyEnumeration {
  UINT OperationType;
  UINT NumEntries;
  ConvertThreadVectorMatrixMultiplyEntry *ThreadVectorMatrixMultiply;
};

@damyanp Damyan Pepper (damyanp) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Mainly LGTM, but there are some coding guidelines not being followed that we should get addressed and teach the agent about before merging.

Comment thread tools/clang/unittests/HLSLExec/LinAlgTests.cpp Outdated
Comment thread tools/clang/unittests/HLSLExec/LinAlgTests.cpp Outdated
Comment thread tools/clang/unittests/HLSLExec/LinAlgTests.cpp Outdated
Comment thread tools/clang/unittests/HLSLExec/LinAlgTests.cpp Outdated
Comment thread tools/clang/unittests/HLSLExec/LinAlgTests.cpp Outdated
Exercise cross-component CopyConvert at one advertised wave size and read back the source matrix to catch destructive implementations. Rectangular and transposed cases make the destination shape and stride observable.

Add exact I16 widening and F32-to-I16 RTNE/saturation vectors.

Gate each Convert direction on native HLSL source support and destination VectorInputType advertisement, with a granular-query fallback for _1 drivers. Dispatch the element-wise Convert shaders as a single thread.

FP8 coverage is held back for a follow-up change. The earlier gate asked for FP8 matrix construction, which WARP does not advertise, so the FP8 cases skipped and never ran. The corrected gate makes them executable and they fail, so landing them separately keeps this change green and lets that result be triaged on its own.

Assisted-by: GitHub Copilot

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 83725f5d-8e98-4c1d-91ee-ad47629e007b
Copilot AI review requested due to automatic review settings August 14, 2026 19:51
@JoeCitizen
Jack Elliott (JoeCitizen) force-pushed the linalg-hlk-convert-copyconvert branch from 73246d7 to 6b63697 Compare August 14, 2026 19:51

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@JoeCitizen
Jack Elliott (JoeCitizen) enabled auto-merge (squash) August 14, 2026 20:01
@JoeCitizen
Jack Elliott (JoeCitizen) merged commit 39baaad into microsoft:main Aug 14, 2026
13 checks passed
@github-project-automation github-project-automation Bot moved this from New to Done in HLSL Roadmap Aug 14, 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