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

Open
opened 2026-11-27 00:51:14 +00:00 by Leyukaka · 2 comments
Leyukaka commented 2026-11-27 00:51:14 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-27T00:51:14Z.


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 #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 #2902 to cpp-migration, with its startup_stream_consumer.cpp modes (volume, line, bad W, bad mip). The runtime hunks are taken unchanged from #2902, which is open on main, so a later merge of main is a no-op there. If you would rather wait for #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 #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 #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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6637668487 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2974). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-27T00:51:14Z. --- 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 #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 #2902 to `cpp-migration`**, with its `startup_stream_consumer.cpp` modes (volume, line, bad W, bad mip). The runtime hunks are taken unchanged from #2902, which is open on `main`, so a later merge of `main` is a no-op there. If you would rather wait for #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 #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 #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.
Leyukaka commented 2026-11-27 02:06:09 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-27T02:06:09Z.


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 #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:

  • The pipeline is dispatched every frame and was never translated on cpp-migration b260984f without these bindings.
  • With #2975 and compile_dxil, it is translated and dispatched. In the later run it was dispatched about 17,400 times, all translated.

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

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7207832599 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2974#issuecomment-7207832599). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-27T02:06:09Z. --- 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 #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: - The pipeline is dispatched every frame and was never translated on `cpp-migration` `b260984f` without these bindings. - With #2975 and `compile_dxil`, it is translated and dispatched. In the later run it was dispatched about 17,400 times, all translated. Parts 1 and 2 are unchanged in scope. I have updated the matching sentence in #2975. AI-assisted.
sydney-0o commented 2026-11-27 11:29:35 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by sydney-0o on 2026-11-27T11:29:35Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7217137103 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2974#issuecomment-7217137103). Originally posted by [sydney-0o](https://github.com/sydney-0o) on 2026-11-27T11:29:35Z. --- 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.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows#2974
No description provided.