Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4967,6 +4967,12 @@ if(EXISTS "${INTAKE_PYTHON}")
add_test(NAME startup_compute_dispatch_${adapter} COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_compute_dispatch_check.py" "$<TARGET_FILE:startup_stream_consumer>"
"${DXC_EXECUTABLE}" ${adapter})
if(TARGET compile_dxil AND EXISTS "${DXC_BIN_DIR}/dxcompiler.dll" AND EXISTS "${DXC_BIN_DIR}/dxil.dll")
add_test(NAME startup_compute_dispatch_texture_native_${adapter} COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_compute_dispatch_texture_check.py" "$<TARGET_FILE:startup_stream_consumer>"
"${DXC_EXECUTABLE}" ${adapter} "$<TARGET_FILE:compile_dxil>" "${DXC_BIN_DIR}")
set_tests_properties(startup_compute_dispatch_texture_native_${adapter} PROPERTIES TIMEOUT 120 SKIP_RETURN_CODE 77)
endif()
add_test(NAME startup_compute_dispatch_texture_${adapter} COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_compute_dispatch_texture_check.py" "$<TARGET_FILE:startup_stream_consumer>"
"${DXC_EXECUTABLE}" ${adapter})
Expand Down
21 changes: 11 additions & 10 deletions docs/experiments/startup-compute-native-dispatch.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ cache and no offline translator, and compares all 320 output words with a CPU re
3. The entry values and views fill the same `ComputeTranslation` a published `<key>.txt` fills. The existing
dispatch path then resolves the table descriptors, sets the resource states and records the Dispatch.

Accepted: root constants, a raw table buffer loaded per lane and a raw table buffer stored to. These are the
bindings the fixture runs; a later step samples a 2D texture through constant samplers
([note](startup-compute-native-samplers.md)). Refused: every other view kind (a scalar buffer load included),
a sampler read from memory, more than
32 entry values or inputs or 8 outputs, an adapter without 32-lane waves, and whatever the frontend refuses. The
stand-in logs the first 16 refusals of a process with their reason. A refused key is left to a published
translation. The in-process translation is tried once per key and before a published `<key>.txt`.
Accepted bindings include root constants, scalar and per-lane raw table buffer inputs, raw buffer outputs,
supported half-buffer outputs, 2D texture inputs, four-channel float and packed half4 texture outputs
(1D, 2D, 2D-array and 3D), and exact-width float texture outputs (2D, 2D-array and 3D).
The native route samples 2D textures through constant samplers, including comparison samplers
([note](startup-compute-native-samplers.md)). The stand-in refuses samplers read from memory, indexed views,
other unsupported view shapes, more than 32 entry values or inputs or 8 outputs, and adapters that lack wave32
or report a shader model below 6.6. It logs the first 16 refusals of a process
with their reason. A refused key is left to a published translation. The in-process translation is tried
once per key and before a published `<key>.txt`.

`NativeRecording` and `NativeDispatchStates` are not used. The dispatch path already allocates the descriptors
and tracks the states of these buffers.
Expand All @@ -46,7 +48,7 @@ decoder, and the consumer's `dispatch-records32` mode writes the table with the
5. Order: the first program runs again with its published translation in the cache. The log still names the
native translation, and all 320 words match.

Without 32-lane waves, step 1 instead checks that the native translation is refused by that name with every word
Without wave32 or shader model 6.6, step 1 instead checks the named capability refusal with every word
untouched. Step 2 is left out, steps 3 and 4 run, step 5 runs the first program through its published
translation, and the check exits 77.

Expand Down Expand Up @@ -82,8 +84,7 @@ ctest --preset dev --no-tests=error -V -R '^(startup_compute_dispatch(_.*)?|star
## Limits

- Compute only. Graphics pipelines are not translated in-process.
- A scalar buffer load, a sampler read from memory and the typed, half and indexed views are refused. This is the
in-process route. The published-manifest route (`<key>.txt` from `compile_dxil --requests`) binds a
- The published-manifest route (`<key>.txt` from `compile_dxil --requests`) also binds a
title's 1D, 2D, 2D-array and 3D texture SRV (`srv N tex1d|tex2d|tex2da|tex3d table R B`). For 1D, 2D-array
and 3D the title's view must be described, have the manifest's dimension and fit its texture, otherwise the
Dispatch is refused (on a dimension mismatch the draw path binds a null view instead). "Fits" is
Expand Down
51 changes: 39 additions & 12 deletions docs/startup-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -1008,19 +1008,19 @@ pipelines, and the cache can start empty: the request files the stand-in wrote a
against their key, translated and compiled to DXIL in the process. The compiler's own cache goes to
`<shader cache>\native`. Nothing is published as `<key>.txt`.

The existing dispatch path records the result, and a program is accepted only with the bindings a
fixture has run through it: root constants, raw table buffers loaded per lane (`buffer_load_dword`)
and raw table buffers stored to, with their descriptors in 32-byte table records. A 2D texture can be
sampled through samplers whose four words are constants: they become static samplers with the
descriptor's MIN_LOD and MAX_LOD, or comparison samplers
([fixture and results](experiments/startup-compute-native-samplers.md)). Anything else (a
scalar buffer load, a sampler read from memory, a typed or indexed view, an instruction the compiler does
not lower) is refused. Programs published as `<key>.txt` also bind 1D, 2D, 2D-array and 3D texture SRVs
(`srv N tex1d|tex2d|tex2da|tex3d table R B`) from the title's described view of that dimension, or are
refused by name; cube texture SRVs are not published. The first 16 refusals of a process are logged as
The dispatch path binds root constants and views in 32-byte table records. Buffer views include
scalar SRVs, per-lane raw SRVs, raw UAVs and supported half-buffer UAVs. Texture views include 2D
SRVs, four-channel float and packed half4 UAVs (1D, 2D, 2D-array and 3D), and exact-width float UAVs
(2D, 2D-array and 3D). The in-process path binds samplers whose four words are constants as static
samplers with the descriptor's MIN_LOD and MAX_LOD, or as comparison samplers
([fixture and results](experiments/startup-compute-native-samplers.md)). It refuses samplers read from
memory, indexed views, and unsupported view shapes or instructions. Programs published as `<key>.txt` also bind root buffer SRVs and 1D, 2D,
2D-array and 3D texture SRVs (`srv N tex1d|tex2d|tex2da|tex3d table R B`) from the title's described view
of that dimension, or are refused by name. Cube texture SRVs are not published. The first 16
refusals of a process are logged as
`compute pipeline <key> not translated natively: <reason>`. A refused key is left to the
published translations, so `-Translate` can run beside it for those pipelines. A direct module declares
wave size 32, so an adapter without 32-lane waves refuses every program by that name. The in-process
published translations, so `-Translate` can run beside it for those pipelines. A direct module requires
shader model 6.6 and wave32. The in-process
translation is tried once per key and before a published `<key>.txt`. It covers compute only; graphics
pipelines still need a published translation.

Expand All @@ -1034,6 +1034,15 @@ pick up a rebuilt output (by the code path; no test covers the reload). Compute
Check with `ctest --preset dev -R '^startup_compute_dispatch_native_(warp|hardware)$' -V`
([`tests/startup_compute_dispatch_native_check.py`](../tests/startup_compute_dispatch_native_check.py);
[route, controls and results](experiments/startup-compute-native-dispatch.md)).
The #2958/#2993 fixture reads back a 3D float store fed by a scalar buffer SRV and a 2D texture SRV.
The consumer creates the views with the adapter's descriptor increment and copies their tokens
into a packed guest table when the increment exceeds 32 bytes. A zero-size W range must translate
natively, be refused at Dispatch, and leave all 6,144 volume words untouched.
Targeted in-process readbacks also check a mip-one 1D float store, a 2D-array float store into
relative slice 1 (physical slice 2), and a packed D16 store into an RGBA16_FLOAT texture with
round-to-nearest-even input conversion. Each case checks every output value, including sentinels
outside the store region. On adapters without wave32 or shader model 6.6 the cases check the named refusal
and untouched output before the test returns 77.

### Compute pipeline requests

Expand Down Expand Up @@ -4086,3 +4095,21 @@ before any desktop copy, leaving a sentinel-filled readback buffer unchanged. On
list refuses boxes with an unaligned right or bottom edge, copies the aligned 4x4 block, and reads back
all eight block bytes with the next byte unchanged. Reproduce the portable and wrapped-list checks with
`ctest --preset dev --no-tests=error -R '^startup_list_copy_texture' -V`.

### Offline compute manifests for 3D and 1D UAVs

For offline compute requests, the C++ formatter emits `uav N tex3d float table P OFF channels 4` and
`uav N tex1d float table P OFF channels 4`. The stand-in validates UAV view
dimensions and mip levels, including the W-slice range within the selected 3D mip.

The native offline fixture compiles 1D, 3D and 3D NSA programs, checks the published DXIL and
manifest, and compares every mip-one word after Dispatch. It also checks that mismatched views,
an invalid 3D W range and an invalid 1D mip leave the output unchanged. An adapter without
wave32 or shader model 6.6 can verify the native manifests before returning a capability skip for Dispatch.
After a published PSO creation failure, the runtime keeps PSO creation as the reason and appends
the adapter observation when available: `(adapter has no 32-lane waves)`, `(adapter wave capability query failed)`, or
`(adapter shader model below 6.6)`. A published manifest carries no wave size. The native fixture uses the
reported wave32 and shader model limits for its capability skips. The separate texture dispatch
fixture exercises the existing portable Python-published path.

`ctest --preset dev --no-tests=error -R '^startup_compute_dispatch_texture_(native_)?(warp|hardware)$' -V`
13 changes: 10 additions & 3 deletions src/direct_compute_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -996,9 +996,16 @@ std::optional<std::string> format_compute_runtime_manifest(const NativeComputeSh
uav_lines << "uav " << b.shader_register << ' ' << dimension << " float table " << b.root_parameter
<< ' ' << b.byte_offset << " channels " << channels << '\n';
} else if ((b.kind == ComputeViewKind::texture_uav || b.kind == ComputeViewKind::half4_texture_uav) &&
(b.image_dimension == 1 || b.image_dimension == 5 ||
(b.kind == ComputeViewKind::texture_uav && b.image_dimension == 2)) && b.array_count == 1) {
uav_lines << "uav " << b.shader_register << (b.image_dimension == 5 ? " tex2da" : b.image_dimension == 2 ? " tex3d" : " tex2d")
b.array_count == 1) {
const char *tex;
switch (b.image_dimension) {
case 0: tex = "tex1d"; break;
case 1: tex = "tex2d"; break;
case 2: tex = "tex3d"; break;
case 5: tex = "tex2da"; break;
default: return refuse(view_shape("UAV", b));
}
uav_lines << "uav " << b.shader_register << ' ' << tex
<< " float table " << b.root_parameter << ' ' << b.byte_offset << " channels 4\n";
} else {
return refuse(view_shape("UAV", b));
Expand Down
Loading
Loading