Skip to content

cpp-migration: bind table buffers, 2D texture SRVs and 3D/1D texture UAVs for natively translated compute #2974

Backlog

Description

@Leyukaka

Target branch cpp-migration. Part of #2935 (follow-up to #2934/#2958). I am taking this; please say if you already have it locally and I will drop it.

Observation. I ran a local start-up capture on cpp-migration b260984f with run.ps1 -NativeShaders and kept the Python translator as the fallback. The title then does not get past its first screen. On main plus #2902, the same inputs get past it. One per-frame compute pipeline accounts for the difference: it was dispatched 17,408 times in that run and never translated. Its views are two table buffers, a 2D texture SRV and a 3D float texture UAV:

srv 0 buf table 1 96
srv 1 buf table 1 64
srv 2 tex2d table 1 0
uav 0 tex3d float table 1 32 channels 4
  • The C++ compiler compiles it (compile_dxil produces the DXIL), but three things stop it from reaching a Dispatch. I checked them at 2b678fd3:
    1. translate_compute_natively binds only raw_vector_srv and raw_buffer_uav. It refuses this program with "view kind 0 is not bound for a natively translated program".
    2. format_compute_runtime_manifest accepts a texture_uav only with image dimension 1 (2D) or 5 (2D array), so compile_dxil writes no manifest for it.
    3. The stand-in's manifest reader has no tex3d/tex1d UAV line, and Dispatch refuses any output view that is not TEXTURE2D/TEXTURE2DARRAY.
  • On main, the runtime half of startup: lower compute image_store to 1D and 3D texture UAVs (Part of #2022) #2902 adds 3D and 1D UAV binding: the manifest line, the view dimension, and mip and W range checks (also in slot 19, d3d12_xs_device.cpp). cpp-migration does not have it.

Plan, best as two pull requests:

  1. Port the runtime half of startup: lower compute image_store to 1D and 3D texture UAVs (Part of #2022) #2902 to cpp-migration, with its startup_stream_consumer.cpp modes (volume, line, bad W, bad mip). The runtime hunks are taken unchanged from startup: lower compute image_store to 1D and 3D texture UAVs (Part of #2022) #2902, which is open on main, so a later merge of main is a no-op there. If you would rather wait for startup: lower compute image_store to 1D and 3D texture UAVs (Part of #2022) #2902 to merge and reach cpp-migration, say so and I will do only steps 2 and 3.
  2. For the offline route, format_compute_runtime_manifest writes the 3D and 1D texture_uav lines that the reader then accepts.
  3. Extend the runtime: translate slot 67 compute requests in the stand-in #2958 route in translate_compute_natively to fill the same ComputeTranslation slots the manifest reader fills, without using NativeRecording/NativeDispatchStates:
    • buffer_srv maps to the same buf table slot that format_compute_runtime_manifest already writes for it;
    • also texture_srv (2D) and texture_uav (2D, 2D array, 3D, 1D);
    • the bindings' kind and image dimension decide the slot, with the same register-order and array-count checks;
    • samplers and the other kinds stay refused.

Tests:

  • The 3D and 1D cases are driven by the native route or by a hand-written manifest, since the Python half of startup: lower compute image_store to 1D and 3D texture UAVs (Part of #2022) #2902 is not on this branch.
  • Extend startup_compute_dispatch_native_check.py with a source-built program that reads a table buffer and a 2D texture and stores to a 3D UAV, compared with a CPU reference.
  • A manifest round trip for the 3D UAV line.
  • Controls: a 3D W range outside the mip, and a view kind that stays unbound.

Measurement: the same start-up run before and after, with dispatch and translation counts for that pipeline and whether the title gets past its first screen.

AI-assisted.

Activity

  1. Leyukaka commented on Nov 27, 2026

    @Leyukaka
    CollaboratorAuthor

    Correction to the observation above. (All the runs below also carried #2862, merged locally.)

    I wrote that on main plus #2902 "the same inputs" get past the first screen. They were not the same inputs.

    • That run received 21 controller inputs in its first 95 seconds, before the first scripted input; two of them are buttons the script never sends.
    • Two later runs used only the scripted inputs. One was on cpp-migration with the per-frame pipeline compiled by compile_dxil. The other was on cpp-migration plus startup: lower compute image_store to 1D and 3D texture UAVs (Part of #2022) #2902 with the Python translator only and no C++ translation. Both stay on the first screen in the same way: no input before the script starts, and the same three compute pipelines dispatched for the whole run (the earlier run dispatched 952).
    • So the scripted inputs alone do not get past that screen, on either translator. The first-screen result says nothing about this pipeline, and I have no evidence that the missing 3D UAV binding is what kept the title there.

    What still holds:

    Parts 1 and 2 are unchanged in scope. I have updated the matching sentence in #2975.

    AI-assisted.

  2. sydney-0o commented on Nov 27, 2026

    @sydney-0o
    Contributor

    PR #3049 combines the remaining native compute binding work from #2975 and #2993 on main, which already contains #2902. The native offline manifest and first-Dispatch fixtures both passed on a GTX 1080 Ti (driver 32.0.15.8278, Windows build 19045, app-local Agility SDK 1.620.2). The separate startup before/after measurement remains open.

  3. added
    priority: P0
    on Nov 30, 2026
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

    priority: P0

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions