Skip to content

startup: the async compute translation sets a sampler root signature before binding the sampler heap #3629

Done

Description

@KelboLive

startup: the async compute translation sets a sampler root signature before binding the sampler heap

Summary

startup_compute_dispatch_sampler_heap_hardware passes at 077bff3ac and fails from 35a3f6d6c onward —
the merge tip of #3451, translating native compute programs on a worker thread. It is still failing at
e61a16531.

077bff3ac  (before #3451)  startup_compute_dispatch_sampler_heap_hardware  Passed   9.57 sec
35a3f6d6c  (#3451 merge)   startup_compute_dispatch_sampler_heap_hardware  Failed   7.42 sec
cf43986db                  startup_compute_dispatch_sampler_heap_hardware  Failed   6.82 sec
e61a16531                  startup_compute_dispatch_sampler_heap_hardware  Failed   6.82 sec

Failure

AssertionError: x2w-d3d12-debug [translated dispatch 14] sev=1 id=1419
ID3D12CommandList::SetComputeRootSignature: SetDescriptorHeaps must be called to bind a sampler
descriptor before setting a root signature with D3D12_ROOT_SIGNATURE_FLAG_SAMPLER_HEAP_DIRECTLY_INDEXED

The fixture sets X2W_D3D12_DEBUG=1 and X2W_D3D12_LIST_NOOP=1, so the debug layer's messages are part of
what it asserts. Deterministic: it fails the same way in isolation, not only under a sweep.

Why no CI job sees it

  • The warp variant of the same fixture reports a capability skip (77), so the in-box WARP job cannot
    reach it.
  • The hardware variant needs a physical device; neither Windows job runs _hardware.
  • It is not in the pr preset either.

So #3451 merged green with this failing on real hardware.

Likely path

src/startup_stubs/d3d12_compute_dispatch.inl binds heaps before the root signature, but only when it has
to:

// A directly indexed root needs its sampler heap set before the root signature; another program keeps
// whatever sampler heap is bound.
ID3D12DescriptorHeap* const samplers = tr->sampler_heap_bytes ? pass.sampler_heap.Get() : nullptr;
if (!pass.heap_set || (samplers && pass.bound_sampler_heap != samplers)) {
    x2w_startup::bind_translated_heaps(list, draw_heap, samplers);
    pass.heap_set = true;
    pass.bound_sampler_heap = samplers;
}
list->SetPipelineState(tr->pipeline.Get());
list->SetComputeRootSignature(tr->root.Get());

Two ways that reaches 1419: tr->sampler_heap_bytes is non-zero while pass.sampler_heap is null, so
samplers is null and the heap set is bound without a sampler heap; or the pass state (heap_set,
bound_sampler_heap) is now shared by a dispatch that ran earlier on the worker-thread route. #3451 changed
when the published program and its pass state become visible, which is consistent with the bisect but I have
not isolated which of the two it is.

Either way the shim sets a root signature that declares a directly indexed sampler heap without that heap
bound. Refusing the dispatch when the program needs a sampler heap and none is bound would be consistent
with the rest of the path; binding one is the alternative.

Reproduction

In-box dev preset on a physical device (RTX 4070 Ti SUPER, driver 32.0.16.2101, Windows 10.0.26200):

ctest --preset dev --no-tests=error -R '^startup_compute_dispatch_sampler_heap_hardware$' -V

Context

This is the only functional failure in a 988-test _hardware sweep of cf43986 (979 passed, 4 skipped).
The other four are #3622's fixtures (three) and one load-related timeout that passes in 16 s in isolation.
The sweep is what found this; every other channel is blind to it.

Refs #3451, #3540.

Activity

  1. KelboLive commented on Nov 30, 2026

    @KelboLive
    ContributorAuthor

    Fixed at bee9c64d9 by #3626 (5be36341a, "keep the sampler heap span when installing a compute translation"), which is the area this pointed at.

    e61a16531  startup_compute_dispatch_sampler_heap_hardware  Failed   6.82 sec
    bee9c64d9  startup_compute_dispatch_sampler_heap_hardware  Passed   9.53 sec
    

    The three fixtures from #3622 also pass on hardware at this head (startup_gfx2hlsl_cvt_off_f32_i4_hardware 1.98 s, startup_image_sample_b_flow_hardware 13.57 s, startup_image_get_lod_flow_hardware 6.25 s).

    No debug-layer 1419 message remains. Closing as fixed; the bisect in the report (pass at 077bff3, fail at 35a3f6d) is no longer needed for anything, so I am not adding it to #3451 separately.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions