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
30 changes: 26 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -669,17 +669,39 @@ add_test(NAME startup_descriptor_heap_type COMMAND startup_descriptor_heap_type_
add_test(NAME startup_descriptor_heap_type_off_by_one_control COMMAND startup_descriptor_heap_type_check --mutate off-by-one)
add_test(NAME startup_descriptor_heap_type_signed_control COMMAND startup_descriptor_heap_type_check --mutate signed)
set_tests_properties(startup_descriptor_heap_type_off_by_one_control startup_descriptor_heap_type_signed_control PROPERTIES WILL_FAIL TRUE)
# The one-time shader-cache listing that gates the native slot-57 profile open (src/startup_stubs/cache_index.h),
# without a device. The per-call control probes the disk for every name, as before the index, and must fail on the
# probe count alone.
# The one-time shader-cache listing that gates the native slot-57 profile open and the draw and Dispatch existence
# probes (src/startup_stubs/cache_index.h), and its change feed, without a device. The per-call control probes the
# disk for every name, as before the index, and must fail on the probe count alone. The feed controls drop created
# files, drop renamed-to names, or answer translator names from the listing alone; the retry controls trust a mark
# whatever changed, or watch names but not writes. Each must fail only those parts.
add_executable(startup_cache_index_check tests/startup_cache_index_check.cpp)
target_include_directories(startup_cache_index_check PRIVATE src)
target_compile_features(startup_cache_index_check PRIVATE cxx_std_17)
add_test(NAME startup_cache_index COMMAND startup_cache_index_check)
add_test(NAME startup_cache_index_per_call_control COMMAND startup_cache_index_check --mutate per-call)
set_tests_properties(startup_cache_index_per_call_control PROPERTIES
PASS_REGULAR_EXPRESSION "FAIL: \\(a\\) 515 disk probes for 515 lookups.*startup_cache_index_check: 1 failed"
FAIL_REGULAR_EXPRESSION "FAIL: \\([b-h]\\)")
FAIL_REGULAR_EXPRESSION "FAIL: \\([b-q]\\)")
add_test(NAME startup_cache_index_no_added_control COMMAND startup_cache_index_check --mutate no-added)
set_tests_properties(startup_cache_index_no_added_control PROPERTIES
PASS_REGULAR_EXPRESSION "FAIL: \\(j\\) a file created by another process after the listing never read present.*FAIL: \\(j\\) a file this process wrote after the listing never read present.*startup_cache_index_check: 2 failed"
FAIL_REGULAR_EXPRESSION "FAIL: \\([a-ik-q]\\)|renamed into place by another process after the listing")
add_test(NAME startup_cache_index_no_rename_control COMMAND startup_cache_index_check --mutate no-rename)
set_tests_properties(startup_cache_index_no_rename_control PROPERTIES
PASS_REGULAR_EXPRESSION "FAIL: \\(j\\) a file renamed into place by another process after the listing never read present.*startup_cache_index_check: 1 failed"
FAIL_REGULAR_EXPRESSION "FAIL: \\([a-ik-q]\\)|created by another process|this process wrote")
add_test(NAME startup_cache_index_listing_only_control COMMAND startup_cache_index_check --mutate listing-only)
set_tests_properties(startup_cache_index_listing_only_control PROPERTIES
PASS_REGULAR_EXPRESSION "FAIL: \\(k\\) fresh, without a feed,.*FAIL: \\(l\\) fresh, feed started after the listing,.*FAIL: \\(m\\) fresh, after the dropped batch,.*startup_cache_index_check: 4 failed"
FAIL_REGULAR_EXPRESSION "FAIL: \\([a-j]\\)|FAIL: \\([n-q]\\)")
add_test(NAME startup_cache_index_ignore_changes_control COMMAND startup_cache_index_check --mutate ignore-changes)
set_tests_properties(startup_cache_index_ignore_changes_control PROPERTIES
PASS_REGULAR_EXPRESSION "FAIL: \\(q\\) a manifest published after the miss was never picked up.*startup_cache_index_check: 1 failed"
FAIL_REGULAR_EXPRESSION "FAIL: \\([a-p]\\)")
add_test(NAME startup_cache_index_names_only_control COMMAND startup_cache_index_check --mutate names-only)
set_tests_properties(startup_cache_index_names_only_control PROPERTIES
PASS_REGULAR_EXPRESSION "FAIL: \\(o\\) a file another process rewrote in place never read changed.*startup_cache_index_check: 1 failed"
FAIL_REGULAR_EXPRESSION "FAIL: \\([a-np-q]\\)")
# The same header without a GPU (src/startup_stubs/null_texture_view.h): fake adapters that lack
# or have each use, R8G8B8A8 with one use, only B8G8R8A8, and failed queries. WARP has both uses, so
# only this check reaches the rewrite on CI. The mutated run is the negative control.
Expand Down
2 changes: 1 addition & 1 deletion docs/startup-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -1809,7 +1809,7 @@ ctest --preset dev --no-tests=error -R '^startup_hook_(window|overlap)$' -V
| `X2W_D3D12_RENDER=1` | draws through translated pipelines from `X2W_SHADER_CACHE` and forwards [single-record indirect Dispatch](experiments.md#gpu-written-indirect-dispatch-arguments), [DrawIndexed](experiments.md#gpu-written-indirect-indexed-draw-arguments), [Draw](experiments.md#gpu-written-indirect-draw-arguments), and [DispatchMesh](experiments.md#gpu-written-indirect-mesh-dispatch-arguments) for supported desktop pipelines and tracked placed buffers |
| `X2W_DRAW_MISSING_SHADER=1` | records a [diagnostic fallback draw](experiments/missing-shader-fallback.md) for direct, non-indexed triangle lists while the requested translation manifest is absent. Requires single-sample attachments and a guest viewport and scissor. The shader pair leaves the attachments untouched. The render totals report `missing shader fallback draws`. |
| `X2W_PIPELINE_COLOUR=1` | diagnostic only, debug switch, in render mode: a `DrawInstanced`, `DrawIndexedInstanced` or `ExecuteIndirect` draw that draws nothing gets one flat marker tile in render target 0, in a colour taken from its pipeline key, and logs `x2w-draw colour #rrggbb for <key> <reason>` once per key ([details](experiments/pipeline-colour-fallback.md)). Not a fallback: the refused draw still draws nothing, and the tiles can tint later passes. Unset, nothing is drawn or logged |
| `X2W_SHADER_CACHE=<dir>` | translation cache: the runtime writes source requests `req_<key>.{a,b,root}`, when needed RTV variants `req_<key>.rtv`, and for device slot 67 compute pipelines `req_<key>.{desc,sa,sb,data,root,c67}` (see [Compute pipeline requests](#compute-pipeline-requests)). A console pipeline that an `ExecuteIndirect` draw (list slot 61) refuses writes the same request as a direct draw, once per pipeline, and draws nothing (`startup_indirect_requests_warp`). Only direct draws poll for its manifest, so such a pipeline stays in the `missing` count until a direct draw uses it; the `x2w-render totals` line counts `pipelines first looked up by ExecuteIndirect N`. This is a per-process lookup count. Check for the ready marker `req_<key>.a` to confirm a complete request is available. Run `tools/startup/gfx2hlsl.py --pending <dir>` while the process is running, or start the run with `run.ps1 -Translate` (see [Translating shaders during a run](#translating-shaders-during-a-run)). Active draws poll for an absent manifest at most once per second per pipeline and use the published translation on a subsequent draw. The translator compiles `.vs.cso` and `.ps.cso` with `fxc.exe`: `X2W_FXC`, else the Windows SDK 10.0.26100.0 copy, else the newest `Windows Kits\10\bin\<version>\x64`, else `PATH`. When none exists it writes `<key>.fail` naming `X2W_FXC` without publishing a new manifest. `X2W_FXC=` (empty) publishes the manifest alone. Rerun `--pending` with compilation enabled to fill in missing bytecode for an existing manifest. At its first native slot-57 profile lookup the runtime lists the directory's top-level file names once and logs `x2w-draw cache index: <n> names in <ms> ms` (`src/startup_stubs/cache_index.h`). A `<variant>.mesh57-state` profile is opened only when that listing has its name, so a profile written while the process runs is read by the next process. Manifests and every other cache file are still looked up on disk. |
| `X2W_SHADER_CACHE=<dir>` | translation cache: the runtime writes source requests `req_<key>.{a,b,root}`, when needed RTV variants `req_<key>.rtv`, and for device slot 67 compute pipelines `req_<key>.{desc,sa,sb,data,root,c67}` (see [Compute pipeline requests](#compute-pipeline-requests)). A console pipeline that an `ExecuteIndirect` draw (list slot 61) refuses writes the same request as a direct draw, once per pipeline, and draws nothing (`startup_indirect_requests_warp`). Only direct draws poll for its manifest, so such a pipeline stays in the `missing` count until a direct draw uses it; the `x2w-render totals` line counts `pipelines first looked up by ExecuteIndirect N`. This is a per-process lookup count. Check for the ready marker `req_<key>.a` to confirm a complete request is available. Run `tools/startup/gfx2hlsl.py --pending <dir>` while the process is running, or start the run with `run.ps1 -Translate` (see [Translating shaders during a run](#translating-shaders-during-a-run)). Active draws poll for an absent manifest at most once per second per pipeline and use the published translation on a subsequent draw. The translator compiles `.vs.cso` and `.ps.cso` with `fxc.exe`: `X2W_FXC`, else the Windows SDK 10.0.26100.0 copy, else the newest `Windows Kits\10\bin\<version>\x64`, else `PATH`. When none exists it writes `<key>.fail` naming `X2W_FXC` without publishing a new manifest. `X2W_FXC=` (empty) publishes the manifest alone. Rerun `--pending` with compilation enabled to fill in missing bytecode for an existing manifest. At its first cache lookup the runtime starts a change feed on the directory (`ReadDirectoryChangesW`, top-level file names), then lists the directory's top-level file names once on the feed's thread and logs `x2w-draw cache index: <n> names in <ms> ms; change feed <state>` (`src/startup_stubs/cache_index.h`). A `<variant>.mesh57-state` profile is opened only when that listing has its name, so a profile written while the process runs is read by the next process. The request-part and compute-marker probes (`req_` names, which only runtimes write) skip the disk for a name that is absent from the listing and from this process's own writes. The probes for `<key>.txt` (graphics and compute manifests and the slot 57 base manifest) and `<key>.cs.hlsl` skip it only while the change feed is reading and was reading before the listing began, so a file the translator writes later is found once its change record arrives. After a dropped batch or a feed error they use the disk again. A compute manifest retry (an absent, stale or unmarked `<key>.txt`) whose `<key>.*` names have no change record from the feed since its last miss repeats that miss without a file-system call; the feed records created, removed, renamed and rewritten files, and without a reading feed every retry looks on disk. Every 10 s while probes run, `x2w-draw cache probes (skipped as absent/on disk): ...` gives each probe's counts (and the compute retries repeated without I/O), the feed state, records and added names, the lookups that found a name added after the listing, and contradictions (a write that found a file the index had reported absent). |
| `X2W_NATIVE_SHADERS=<dir>` (`run.ps1 -NativeShaders <dir>`) | experimental, in render mode: translates device slot 67 compute requests in the stand-in with the C++ compiler; `<dir>` holds `dxcompiler.dll` and `dxil.dll`. See [Translating compute programs in the stand-in](#translating-compute-programs-in-the-stand-in) |
| `X2W_D3D12_LINEAR_BUFFERS=1` or `=copy` | opt-in backing for linear buffers placed at a title address (device slot 133, initial state `COMMON`): shared where the adapter, extent and memory allow it (private allocations larger than 256 MiB are skipped only with `X2W_D3D12_CAP_EXISTING_HEAP=1`), otherwise copied from title memory at each submission, otherwise the default backing is kept and the refusal recorded; `copy` never shares. Unset or `0`, slot 133 keeps its default backing. See [Linear buffer backing (device slot 133, opt-in)](#linear-buffer-backing-device-slot-133-opt-in) |
| `X2W_D3D12_CAP_EXISTING_HEAP=1` | opt-in 256 MiB (`unplaced_existing_heap_allowed`) allocation-size cap on `OpenExistingHeapFromAddress` in device slot 133 (`startup_slot133_heap_cap_*`). Unset (default), private allocations larger than 256 MiB keep the formerly aliased path: a capped copied placement is refused by `CopyBufferRegion` (list slot 15) as `title_backed_source`, losing a late guest write made after recording and before submit. Set, allocations larger than 256 MiB skip `OpenExistingHeapFromAddress` so multi-GiB startup blocks are not pinned in `WorkingSetSize` and `NonLocal` GPU memory |
Expand Down
Loading
Loading