Skip to content
Draft
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
29 changes: 20 additions & 9 deletions docs/startup-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -1073,12 +1073,12 @@ created during the run is translated within seconds and the runtime picks it up
instead of on the next run. `compile_dxil --watch` uses the same ready-marker priority, batch size
and rescan cadence. The runtime
looks for an absent manifest again 1 second after the first miss and doubles the wait with each
further miss up to 32 seconds. A translation published during the run is therefore
used on a draw or Dispatch at most 32 seconds later, and a key that never gets a translation costs one
cache lookup every 32 seconds instead of one per second (each lookup holds `draw_lock`, which every draw
and Dispatch takes). The cache persists: a later run reads every published `<key>.txt` and translates only new
requests. The watcher's first pass retries every earlier failure once, so a translator update reaches
requests that failed in an earlier run; after that, a request whose `<key>.fail` is newer than its
further miss up to 32 seconds. A draw or Dispatch can pick up a newly published translation once its retry
is due. A key that never gets a translation costs at most one cache lookup every 32 seconds once the wait
reaches its cap. Compute manifest lookups hold `draw_lock`. The cache persists across runs, so a later
run reads published `<key>.txt` files and translates only new requests. The watcher's first pass retries
every earlier failure once, so a translator update reaches requests that failed in an earlier run.
After that, a request whose `<key>.fail` is newer than its
ready marker is not retried during the run (the runtime writes each request once and never rewrites
it). The one-shot `--pending` scan retries every failure unless `--skip-failed` (`-s`) or
`X2W_SKIP_FAILED=1` is set, which skips requests whose `<key>.fail` is already up to date with their
Expand Down Expand Up @@ -1107,6 +1107,18 @@ print the same results and write the same failures as one, an unexpected transla
`startup_run_ps1` checks that `-Translate` starts the watcher on the cache and stops it together
with a child process.

### Preparing graphics translations in the stand-in

The initiating draw or pipeline creation call prepares a graphics translation synchronously with
`draw_lock` released. Preparation includes request writes, manifest and bytecode reads, eligible native
compilation, and translated root signature creation. Calls that need the same pending key and phase
wait with the lock released. Other keys and guest queue submissions can proceed. The initiating call
publishes the result under the lock. Usable published translations take precedence over native
compilation unless native-only mode is enabled. The manifest retry schedule also applies when
preparation is interrupted or the device changes, including in native-only mode. An absent manifest
can use the existing direct-draw fallback. Translated pipeline state object creation and command
recording hold `draw_lock`.

### Translating compute programs in the stand-in

With `X2W_NATIVE_SHADERS=<directory of dxcompiler.dll and dxil.dll>` (`run.ps1 -Render -NativeShaders <dir>`),
Expand Down Expand Up @@ -1134,9 +1146,8 @@ launchers' default `X2W_NATIVE_SHADERS_ONLY=1`, `load_compute_translation` retur
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 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.
shader model 6.6 and wave32. In-process compute translation is tried once per key and before a published
`<key>.txt`.

Published compute translations from `compile_dxil --requests` and `--watch` carry a `native 1` line in the
`x2w-manifest 2` manifest. The stand-in requires the current native output revision. An unmarked manifest
Expand Down
Loading
Loading