gpu(metal): build pipelines off the title's thread, with standins resolved at bind (XCL pso_async) #643

Open
opened 2026-11-28 21:34:27 +00:00 by AnastasisKon · 0 comments
AnastasisKon commented 2026-11-28 21:34:27 +00:00 (Migrated from github.com)
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T21:34:27Z.


What

Pipeline creation goes through the MetalIRConverter synchronously on the title's thread: 23k calls at d3d12 slot 0x1c8 before the 18 s int3 (docs/native-host.md), and MacBox measured presentation stopping ~132 s into a GTA VI loading run while native pipelines kept compiling — their title only survived compile storms once pipelines were built off the title's thread (xcl crates/xcl/src/hle/d3d12x/pso_async.rs): stand-in PSO handles handed back to the title at creation, the real build queued as a background job, and the standin resolved to the real object at bind, holding the title thread only there (title_held, which their sleep hold then excludes from title Sleep accounting — see the sleep-hold issue).

What this changes (measure first)

  1. A diagnostic measuring how long each pipeline build holds the title thread (sum, max, count, by pipeline kind), off by default.
  2. If the numbers are large: standin handles + a background compile queue; bind resolves the standin and holds; Sleep accounting excludes held time (depends on the sleep-hold issue).

How it was tested

  • the diagnostic's numbers from a game run once the data finishes downloading;
  • existing pipeline tests stay green; a standin-resolution unit test.

Sources: MacBox crates/xcl/src/hle/d3d12x/pso_async.rs (title_held, submit, resolve_for_bind), README "Tests and current status" loading runs.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:6671402964 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/643). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T21:34:27Z. --- ## What Pipeline creation goes through the MetalIRConverter synchronously on the title's thread: 23k calls at d3d12 slot 0x1c8 before the 18 s int3 (docs/native-host.md), and MacBox measured presentation stopping ~132 s into a GTA VI loading run while native pipelines kept compiling — their title only survived compile storms once pipelines were built off the title's thread (xcl crates/xcl/src/hle/d3d12x/pso_async.rs): stand-in PSO handles handed back to the title at creation, the real build queued as a background job, and the standin resolved to the real object at bind, holding the title thread only there (`title_held`, which their sleep hold then excludes from title Sleep accounting — see the sleep-hold issue). ## What this changes (measure first) 1. A diagnostic measuring how long each pipeline build holds the title thread (sum, max, count, by pipeline kind), off by default. 2. If the numbers are large: standin handles + a background compile queue; bind resolves the standin and holds; `Sleep` accounting excludes held time (depends on the sleep-hold issue). ## How it was tested - the diagnostic's numbers from a game run once the data finishes downloading; - existing pipeline tests stay green; a standin-resolution unit test. Sources: MacBox crates/xcl/src/hle/d3d12x/pso_async.rs (title_held, submit, resolve_for_bind), README "Tests and current status" loading runs.
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
LakshanSivakumar/Native-Victory-macOS#643
No description provided.