Skip to content

Add descriptor-heap ConstantBuffer array-of-matrix regression test (#11483)#11484

Open
nv-slang-bot[bot] wants to merge 3 commits into
masterfrom
fix/issue-11483
Open

Add descriptor-heap ConstantBuffer array-of-matrix regression test (#11483)#11484
nv-slang-bot[bot] wants to merge 3 commits into
masterfrom
fix/issue-11483

Conversation

@nv-slang-bot

@nv-slang-bot nv-slang-bot Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a GPU-free regression test for the descriptor-heap ConstantBuffer<T> path
(spvDescriptorHeapEXT) covering a nested array-of-matrix member — the shape
reported in #11483. No compiler change: investigation found the underlying defect
is already resolved on main by #11211; this fills the test-coverage gap that
#11211 left.

Diagnosis

#11483 reports two symptoms for getDescriptorFromHandle(ConstantBuffer<T>.Handle(uint2(i,0))):
a hard SIGSEGV during SPIR-V emission, and (on builds that don't crash) wrong data
read back for a nested float4x4 shadow_transforms[4] member.

Layout parity + spirv-val found no compiler emission/layout defect; with no
GPU available they cannot fully exclude a runtime-only defect (e.g. descriptor
heap index/stride interaction at execution time), so final closure should ride on a
reporter retest on hardware.

Approach

#11211 added descriptor-heap ConstantBuffer tests, but only for scalar-struct
elements. The reporter's failing member is a nested float4x4[N], which is laid out
through std140 array/matrix wrapper types — a path none of the existing tests
exercise. This PR adds that coverage so a future regression in the nested-member
layout (or a return of the emission crash) is caught.

Files changed

  • tests/spirv/descriptor-heap-constant-buffer-array-of-matrix.slang (new test)

Tests

New test compiles a compute entry point fetching ConstantBuffer<CameraData>
through the descriptor heap, where CameraData mirrors the reporter's struct (six
leading float4x4, float4x4 shadowTransforms[4], trailing float4). It runs
under two layout configurations — the default std140 path and
-fvk-use-scalar-layout (the _natural path the reporter's repro actually used).
FileCheck pins, for each: Block on the block type; member offsets 0/384/640; the
matrix array's ArrayStride 64; per-matrix MatrixStride 16 + RowMajor; and the
heap load producing a Uniform-class buffer pointer consumed by OpBufferPointerEXT
(never a Function-class pointer — guarding against a copy lowering).

Scope is compile + emitted layout only; it does not reproduce the runtime
wrong-data readback (no GPU in CI), and the bound-buffer parity noted in the
diagnosis is not re-diffed in-file — the test pins the descriptor-heap path's
absolute offsets/strides.

Risk

Test-only; no compiler source touched. Lowest-risk change class. The single
unverifiable gap is runtime behavior (no GPU), disclosed above.

Relates to #11483.

nv-slang-bot Bot and others added 2 commits June 5, 2026 13:32
…11483)

#11483 reported that a ConstantBuffer<T> fetched via the spvDescriptorHeapEXT
untyped-pointer path read wrong data for a nested float4x4[N] member; on a
slightly newer build the same pattern crashed during SPIR-V emission. Both the
crash and the wrong-data are no longer reproducible on current main: the crash
was fixed by #11211 (which post-dates the reporting/triage builds), and the
heap path now emits byte-identical std140/scalar layout to a bound
[[vk::binding]] ConstantBuffer (verified by diffing decorations and by
spirv-val).

#11211 added descriptor-heap ConstantBuffer coverage but only for scalar struct
elements; this adds the missing nested array-of-matrix case (the member the
reporter saw fail), asserting the std140 offsets/ArrayStride/MatrixStride and
that the descriptor-heap load yields a Uniform-class buffer pointer.

Co-authored-by: Harsh Aggarwal <haaggarwal@nvidia.com>
Mirror the issue's struct (six leading float4x4, float4x4[4] at std140
offset 384, trailing float4 at 640) so the test pins the exact nested
array-of-matrix offsets/strides that motivated closing #11483, and tie
the stride CHECKs to the named array/matrix-wrapper types.

Co-authored-by: Harsh Aggarwal <haaggarwal@nvidia.com>
@nv-slang-bot nv-slang-bot Bot added the pr: non-breaking PRs without breaking changes label Jun 5, 2026
Address APPROVE_WITH_NITS feedback on the regression test:
- Add a -fvk-use-scalar-layout run line (CHECKSCALAR) pinning the
  `_natural` block the reporter's repro actually exercised, alongside
  the default std140 path.
- Reference the captured %[[CB]]/%[[CBN]] block name in the negative
  CHECK-NOT instead of a literal id, matching the sibling tests.
- Pin the matrices' RowMajor orientation beside MatrixStride.
- Rewrite the header to state the test is compile + emitted-layout only
  (it does not reproduce the runtime readback symptom) and that
  bound-buffer parity was established by the triage diff, not in-file.

Co-authored-by: Harsh Aggarwal <haaggarwal@nvidia.com>
@szihs szihs marked this pull request as ready for review June 5, 2026 11:18
@szihs szihs requested a review from a team as a code owner June 5, 2026 11:18
@szihs szihs requested review from bmillsNV and removed request for a team June 5, 2026 11:18
@nv-slang-bot

nv-slang-bot Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

Gentle ping @bmillsNV — this PR (fix for #11483, CI green) has been open ~3 days with review requested but none yet. Anything blocking, or can I help move it forward? Happy to address any feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: non-breaking PRs without breaking changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant