Skip to content

[HLSL] Add LinAlg ThreadGroup matrix arithmetic coverage#8674

Draft
JoeCitizen wants to merge 14 commits into
microsoft:mainfrom
JoeCitizen:linalg-hlk-threadgroup-arithmetic
Draft

[HLSL] Add LinAlg ThreadGroup matrix arithmetic coverage#8674
JoeCitizen wants to merge 14 commits into
microsoft:mainfrom
JoeCitizen:linalg-hlk-threadgroup-arithmetic

Conversation

@JoeCitizen

Copy link
Copy Markdown
Collaborator

Summary

  • intersect exact MatrixConstruction support with the ThreadGroupMatrixMultiply type/shape query, select an advertised executable wave and thread-group size, and compile each shader at both concrete values
  • cooperatively stage typed inputs through group-shared memory, execute the ThreadGroup-scope operation with the full group, and use barriers plus thread-strided readback to avoid visibility and UAV races
  • add non-uniform F16 8x16x8 multiply, F16-to-F32 multiply-accumulate with an independent initial accumulator, and exact I32 8x8x8 multiply coverage using the checked host matrix-product oracle

All three cases are capability-gated because the corresponding format and shape tuples are exposed through the ThreadGroup matrix-multiply query.

Validation

  • built the Release ExecHLSLTests target
  • ran all 3 new methods on WARP 1.65535.20-preview, Agility SDK 1.721.2-preview, and ExperimentalShaders=*: 3 passed at wave size 4 and thread-group size 4
  • ran the complete 53-case stack selection: 50 passed, the two unchanged capability cases skipped, and only the already-documented mandatory MatVec native-F32/SInt8 WARP defect failed
  • inspected emitted DXIL for ThreadGroup scope S2, A/B/Accumulator uses U0/U1/U2, exact F16/F32/I32 shapes, group-shared addrspace(3) loads/stores, and the expected multiply or multiply-accumulate operation
  • compiled LinAlgTests.cpp directly against the preview D3D12 headers
  • clang-format 17.0.1, git diff --check, and an independent graphics correctness review pass

No physical GPU, native multi-wave ThreadGroup configuration, or packaged-HLK execution is claimed.

Stack

This draft is stacked on PR #8673, which is stacked on PR #8672, PR #8671, PR #8670, PR #8669, PR #8668, PR #8667, PR #8666, PR #8665, and PR #8662. Until those ancestors land, this diff contains their commits as well. The ThreadGroup arithmetic change itself is commit 3984e07b0.

This remains a draft for named human review. The reviewer should verify the ThreadGroup capability query inputs, selected wave/group sizes, full-group participation, group-shared barriers and strides, component/use/scope encodings, and exact host oracle before requesting maintainer review.

Refs #7841
Refs #8556
Refs #8558
Refs #8652

Assisted-by: GitHub Copilot

Jack Elliott and others added 3 commits July 23, 2026 14:52
Use the shared MatrixUse parameter for the OuterProduct result and set it to Accumulator, matching proposal 0035 and the public dx::linalg API. Add a host-side invariant to prevent the legacy A-use declaration from returning.

Assisted-by: GitHub Copilot

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83725f5d-8e98-4c1d-91ee-ad47629e007b
Create SRV buffers without UAV flags and transition them for both pixel and non-pixel shader access. Use a direct resource-initialization list so the graphics-only pixel state is legal.

Assisted-by: GitHub Copilot

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 83725f5d-8e98-4c1d-91ee-ad47629e007b
Add typed F16, F32, I32, and U32 matrix data with safe byte encoding, rectangular row/column-major storage mapping, and explicit exact, permitted-result, or excluded comparison policy. Cover offsets and padded strides with independent host goldens, and migrate the existing CopyConvert tests onto the oracle.

Assisted-by: GitHub Copilot

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 83725f5d-8e98-4c1d-91ee-ad47629e007b
Jack Elliott and others added 3 commits July 25, 2026 12:59
Handle packed row or column byte-count overflow before using the result, and include raw F32 bits in exact mismatch diagnostics. Cover adjacent float bit patterns in the host oracle test.

Assisted-by: GitHub Copilot

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83725f5d-8e98-4c1d-91ee-ad47629e007b
Add ABI-checked wrappers for the six D3D12 Linear Algebra capability
query categories and explicit applicability classification. Gate the
rectangular F32 CopyConvert case using concrete supported wave sizes.

Assisted-by: GitHub Copilot

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 83725f5d-8e98-4c1d-91ee-ad47629e007b
Compile capability-gated CopyConvert coverage at the exact wave size whose MatrixConstruction support was queried. Keep mandatory baseline cases on the existing ranged WaveSize attribute.

Assisted-by: GitHub Copilot

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83725f5d-8e98-4c1d-91ee-ad47629e007b
@JoeCitizen
JoeCitizen force-pushed the linalg-hlk-threadgroup-arithmetic branch from 3984e07 to d71cfa5 Compare July 25, 2026 01:03
Jack Elliott and others added 8 commits July 25, 2026 14:10
Validate multiplication support flags per operation, exhaustively check the preview D3D12 ABI mirrors, and preserve query-backed optional skips in HLK mode.

Assisted-by: GitHub Copilot

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83725f5d-8e98-4c1d-91ee-ad47629e007b
Add rectangular Length/GetCoordinate/GetElement coverage and the specified Get/Set out-of-bounds behaviour. Capture thread-local matrix records without UAV races and gate optional F32 cases at the exact queried wave size.

Assisted-by: GitHub Copilot

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83725f5d-8e98-4c1d-91ee-ad47629e007b
Add bounded raw descriptor-table bindings and independent whole-buffer
oracles for LinAlg descriptor operations. Cover non-zero offsets, padded
strides, row/column-major transfer, descriptor bounds, and capability-gated
atomic accumulation.

Assisted-by: GitHub Copilot

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 83725f5d-8e98-4c1d-91ee-ad47629e007b
Add race-free Wave and ThreadGroup group-shared transfer coverage for row/column-major layouts, non-zero offsets, padded strides, and exact whole-buffer guards. Add capability-gated Wave atomic accumulation with coordinate-derived values, while keeping cross-component conversion out of scope pending runtime conformance.

Assisted-by: GitHub Copilot

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83725f5d-8e98-4c1d-91ee-ad47629e007b
Add mixed F16/F32 CopyConvert cases and verify that conversion leaves the source matrix unchanged.

Cover exact integer widening, RTNE plus saturating float narrowing, and capability-gated FP8 encoding and round-trip semantics with independent host oracles.

Assisted-by: GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 83725f5d-8e98-4c1d-91ee-ad47629e007b
Refactor MatVec execution tests around independent matrix, vector, bias, and output resources with host-derived exact expectations.

Add required interpreted input tuples, non-uniform layout coverage, unsigned output, and independent bias validation behind the runtime ThreadVectorMatrixMultiply capability query. The mandatory native F32-to-SInt8 case remains active and exposes the current preview WARP conversion defect.

Assisted-by: GitHub Copilot

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83725f5d-8e98-4c1d-91ee-ad47629e007b
Add capability-gated Wave matrix multiply, multiply-accumulate, and B-use accumulate cases with independent exact host oracles. Make the accumulator-layout query select an observable A-use or B-use execution path.

Assisted-by: GitHub Copilot

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83725f5d-8e98-4c1d-91ee-ad47629e007b
Add capability-gated ThreadGroup matrix multiply and multiply-accumulate cases with typed group-shared staging and exact host-derived results. Select and compile at the concrete wave and thread-group sizes advertised for each type and shape.

Assisted-by: GitHub Copilot

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83725f5d-8e98-4c1d-91ee-ad47629e007b
@JoeCitizen
JoeCitizen force-pushed the linalg-hlk-threadgroup-arithmetic branch from d71cfa5 to 843a39f Compare July 25, 2026 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

1 participant