microsoft / microsoft/DirectXShaderCompiler

LinAlg HLK: Add layout, offset, stride, alignment and bounds coverage

Open
#8,651 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 LinAlg HLK execution coverage for matrix and vector data moving between public dx::linalg objects and descriptor or group-shared memory.

The tests must verify observable driver behaviour for layouts, non-zero offsets, padded strides, alignment requirements and specification-permitted descriptor bounds handling without conflating those axes with arithmetic coverage.

Why

Current tests primarily use row-major data at offset zero with tightly packed strides. That misses common implementation defects in address calculation, layout conversion, padding, source preservation and writes near resource boundaries.

Descriptor and group-shared operations also have different layout and alignment rules, and Thread-scope matrices use optimal layouts that may require conversion before results can be compared.

Required coverage

  • Exercise RowMajor and ColumnMajor descriptor and group-shared paths where permitted.
  • Exercise ByteAddressBuffer and RWByteAddressBuffer descriptor-load paths independently, retaining the resource-flag dependency on #8378.
  • Exercise applicable optimal layouts, including transpose variants, through the public API.
  • Cover offset zero and representative non-zero aligned offsets.
  • Cover tightly packed and padded row/column strides.
  • Verify stride-zero behaviour for layouts where an explicit row or column stride is not used.
  • Exercise the public default alignment argument. Add non-default alignment guarantees only when their legality is explicitly defined by the public contract; do not infer a minimum alignment from the default value or treat alignment as a capability-query axis.
  • Place guard data before and after source and destination regions to detect unintended reads or writes.
  • Use bounded descriptor-table resources for runtime bounds cases; do not use root descriptors as a bounds oracle.
  • For descriptor loads crossing a boundary, accept either whole-operation zeroing or per-element zero substitution as permitted by the specification.
  • For descriptor stores and accumulation crossing a boundary, accept either a whole-operation no-op or per-element suppression of out-of-range writes.
  • Keep group-shared execution in bounds. Invalid or undersized group-shared targets remain validator coverage under #7840.
  • Cover exact-end and first-crossing descriptor accesses using an expected-result set containing both specification-permitted bounds strategies, while retaining guard regions around the tested range.
  • Verify operations that promise source preservation do not modify their source region.
  • Cover descriptor and group-shared load, store and accumulation separately.
  • Cover vector accumulation addressing independently from matrix addressing.
  • Use #8647 for capability handling and #8649 for independent byte-level expectations.
  • Exercise the public dx::linalg API; document any operation that has no public wrapper.

Acceptance criteria

  • RowMajor and ColumnMajor paths have execution coverage for both reading and writing where supported.
  • At least one valid optimal-layout round trip is covered for each applicable Thread-scope operation family.
  • Every memory operation has a non-zero-offset case.
  • Every strided operation has both tightly packed and padded-stride coverage.
  • Default alignment paths are covered; non-default values are added only when publicly specified as legal.
  • Guard regions prove that successful operations do not overwrite unrelated data.
  • Descriptor bounds cases use resources with known dimensions and exclude root descriptors.
  • Load expectations accept both whole-operation and per-element zeroing where either is permitted.
  • Store and accumulation expectations accept both whole-operation and per-element write suppression where either is permitted.
  • Group-shared runtime OOB is not used as a conformance case.
  • SRV and UAV descriptor-load paths remain independently diagnosable.
  • Descriptor and group-shared paths remain independently diagnosable.
  • Every tested scope/layout/alignment combination is legal under the public contract. Capability gating is used only where #8647 exposes a corresponding query; a failure of a legal unqueryable combination is not NotApplicable.
  • Failure logs include layout, offset, stride, alignment and the first mismatching byte or element.

Initial operation mapping

  • CopyConvert and source preservation: #8546.
  • Descriptor load/store: #8547 and #8553.
  • Group-shared load/store: #8548 and #8554.
  • Descriptor and group-shared matrix accumulation: #8561 and #8562.
  • Vector accumulation: #8565.
  • Resource flag framework dependency: #8378.
  • Completed matrix-layout conversion precedent: #8386.

Existing negative-validation work

Invalid constant arguments and validator rules remain under #7840, including #8496-#8499, #8505, #8507, #8635, #8636 and #8645. This issue covers runtime execution of legal inputs and specification-defined runtime bounds behaviour only.

Public references

Out of scope

  • Duplicating DXIL-negative validation under #7840.
  • Exhaustive component-type coverage.
  • Arithmetic correctness unrelated to memory representation.
  • Publishing private resource, driver or hardware details.
  • Root-descriptor bounds assertions, because D3D does not attach dimensions to root descriptors.
  • Group-shared runtime out-of-bounds behaviour and invalid target sizing.
  • Inventing non-default alignment validity or capability policy not defined by the public contract.

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.