microsoft / microsoft/DirectXShaderCompiler

LinAlg HLK: Add dimension, shape and boundary coverage

Open
#8,648 0 comments 0 reactions 1 assignee View on GitHub

@JoeCitizen is already working on this.

Since Jul 22, 2026.

Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

Goal

Expand the LinAlg HLK ExecutionTests beyond square 16x16 matrices so third-party compiler and driver implementations are exercised across valid square, rectangular and boundary shapes through the public dx::linalg API.

Tests must keep M, N, K and vector lengths independent rather than relying on M == N == K.

Why

Most existing tests use 16x16 matrices, which masks indexing, stride, resource-size and vector-length bugs. PR #8620 exposed square-only CopyConvert assumptions, and PR #8643 exposed a separate MatVec input-length assumption.

The HLSL/DXIL rules also permit different K ranges by scope, while the D3D12 capability API reports operation- and device-specific supported shapes. HLK coverage needs representative legal boundaries without assuming every device supports every legal permutation.

Required coverage

  • Parameterise test data, buffers, strides and expected-value helpers using independent M, N and K values.
  • Cover square and non-square matrices for every operation where shape is observable.
  • For matrix multiplication, include a case where M, N and K are all different.
  • For MatVec operations, verify that the input length follows K while bias and output lengths follow M.
  • For OuterProduct, verify independent M and N vector lengths and result dimensions.
  • For CopyConvert transpose, verify source MxN becomes destination NxM.
  • Exercise the legal K boundaries defined by scope where practical:
    • Thread and Wave: [4, 128];
    • ThreadGroup: [1, 1024].
  • Exercise proposal-legal dimension boundaries and operation-specific query results without assuming every capability category reports shape limits.
  • Wave matrix multiply: exercise returned native M/K/N tile shapes and representative integer multiples within the HLSL-legal ranges; do not infer or test a device maximum that the query does not report.
  • ThreadGroup matrix multiply: query each selected exact M/K/N shape and use a reported valid thread-group size.
  • Thread MatVec and OuterProduct: validate dimensions against the public HLSL contract; their capability queries gate type combinations but do not provide per-shape support results.
  • Matrix construction/general operations: consume MinM, MinK and MinN only according to their documented public semantics and do not reinterpret them as global maximum boundaries.
  • Verify resource sizing and row/column stride calculations remain correct for rectangular shapes.
  • Use requirements-based and pairwise selection rather than a full Cartesian product.
  • Exercise the public dx::linalg API; document any operation that cannot be reached through it.

Acceptance criteria

  • Each shape-sensitive operation issue identifies its required M/N/K or vector-length combinations.
  • Every applicable operation family has at least one non-square execution case.
  • Matrix multiply coverage includes distinct M, N and K dimensions.
  • MatVec and OuterProduct cases prove their input and output vector-length rules.
  • HLSL-legal K endpoints are represented where the operation contract and corresponding public capability query permit a determinate execution decision.
  • Wave multiply cases include native reported tiles and representative legal multiples without inventing a maximum size.
  • ThreadGroup multiply cases use an exact supported shape and valid reported group size.
  • Thread MatVec and OuterProduct cases are not skipped because their dimensions are absent from the capability query.
  • A shape is classified as unsupported only when the relevant public query represents that shape and returns an unsupported result; an unqueryable shape axis is not a NotApplicable reason.
  • Expected values come from independent host calculations or reviewed hand derivations.
  • Existing square smoke coverage remains intact.
  • No test helper assumes source and destination matrices have identical dimensions or strides.

Initial operation mapping

  • Construction and conversion: #8545, #8546 and #8564.
  • Descriptor and group-shared memory: #8547, #8548, #8553 and #8554.
  • Element and query operations: #8549 through #8555.
  • Matrix arithmetic: #8556 through #8558.
  • MatVec and OuterProduct: #8559, #8560 and #8563.
  • Accumulation paths: #8561, #8562 and #8565.

Public references

Out of scope

  • Invalid-dimension rejection, which belongs to DXIL validation under #7840 and #8491.
  • Exhaustive testing of every legal shape.
  • Component-type, layout and conversion-semantics expansion except where needed to isolate shape behaviour.
  • Publishing private hardware limits or driver schedules.
  • Inferring device maximum matrix dimensions from native Wave tile results.
  • Inventing per-shape support for Thread MatVec or OuterProduct, whose public queries expose type combinations rather than dimensions.

Assisted-by: GitHub Copilot

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.