Skip to content

native compute: accept comparison static samplers (smpc) on the in-process route #3075

Done

Description

@Not-Saii

Part of #2935 (its "Samplers" item, which is not filed yet).

Problem. On main at e1ea515d, the in-process native compute route (X2W_NATIVE_SHADERS, src/startup_stubs/d3d12_compute_dispatch.inl) refuses any manifest line that starts with smpc and returns a comparison sampler (lines 174-175). The pieces on both sides already exist:

  • The native translator accepts constant comparison samplers in compute (sampler_index, src/gfx1013_compute_native.cpp), for example image_gather4_c_lz since shader: lower image_gather4_c_lz in the direct C++ image path #2971, and src/direct_compute_cache.cpp writes them as smpc lines.
  • TranslatedSamplers::read_manifest_line and decode_statics (src/startup_stubs/translated_sampler_bindings.h) already parse smpc and decode it to a comparison static sampler for the draw path.

So a compute request that the translator compiles is still sent back to the gfx2hlsl.py fallback at its first Dispatch because of its sampler line.

Plan.

  1. Accept smpc <i> <w0> <w1> <w2> <w3> in the route under the same index and whole-line checks as smp and smpl, through read_manifest_line.
  2. Leave smpheap refused under its current message. The sampler-heap path is a separate item.

Test (source-built only). A compute fixture that compiles a comparison gather or sample with a constant comparison sampler and runs it through the in-process route. The readback is compared against a CPU model of the compare, on _hardware. The route refuses WARP today (#2958), so there is no _warp run beyond the host-side manifest check. Negative control: the same fixture with the route change reverted is refused with a comparison sampler.

I'm taking this one. Environment: Windows 11 build 26300, NVIDIA GeForce RTX 4090 (driver 32.0.16.1088), Windows SDK 10.0.26100, plus WARP. The PR will target main.

AI-assisted.

Activity

  1. Not-Saii commented on Nov 27, 2026

    @Not-Saii
    ContributorAuthor

    Correction to the description above. The refusal is not on the in-process route.

    • a comparison sampler (src/startup_stubs/d3d12_compute_dispatch.inl, lines 174-175 at e1ea515d) is in load_compute_translation, the reader of a published <key>.txt. The in-process route (X2W_NATIVE_SHADERS, translate_compute_natively) reads no manifest lines. It refuses every sampler, and every view that is not a raw buffer, with its own messages.
    • Only tools/startup/gfx2hlsl.py writes smpc for a compute program today. format_compute_runtime_manifest (src/direct_compute_cache.cpp) returns no manifest for a comparison sampler; the smpc writer in that file is the graphics one. So the request does not fall back to gfx2hlsl.py because of this line. The translation gfx2hlsl.py publishes is the one the runtime refuses, and a compute request with a comparison sampler cannot be dispatched at all.
    • The published route runs on WARP, so the fixture has a _warp run as well as a _hardware one.

    The plan is otherwise the same: accept smpc in that reader under the checks of smp and smpl, and leave smpheap refused. The fixture goes into tests/startup_compute_dispatch_texture_check.py.

    Not part of this issue: static samplers on the in-process route (after #3049) and smpc from format_compute_runtime_manifest.

    AI-assisted.

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