Repository navigation
Description
On an M5 Pro (24 GB, macOS 27.2.1, CrossOver 26.3, D3DMetal 4.0 beta 3, Series X), on main at bf99e72, a pipeline warm-up (victory translate --cache --pipelines) and a world run show which shaders are still missing, and what helps. Text only, no game data.
Where draws are still dropped
After a full warm-up, world frames drop 100 to 136 draws, plus 80 to 160 indirect ones, as "without a host pipeline (0 being made)". These are pipelines that cannot be made at all, not ones still compiling. The warm-up's pack walk counts them:
| Pack pipelines skipped | bf99e72 |
with #401 and keep_lanes_to_end (below) |
|---|---|---|
| the host refuses it (mostly mesh outputs over Metal's 32 KiB) | 625 | 2 |
| compute shader does not translate | 247 | 219 |
| usable pipelines (made + already in the library) | 26,288 | 26,939 |
These are compute programs refused in one world run on bf99e72 (97 refusals, all compute), grouped by reason:
| Reason | Count |
|---|---|
| a lane mask read as data (wave64 on a 32-lane host) | 49 |
| LDS one console wave64 shares without barriers, on a host of 32-lane waves | 26 |
| a wave reduction over both 32-lane halves (wave64 on a 32-lane host) | 11 |
| a first-lane read of a value that may differ between 32-lane halves | 5 |
| a lane read that may cross 32-lane halves | 3 |
| a lane mask read as data (no halves) | 2 |
| a descriptor read only as data | 1 |
Since #309, #360, #370 and #376, almost all of the halves refusals left are in code that only part of the group runs, where the halves cannot meet at a group barrier.
Two things that helped locally (not mine, tested together)
- fix(shader,gpu): repack linked mesh outputs to remove Metal alignment holes #401 (repacking linked mesh outputs). With it, "the host refuses it" fell from 625 to 2 pack pipelines.
ir::keep_lanes_to_endfrom LakshanSivakumar/Native-Victory-macOS (commit0a8bee7, GPL-3.0). When a compute program is refused for a halves reason, it is lowered again with eachs_cbranch_execzthat goes straight to a bares_endpgmdropped. That is the usualif (id < n) { whole shader }early exit. The lanes then run on with EXEC off and reach every barrier, so a program with scalar memory writes is left as it was. Here it was ported ontoemit_prunedand keyed on the halves refusal texts, and it brought "compute shader does not translate" from 247 to 219.
With both applied, the victory-shader (375), victory-gpu (364) and victory-hle (170) library suites pass under Wine.
A probe for the rest: the halves can wait for each other in divergent code
The remaining cases need the two 32-lane host waves of one console wave to exchange values where no group barrier can go. I checked whether they can instead wait for each other on group-shared memory without a barrier (a "rendezvous"). The probe is a synthetic HLSL compute shader, numthreads(64,1,1), compiled with the DXC that D3DMetal ships and run through Host.
- One lane per half, a different one per group, publishes a value and a flag with
InterlockedExchange, with aGroupMemoryBarrier()between them. It then spins, bounded at 2^22, on the other half's flag withInterlockedOrand reads the other half's value. - In a second variant, half 1 first runs a 200,000-step loop, so half 0 has to wait for a wave that is still busy.
| Groups | Busy loop | Runs | Timeouts | Wrong values | Most spins |
|---|---|---|---|---|---|
| 64 / 4,096 / 65,536 | none | 3 each | 0 | 0 | 2 |
| 64 / 4,096 / 65,536 | 200,000 steps in half 1 | 3 each | 0 | 0 | about 102,000 |
WaveGetLaneCount() was 32 everywhere, and the host waves follow SV_GroupIndex / 32.
So on this GPU, the two halves of a group make progress while one of them spins on the other. That is the known-bad case only within one wave. An exchange in divergent code could then wait for the other half at the same point, instead of needing a barrier. The parts still to solve:
- A half that never enters the region would need to post a "left the region" mark at the region's join.
- Loops inside such regions.
- What it costs.
- Whether M1 to M4 behave the same. Only the M5 Pro has been measured.
If someone with an older Apple GPU wants to run the probe, I can post its HLSL here.
Prepared with Claude Code. Synthetic shaders only for the probe; the counts come from the warm-up and the run's log, no game files.
Activity
pragyaangaur commentedon Nov 28, 2026
Thank you for the census and the rendezvous probe. Since bf99e72 the shader side moved a lot: halves rendezvous for divergent ballots is on by default (#511), lockstep while loops (#591), register-index waterfalls (#589), the wave64 reductions (#593), first-lane reads of multiply-accumulate values (#606) and same-row permlane16 (#600) are merged, and the mesh row counting by the measured rule (#578) too. Could you rerun
victory translate --cache --pipelinesand a world run on current main and post the new drop counts for wave64 compute and mesh pipelines? That tells us what the remaining refusals are.