Skip to content

[HLSL] Add LinAlg MatVec interpretation and bias coverage#8672

Draft
JoeCitizen wants to merge 10 commits into
microsoft:mainfrom
JoeCitizen:linalg-hlk-matvec-semantics
Draft

[HLSL] Add LinAlg MatVec interpretation and bias coverage#8672
JoeCitizen wants to merge 10 commits into
microsoft:mainfrom
JoeCitizen:linalg-hlk-matvec-semantics

Conversation

@JoeCitizen

Copy link
Copy Markdown
Collaborator

Summary

  • refactor the MatVec execution harness to use independent matrix, vector, bias, and output resources with exact typed host encoding and CPU-derived dot-product expectations
  • add exact ThreadVectorMatrixMultiply capability queries and cover non-uniform F16, capability-gated ColumnMajor, required packed SInt8 and UInt8 tuples, the required native F32-to-SInt8 interpretation path, optional unsigned U32 output, and independent bias data
  • correct packed 8-bit element sizing and validate LSB-first vector packing with zero padding to the 32-bit storage boundary

The four existing MatVec baselines are migrated to the shared harness without changing their intended inputs or results.

Validation

  • built the Release ExecHLSLTests target
  • ran all 11 MatVec methods on WARP 1.65535.20-preview, Agility SDK 1.721.2-preview, and ExperimentalShaders=*: 9 passed, the ColumnMajor case skipped because WARP does not advertise TRANSPOSE, and the mandatory F32-vector/SInt8-matrix case exposed the runtime defect below
  • reran the established 30-case ancestor stack: 29 passed, 0 failed, and the unchanged FP8 method skipped because WARP advertises neither FP8 format
  • compiled the capability-gated ColumnMajor shader independently
  • inspected emitted DXIL for packed SInt8/UInt8 inputs, native <8 x float> input with SInt8 interpretation, unsigned output with isOutputSigned=false, and a distinct bias SRV
  • compiled HlslExecTestUtils.cpp and LinAlgTests.cpp against the preview D3D12 headers
  • clang-format 17.0.1 and git diff --check pass

No physical GPU or packaged-HLK execution is claimed.

Preview WARP defect

WARP advertises the mandatory F32-vector x SInt8-matrix to SInt32 tuple as supported, but the test receives [-1012, 1012, -258, 774] instead of the independently derived [110, -110, 0, -10].

The emitted DXIL correctly carries a native <8 x float> vector and SInt8 conversion-target interpretation. The current WARP implementation treats the float words as packed I8 bytes instead of applying the required RTNE saturating F32-to-SInt8 conversion. The mandatory test remains active; skipping or weakening it would hide a Tier-1 conformance defect.

Stack

This draft is stacked on PR #8671, which is stacked on 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 MatVec change itself is commit e1b8cfc2f.

This remains a draft for named human review. The reviewer should verify the capability-query tuple, native-vector interpretation immediate, packed-byte ordering, independent bias resource, CPU oracle, and preview-WARP defect analysis before requesting maintainer review.

Refs #7841
Refs #8559
Refs #8560
Refs #8650
Refs #8653

Assisted-by: GitHub Copilot

Jack Elliott and others added 10 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
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
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
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