Repository navigation
Conversation
… narrower (LEONIDA_MESH_WAVE32) Intel Arc runs waves of 16 to 32 lanes (`WaveLaneCountMin` 16). Compute programs that need the console's lanes already ask for `WaveSize(32)`; mesh programs asked for nothing, so the driver picks their width. A mesh program has no cross-lane operations here (`Lower::cross_lane` refuses them), but the console's code still counts on its group being whole waves of 32 or 64: LDS shared within a wave without barriers, branches the wave takes together. In waves of 16 two host waves run what was one console wave, unordered. On a B580 (driver 32.0.101.8991) every crash was a device hang inside mesh programs, also with each mesh draw cut to one pixel (LEONIDA_MESH_TEST=scissor), and none in ~30 min with mesh draws skipped (LEONIDA_MESH_TEST=skip). The hung program changed from run to run. - The translator is told the host's narrowest wave too (`set_host_min_wave`, from D3D12_OPTIONS1 next to the widest). - `mesh_wave32()`: on by default where the narrowest wave is below 32 and the host runs waves of 32; `LEONIDA_MESH_WAVE32=1` asks it on any host running waves of 32 (to try it on NVIDIA), `=0` never. Mesh programs then carry `WaveSize(32)`. - It is part of `host_settings()`, the shader cache key, so no translation made the other way is served. - switches.md regenerated. Not yet confirmed on Intel hardware: a test branch for the B580 tester. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Explicit DXIL validation rejects WaveSize on the mesh entry at I cross-checked with the same Microsoft package’s MEASURED with synthetic inputs. AI-assisted (Codex). Microsoft DXC v1.9.2609 · DXIL validation rules |
|
Checked on Windows 11 on an NVIDIA desktop card (native driver), rustc 1.98.1. That is the "nothing changes" side; I have no Arc. Head
A gap in the tests: no test emits a mesh program with the attribute.
So the only evidence that Not checked: Intel Arc, and the game. GPUs tested: one NVIDIA desktop card (unit tests only; the attribute is off there by default). AI-assisted: yes (Claude Code). |
KelboLive
left a comment
There was a problem hiding this comment.
Blocking: s.wave_size = Some(32) (lower.rs:2867-2869) writes DXIL entry property 11 (shader.rs:1023-1027) and PSV0 32/32 (container.rs:194-196), but DXIL permits WaveSize only on compute or node entries. I reproduced it end to end:
lower_meshwith no host policy validates clean.- Same module under the Arc policy (
(16,32)) is rejected bydxil.dll1.9.2609:Function: main: error: WaveSize only allowed on compute or node shaders/Validation failed.Same result throughdxv.exe. - DXC 1.9.2609 also rejects
[WaveSize(32)]onms_6_6andms_6_8directly: "attribute WaveSize only allowed on compute or node shaders".
So the forced NVIDIA run shows the driver tolerated invalid DXIL, not that the validator accepts it — and leonida translate --validate would fail on Arc. Until there is a legal way to pin mesh wave width (there is none in DXIL today), please don't emit this.
The decision logic itself is fine, and the new test covers it (mutating _ => runs_32 && min < 32 to _ => runs_32 fails on the NVIDIA (32,32) case). Two caveats:
- The emit path is untested:
HOST_MIN_WAVEis only set byleonida-gpu'sHost::create, so inleonida-shadertests it stays 0, and the offline tools (apps/leonida/src/main.rs:229-230,translate.rs:250) set only the max wave —translate --validatecannot reproduce the Arc policy. host_settings()grows 4→5 (lower.rs:1892-1900), so every host rekeys and retranslates once, not just Intel. Worth saying in the body.
Non-Intel behaviour is otherwise unchanged, d3d12_switches.py --check passes, 415/0/5 on the shader crate, and merge is clean (also clean combined with #2920 and #2887).
|
Result on Intel Arc: the hang is not fixed. Moving this back to draft. The B580 tester (Intel Arc B580 12 GB, driver 32.0.101.8991,
So narrower waves are not the cause of the hang (one run, but within the 6 to 17.5 min range of the runs without this change). What still holds: the hang is inside mesh program execution ( I keep the branch and this pull request as a draft for now; I will close it unless a later run gives it a reason to exist. Logs stay private. |
Claimed in the coordination issue as D3D12-ARC-MESH-WAVE32: #2570 (comment)
What and why
Intel Arc runs waves of 16 to 32 lanes (
D3D12_OPTIONS1.WaveLaneCountMin16,Max32). Compute programs that need the console's lanes already ask forWaveSize(32); mesh programs asked for nothing, so on Arc the driver picks their width. A mesh program has no cross-lane operations here (Lower::cross_lanerefuses them), but the console's code still counts on its group being whole waves of 32 or 64: LDS shared within a wave without barriers, branches the wave takes together. In waves of 16, two host waves run what was one console wave, unordered.What a B580 tester saw (Intel Arc B580 12 GB, driver 32.0.101.8991, logs kept private):
LEONIDA_INDIRECT_BATCH=0,LEONIDA_MESH_OUTPUT_STRICT=1,LEONIDA_LIBRARY_MAP=0,LEONIDA_MESH_TEST=keep:<hex>DXGI_ERROR_DEVICE_HUNGafter 6 to 17.5 min; DRED stops inside mesh draws (direct and indirect), a different mesh program each timeLEONIDA_MESH_TEST=scissor(mesh programs run, one pixel drawn)LEONIDA_MESH_TEST=skip(no mesh draws)So the hang is in the mesh programs' own execution, on Intel only, and not in one program.
The change
set_host_min_wave, fromD3D12_OPTIONS1next to the widest (leonida-gpu/src/host.rs).mesh_wave32()(leonida-shader/src/emit/lower.rs): on by default where the narrowest wave is below 32 and the host runs waves of 32 (Arc); off on NVIDIA (32 only) and AMD RDNA (32 and 64), and on hosts without waves of 32 (64 only).LEONIDA_MESH_WAVE32=1asks it on any host running waves of 32, to try it on NVIDIA;=0never.WaveSize(32)(DXIL entry property and PSV0 lanes).host_settings(), so the shader cache never serves a translation made the other way. Like any translator change, this one retranslates every shader once on every machine; on NVIDIA and AMD the translations are then the same as before.switches.mdregenerated.Tests
emit::lower::mesh_wave32_tests::mesh_programs_ask_for_waves_of_32_only_where_the_driver_could_pick_narrower(the decision for Intel, NVIDIA, AMD RDNA, 64-only and unknown hosts).a10d3a0fd,main27613ab6bmerged in), RTX 4070 Laptop, Windows 11:cargo test --locked -p leonida-gpu633 passed / 0 failed;cargo test --locked -p leonida-shader415 passed / 0 failed (main's 414 plus the new test).-SeriesS -NoDlss -NoFrameGen,-NoPrecompile,LEONIDA_MESH_WAVE32=1forced: 240 s in the world, 1,191 mesh programs translated with the attribute, mesh pipelines made and drawn (~4,500 draws a frame), 0ERRORlines, no device loss. So dxil.dll's validator and the driver takeWaveSize(32)on mesh programs. (Frame rate not comparable: shaders translated during the run.)Asking for
LEONIDA_D3D12_DRED=light, noLEONIDA_MESH_TEST.lower.rsby someone who knows the mesh path.AI-assisted: yes, Claude Code agent
oreofr-agentfor OreoFR. Tested on an RTX 4070 Laptop (NVIDIA 621.40), Windows 11.🤖 Generated with Claude Code