Goal
Remove the untyped layer from the LinAlg CPU oracle in LinAlgTests.cpp so the component type is carried in the type system rather than switched on at runtime through ComponentType.
Why
The oracle currently has two parallel surfaces: templated helpers such as writeTypedMatrixBuffer<T> and decodeTypedMatrixBuffer<T>, and untyped wrappers that dispatch to them on a ComponentType value. The untyped layer exists only to bridge host code that has a runtime component type, and it costs a std::variant payload in TypedMatrix, a dispatch per entry point, and a class of failure — a mismatch between the variant alternative and the declared ComponentType — that a templated design cannot express at all.
Both reviewers of #8666 asked for this independently: Damyan Pepper at L109 and Ashley Coleman at L537. The surrounding harness is already moving this way — MatrixParams::CompType (#8285) is the typed precedent.
Required work
- Establish whether the runtime-typed entry points are genuinely needed, or whether the callers can be templated too. Prefer templating the callers.
- Where a runtime type genuinely must be dispatched, confine it to a single narrow boundary rather than duplicating it per entry point.
- Reduce or remove the
std::variant in TypedMatrix if the templating makes it redundant.
- Keep the existing exact-comparison semantics unchanged; this is a restructuring, not a behaviour change.
Acceptance criteria
- No
ComponentType switch remains in the oracle's write, decode, transpose or verify paths.
LinAlgCPUOracleTests passes unchanged.
LinAlg::DxilConf_SM610_LinAlg::* result is identical to the pre-change baseline on the same runtime, test for test rather than by totals.
- The variant-versus-
ComponentType mismatch case is either impossible by construction or has an explicit single point of validation.
Blocked on
The current LinAlg HLK PR stack landing. This restructures the same file that every stack item builds on, so starting it earlier would force a re-parent of the whole stack for no behaviour change.
Public references
Out of scope
- Any change to which cases are covered, or to expected values.
- The checked-arithmetic redesign (tracked separately).
- Tolerance or ULP comparison modes (tracked separately).
Assisted-by: GitHub Copilot
Goal
Remove the untyped layer from the LinAlg CPU oracle in
LinAlgTests.cppso the component type is carried in the type system rather than switched on at runtime throughComponentType.Why
The oracle currently has two parallel surfaces: templated helpers such as
writeTypedMatrixBuffer<T>anddecodeTypedMatrixBuffer<T>, and untyped wrappers that dispatch to them on aComponentTypevalue. The untyped layer exists only to bridge host code that has a runtime component type, and it costs astd::variantpayload inTypedMatrix, a dispatch per entry point, and a class of failure — a mismatch between the variant alternative and the declaredComponentType— that a templated design cannot express at all.Both reviewers of #8666 asked for this independently: Damyan Pepper at L109 and Ashley Coleman at L537. The surrounding harness is already moving this way —
MatrixParams::CompType(#8285) is the typed precedent.Required work
std::variantinTypedMatrixif the templating makes it redundant.Acceptance criteria
ComponentTypeswitch remains in the oracle's write, decode, transpose or verify paths.LinAlgCPUOracleTestspasses unchanged.LinAlg::DxilConf_SM610_LinAlg::*result is identical to the pre-change baseline on the same runtime, test for test rather than by totals.ComponentTypemismatch case is either impossible by construction or has an explicit single point of validation.Blocked on
The current LinAlg HLK PR stack landing. This restructures the same file that every stack item builds on, so starting it earlier would force a re-parent of the whole stack for no behaviour change.
Public references
hlsl-specs), Linear Algebra matrix operations.MatrixParams::CompType.Out of scope
Assisted-by: GitHub Copilot