Skip to content

Recompiler: two-pass mesh groups run in whole console waves - #3350

Open
KDenKC wants to merge 1 commit into
xcl-dev:mainfrom
KDenKC:fix/two-pass-mesh-whole-waves
Open

KDenKC wants to merge 1 commit into
xcl-dev:mainfrom
KDenKC:fix/two-pass-mesh-whole-waves

Conversation

@KDenKC

@KDenKC KDenKC commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

The two-pass mesh path launched only the declared thread count. A wave64 mesh program declaring 32 threads therefore had no lanes 32–63, even when its output extents required them; exports from those lanes were lost.

Both the direct-DXIL and HLSL paths now launch whole console waves covering max(threads, max_vertices, max_primitives). The entry EXEC remains limited to the declared threads. The v5 group-index step uses that rounded launch width for every mesh program, including programs that do not widen EXEC (32 threads/32 outputs on wave64 now use a step of 64).

Related: #3011 (C54, lost triangles), #3484 (main's failing stand-in test). This touches the HLSL mesh entry also changed by #3327; the integration branch keeps the two-pass entry's whole-wave launch and the native branch's separate entry.

What is in it

  • One commit: gpu/recomp/mod.rs defines the whole-wave launch width and group stride; gpu/dxil/kernel.rs and gpu/recomp/emit.rs use them in direct-DXIL and HLSL translations.
  • Entry EXEC keeps declared threads active; extra lanes begin inactive and can be enabled only if the shader widens EXEC.
  • gpu/recomp/tests.rs: CPU tests cover output extents and wave rounding. gpu_mesh_mode_two_passes draws two groups and checks the second group's v5 step, records, and pixels through both HLSL and direct DXIL.
  • gpu/dxil/robustness_tests.rs: the existing multi-wave barrier survey now uses the launched width.
  • Compute entry-mask generation is unchanged; the mesh entry uses its own EXEC helper.

Tested

  • RTX 3090 VM, driver 621.24, Rust 1.99.1, XCL_NETWORK=0.
  • cargo test -p xcl --lib -- mesh_group_stride --nocapture --test-threads=1 on final head 572f7eab03e0558a64820d1b5621602825065949: 2 passed, 0 failed, 0 ignored.
  • cargo test -p xcl --lib -- gpu_mesh_mode_two_passes --nocapture --test-threads=1 on final head: 1 passed, 0 failed, 0 ignored.
  • 5090 VM: cargo build --workspace and cargo test -p xcl --lib --no-run passed. Both focused filters passed on the default path and with XCL_DIRECT_DXIL=1 (stride 2/2; two-pass 1/1).
  • Workspace suite on final head with XCL_NETWORK=0: 2,880 passed, 6 failed, 51 ignored; 0 binaries without a result. The six failures were gpu_direct_image_get_resinfo_d16, placed_title_textures_share_vram_and_preserve_pixels, the three stream_recheck_* tests, and test_title_runs_and_game_folder_is_untouched. They are the same six reported by the main 9dfbe3e suite. placed_title_textures_share_vram_and_preserve_pixels also passed alone on main (1/1), so its suite failure is order/concurrency-dependent.
    Regression run
    The previous head d22887ec had a 600-second RTX 5090 smoke pair against main 9dfbe3ea; both reached the world with zero removals and zero crashes (main: 1,872 frames; previous head: 1,955). Both used a copied cache seed, the same accepted-terms profile, and held Enter. The updated head 572f7eab still needs its own smoke pair; the previous-head blocks below are retained only as history and are not evidence for this head.

Previous head d22887eca6664f2e94817cb42a50a0d6a88446ec:

Main 9dfbe3ea:

xcl-smoke v1
commit: 9dfbe3ea6653a9a0c76ef3ea0d66187a4b5407483b
gpu: NVIDIA GeForce RTX 5090
title: 9cc6a39e
seconds: 600
exit: 0x0
frames shown: 1872 (PresentX 1873)
presents per 2 s (last 3): 2 2 1
device removals: 0
crashes: 0
peak commit: 47791 MB

Previous head d22887ec:

xcl-smoke v1
commit: d22887eca6664f2e94817cb42a50a0d6a88446ec
gpu: NVIDIA GeForce RTX 5090
title: 9cc6a39e
seconds: 600
exit: 0x0
frames shown: 1955 (PresentX 1956)
presents per 2 s (last 3): 0 3 2
device removals: 0
crashes: 0
peak commit: 48001 MB

Not tested

  • Whether retail mesh programs widen EXEC past their declared threads.
  • A capped loop in direct DXIL that ends a lane instead of leaving the loop; exports after it remain a separate issue.
  • Cost of the extra launched lanes and multi-wave barrier work; it remains unmeasured.
  • AMD, Intel, or native wave64 hardware; the 3090 uses split wave64.

AI use

  • An agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 3.8 Flash (tools: Claude Code, Codex, Antigravity). The swarm reviewed, implemented, and validated this change.

🤖 Generated with Claude Code
https://claude.ai/code/session_013oPUFCA9W9F8Qb5MPK33bR

@github-actions github-actions Bot added area:recompiler RDNA2 decoder, HLSL/direct-DXIL recompiler, wave64/wave32 area:tests Unit, integration, e2e tests, or testtitle gpu:amd Code is specific to AMD / RDNA / wave64 GPUs (scope tag; see needs:amd-test) labels Nov 29, 2026
@KDenKC
KDenKC force-pushed the fix/two-pass-mesh-whole-waves branch from e741dfc to 664d738 Compare November 29, 2026 10:47
@github-actions github-actions Bot added needs-pr-check Failing the PR description check (CONTRIBUTING.md) and removed needs-pr-check Failing the PR description check (CONTRIBUTING.md) labels Nov 29, 2026
@KDenKC
KDenKC marked this pull request as ready for review November 29, 2026 13:31
@KDenKC
KDenKC force-pushed the fix/two-pass-mesh-whole-waves branch from 664d738 to fd2cadf Compare November 30, 2026 01:04
@github-actions github-actions Bot added the needs-pr-check Failing the PR description check (CONTRIBUTING.md) label Nov 30, 2026
@github-actions github-actions Bot removed the needs-pr-check Failing the PR description check (CONTRIBUTING.md) label Nov 30, 2026
@KDenKC
KDenKC force-pushed the fix/two-pass-mesh-whole-waves branch from fd2cadf to 1e5b298 Compare December 1, 2026 08:33
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Review (head 1e5b298, diff read, not a merge-check; PR description red: its smoke blocks and counts name fd2cadf, not this head):

  • v5 changes for more programs than the description says, and no test sees it. group_stride (gpu/recomp/mod.rs ~380) makes v5 group × max(threads, vertices, primitives) + slot for every program with more vertices or primitives than threads, whether or not it widens EXEC; on main it is group × threads + slot. It is used at gpu/dxil/kernel.rs ~1320 and emit.rs ~5408. The new test draws one group, so the group number is 0 and the stride never shows. All existing mesh GPU tests have at least as many threads as vertices and primitives.
  • The stride isn't rounded to whole waves, but the launch is (launch_threads). With 32 threads, 64 vertices and 126 primitives on wave64, 128 lanes launch with a stride of 126, so lanes 126-127 of group 0 get the same v5 as lanes 0-1 of group 1. Whether the console's v5 counts the launched lanes or the max is the question, and a two-group test would settle it.
  • Unmeasured cost. Extra lanes launch for every such program, even one that never writes EXEC: 32 threads become 128 lanes, four 32-lane hardware waves on NVIDIA instead of one. Those groups also move to the multi-wave barrier (@xcl_bar). The PR's 600 s pair never reached the world, so nothing measured it.
  • Minor:
    • compute_init now emits tid < total where it used a constant true, so compute shaders change too and recompile once.
    • shaders.rs ~603 (the survey) and the test helper at tests.rs ~11678 still use ms.threads (diagnostics only).
    • There are two blank lines after the new test.

Fine: in the split form a wave past the declared threads now gets an empty EXEC instead of wrapping to all lanes, and the other forms ballot slot < threads. Lanes past the record are still blocked by the vertex and primitive bounds checks. Barrier wave counts follow the launched threads on both backends. The group count is unchanged and the launch is capped at 1024. mod.rs and emit.rs are in TRANSLATOR_SOURCES, so no stale DXIL is served. The tests skip through gpu_ready() / mesh_ready() and check both backends' pixels. It will conflict with #3327 (yours) in the HLSL mesh entry.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

@Foniass

Foniass commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Triage (#1607) – head d22887e

No open or merged PR makes the same change: launch_threads/group_stride are not on main. #3504, #3052 and #2092 touch other parts of the two-pass mesh path, not the group launch width or entry EXEC. Both backends now launch whole console waves covering max(threads, max_vertices, max_primitives), with EXEC at entry limited to the declared threads, and the GPU test draws through both backends. Note that v5's per-group step is now group_stride(wave64), the launch width (max(threads, max_vertices, max_primitives) rounded up to whole waves), for every two-pass mesh program. So it also changes from threads for programs whose thread count is not a multiple of the wave size, not only for those with more vertices or primitives than threads. The regression run does not show whether the title depends on that.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

KDenKC added a commit to KDenKC/xcl that referenced this pull request Dec 1, 2026
Keep v5 ranges disjoint across every launched wave, including programs whose output extents exceed declared threads. Add CPU tests for the output-extent and wave-rounding cases.

Checked: xcl-dev#3350 review 7306364917, xcl-dev#3327 interaction, REPO-TRACKER.md and search-two-pass-lanes.md.
@KDenKC

KDenKC commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor Author

@Foniass Thanks for the careful review. In d22887e, v5's group stride now uses the same whole-wave launch extent as the two-pass launch. The stride stays broad: guest code can widen EXEC after entry, so lanes beyond the declared thread count may still execute and need a disjoint v5 range; we don't have a complete proof that a program never widens EXEC. The tests cover output extents larger than the declared thread count (including the group-1 boundary that previously aliased slots 126–127) and rounding a 65-thread group to full waves for both wave sizes.

The focused tests passed. The completed workspace suite set XCL_NETWORK=0 for the test processes and had no binaries without results. Its six failures match the VM's known baseline failures: D16 resinfo, placed title textures, the three stream-recheck cases, and the title-folder e2e check.

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 2770 filtered out; finished in 0.00s
env set for the tests: XCL_NETWORK=0
counts: 2880 passed, 6 failed, 51 ignored over the binaries with a result; 0 binaries without a result
  test gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16 ... FAILED
  test hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels ... FAILED
  test hle::d3d12x::title_textures::tests::stream_recheck_keeps_the_whole_upload_baseline_over_partial_uploads ... FAILED
  test hle::d3d12x::title_textures::tests::stream_recheck_partial_upload_without_an_entry_queues_a_whole_upload ... FAILED
  test hle::d3d12x::title_textures::tests::stream_recheck_schedule_catches_late_writes_and_resets_milestones ... FAILED
  test test_title_runs_and_game_folder_is_untouched ... FAILED

The smoke pair for this head is still pending.

AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 4 Hydrogen.

@Foniass

Foniass commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up review (head d22887e, since 1e5b298, diff read, not a merge-check):

  • v5 changes for more programs than the description says, and no test sees it: partly fixed. d22887ec now sets the stride on purpose (group_stride = launch_threads, mod.rs ~379) and adds CPU tests of that function (tests.rs ~11-27), but the third assert there only repeats the first (128 >> 7 is 1), and no test draws a second group, so neither backend's emitted v5 step is checked (kernel.rs ~1320, emit.rs ~5408). The description still does not say v5's step also changes for programs that never widen EXEC (32 threads with 32 vertices on wave64 now get a stride of 64, not 32).
  • The stride is not rounded to whole waves but the launch is: fixed; the stride is the launch width, so lanes past the threads of group 0 no longer alias group 1.
  • Unmeasured cost: still open. The extra lanes and the move to @xcl_bar for programs whose launch exceeds their threads are not measured.
  • Minor points: still open. compute_init emits tid < total instead of a constant true (kernel.rs ~1201, compute DXIL recompiles once); ms.threads stays in the survey and test helper (shaders.rs ~603, tests.rs ~11673); two blank lines after the new GPU test (tests.rs ~4514).

New:

  • Fixup commit not squashed. d22887ec rewrites group_stride, which 1e5b2981 added, so the two are one change; its body points to files not in the repository (REPO-TRACKER.md, search-two-pass-lanes.md), and the description still says "one commit" and does not list the new CPU tests.
  • Failures in Tested not explained. The suite run on d22887ec lists 6 failures (gpu_direct_image_get_resinfo_d16, placed_title_textures_share_vram_and_preserve_pixels, three stream_recheck_*, test_title_runs_and_game_folder_is_untouched) without saying whether they also fail on main.

Fine: the stride and the launch now agree on both backends; EXEC at entry still covers only the declared threads; a group whose launch equals its threads keeps the constant EXEC and the old stride; the smoke blocks name the current head.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

KDenKC added a commit to KDenKC/xcl that referenced this pull request Dec 1, 2026
Launch enough whole console waves to cover max(threads, max_vertices, max_primitives), keep EXEC at entry limited to the declared threads, and use the launched width as v5's per-group step in both backends. Compute programs are unchanged.

Update mesh shader surveys and barrier fixtures to use the launched width. Add CPU coverage for output extents and wave rounding, plus a two-group GPU draw that checks the v5 step and matching records and pixels from HLSL and direct DXIL.

Checked: xcl-dev#3350 review 7325409956, xcl-dev#3011 C54, and xcl-dev#3327 interaction.
@KDenKC
KDenKC force-pushed the fix/two-pass-mesh-whole-waves branch from d22887e to a3f07fa Compare December 1, 2026 22:10
@github-actions github-actions Bot added the area:shaders Shader cache, PSO compilation, pipeline libraries, precompilation label Dec 1, 2026
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Follow-up review (head a3f07fa, since d22887e, diff read, not a merge-check; checks red):

  • v5 step untested and under-described: partly fixed. The tests are fixed: tests.rs ~21-23 checks that 32 threads with 32 vertices get a stride of 64 on wave64, and gpu_mesh_mode_two_passes (~4363, ~4412-4420, ~4445-4447) now draws two groups with a launch of 128 and an extent of 126 on both backends, so a wrong step would show in group 1. The description still does not say v5's step also changes for programs that never widen EXEC.
  • Unmeasured cost; failures in Tested not explained: still open.
  • Minor points: partly fixed. The survey (shaders.rs ~603) and the barrier-test helper (tests.rs ~11703) use launch_threads and the blank lines are gone; compute_init still emits tid < total instead of true (kernel.rs ~1201, ~1368).
  • Fixup commit: fixed; one commit with no outside file references. What is in it still names only gpu_mesh_two_pass_widens_exec_past_declared_threads.

New:

  • The split pass-through draw is no longer tested. The shared fixture of gpu_mesh_mode_two_passes went from 128/128/128 to 32/64/126 (tests.rs ~4363), so passthrough_split now returns 1 and the assert changed from 4 to 1 (~4480-4486). mesh_draw_split has no other test caller, so no GPU test draws a record split over several mesh groups any more, though pso.rs ~1436 still takes that path. The split check needs its own MsInterface with 128 vertices.
  • The stride_ms block repeats the first draw. MsInterface { threads: 32, max_vertices: 64, max_primitives: 126, ..ms.clone() } (~4452) is the same as ms, so that block repeats the draws above.
  • Tested and Regression run are for the old head. Both smoke blocks and the suite run name d22887ec, while a3f07fa4 changes shaders.rs and rewrites the GPU test; PR description fails on that.

Fine: stride and launch agree on both backends, EXEC at entry is still the declared threads, and the runtime code in kernel.rs, emit.rs and mod.rs is unchanged since d22887ec.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

@KDenKC

KDenKC commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

@Foniass thanks for the review. Fixed in one commit, a3f07fa4. The v5 step now uses the whole-wave launch width for every mesh program: on wave64, 32 declared threads with 32 outputs use a stride of 64; output extents that require more lanes are rounded up to whole waves. This avoids lane 126/127 aliasing the next group's first lanes when the launch width is 128.

The CPU tests cover output extents and wave rounding. gpu_mesh_mode_two_passes draws two groups and checks records and pixels through both HLSL and direct DXIL. On the RTX 3090, the focused filters passed (stride 2/2; two-pass 1/1). The workspace suite was 2,880 passed, 6 failed, 51 ignored; the same six failed on main: D16 resinfo, placed title textures, three stream-recheck tests, and the title-folder test. The placed-title test passes alone on main but fails in the suite. Cost of the extra launched lanes and multi-wave barrier work remains unmeasured. A smoke pair for this updated head is pending.

AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 4 Hydrogen.

Launch enough whole console waves to cover max(threads, max_vertices, max_primitives), keep EXEC at entry limited to the declared threads, and use the launched width as v5's per-group step in both backends. Compute programs are unchanged.

Update mesh shader surveys and barrier fixtures to use the launched width. Add CPU coverage for output extents and wave rounding, plus a two-group GPU draw that checks the v5 step and matching records and pixels from HLSL and direct DXIL.

Checked: xcl-dev#3350 review 7325409956, xcl-dev#3011 C54, and xcl-dev#3327 interaction.
@KDenKC
KDenKC force-pushed the fix/two-pass-mesh-whole-waves branch from a3f07fa to 572f7ea Compare December 1, 2026 22:29
@KDenKC

KDenKC commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

Correction: a3f07fa4 also changed partial compute DXIL through the shared entry_exec, despite the description saying compute was unchanged. In 572f7eab, mesh EXEC handling is separate and the compute helper is restored to its previous behavior. The survey and test helper now use the launched mesh width; the redundant blank lines are removed.

On the RTX 3090, both focused mesh filters pass (stride 2/2; two-pass 1/1). The workspace suite is 2,880 passed, 6 failed, 51 ignored, with the same six failures as main. A smoke pair for 572f7eab is still pending.

AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 4 Hydrogen.

@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Follow-up review (head 572f7ea, since a3f07fa, diff read, not a merge-check; checks red):

  • compute_init emits tid < total instead of true: fixed. Compute keeps main's entry_exec exactly (constant mask on a full wave, the split-wave mask, or ballot(true)), and the declared-threads ballot is now only in the new mesh_entry_exec (gpu/dxil/kernel.rs ~1333-1413), so compute DXIL no longer changes.
  • The split pass-through draw is no longer tested; the stride_ms block repeats the first draw: still open. tests.rs is unchanged since a3f07fa4, so passthrough_split still returns 1 for the shared 32/64/126 fixture (~4363, ~4480) and no GPU test draws a record split over several mesh groups.
  • Tested and Regression run are for an old head: still open. Both smoke blocks and the suite run still name d22887ec, two pushes back; the description still says "One commit" without the CPU tests or the fixture change, and does not say that v5's step also changes for programs that never widen EXEC.

New: none.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

@fromthemoonx

fromthemoonx commented Dec 2, 2026 •

Copy link
Copy Markdown

merge-check
base: 1c8b551
head: 572f7ea
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2912 passed, 0 failed, 51 ignored (base: 2909 passed, 0 failed, 51 ignored); SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps), the same set as base; failing: none from this PR. The whole-suite run ended the lib binary with 0xc0000005 during eh::tests::thread_dumps_while_threads_run_and_exit (#3586, on main too). The counts are the lib binary run on its own (2764 passed, 0 failed, 31 ignored) plus the other binaries (148 passed, 0 failed, 20 ignored).
review: read the whole diff (6 files, +206 -29). No correctness problem found in the code; the open point is evidence.

  • Both backends launch launch_threads = max(threads, max_vertices, max_primitives) rounded up to whole console waves (at most 1024).
  • EXEC at entry still covers the declared threads only, through the new mesh_entry_exec; compute keeps main's entry_exec. I checked the split-form mask arithmetic for 0, 1-31, 32, 33-63 and 64 lanes.
  • v5 now steps by group_stride = the launch width for every mesh program: a 32-thread program with 32 outputs on wave64 steps by 64, not 32. That is a default-path change for every two-pass mesh program. It rests on the author's reading of the console. I cannot check it against a title here.
  • gpu_mesh_mode_two_passes and the two mesh_group_stride_* tests with XCL_REQUIRE_GPU=mesh on this wave32 GPU: 3 of 3 runs passed, none skipped.
  • Mutation: group_stride back to the declared threads fails all three. Good.
  • The PR description check is red for the reason it gives: no xcl-smoke pair on this head (572f7eab) or on a main commit. For a change to every mesh program's v5 that is the evidence that is missing.
    performance: whole-wave launches add idle lanes for programs whose output extents or thread counts are not whole waves. Not measured; no title here.
    verdict: not yet: no xcl-smoke pair (main and this head 572f7eab) for a default-path change to every two-pass mesh program
    hardware / tool and model: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300 / Claude Code (Claude Opus 5.5)

@github-actions github-actions Bot added the needs-pr-check Failing the PR description check (CONTRIBUTING.md) label Dec 2, 2026
@fromthemoonx

Copy link
Copy Markdown

@KDenKC merge-check above: the code and tests check out here, but the PR has no xcl-smoke pair on its head 572f7eab (and none on main), which the PR description check also asks for; for a change to every two-pass mesh program's v5 that run is the missing evidence: #3350 (comment)

@KDenKC

KDenKC commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

@fromthemoonx thanks for the merge-check. The xcl-smoke pair (main 1c8b5514 and this head 572f7eab) is queued on our RTX 5090, next after the run in progress; the blocks go into the description when it's done.

AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 4 Hydrogen.

@bmjask bmjask left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of 572f7eab: 3 finding(s). 2 are inline. These are on lines outside the diff:

crates/xcl/src/gpu/recomp/emit.rs:1372: Not certain about this one: the newly launched waves (EXEC=0 at entry) now run the whole program, including GS_ALLOC_REQ's unconditional if (lane_id == 0u) res.Store(xcl_rec...). For threads=64, max_vertices=128 on wave64, wave 1 has no active lanes and computes M0 from wave-dependent or uninitialized state, then races wave 0 to store the record's vertex/primitive header. A wrong nv/np makes the pass-through drop or garble triangles. The Direct DXIL lowering has the same exposure, and the HLSL mesh entry has no if ((exec_lo|exec_hi)==0u) return; like the compute path.


These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.

sgpr.insert(3, s3);
sgpr.insert(VAR_SCC, zero);
let (lo, hi) = entry_exec(lw, ms.threads, tid);
let (lo, hi) = mesh_entry_exec(lw, ms.threads, launched, tid);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not certain about this one, because it depends on unverified hardware behaviour: the entry EXEC is still limited to the declared ms.threads. On the console a group launched with launch_threads lanes probably starts with EXEC covering every launched lane, with the guest compiler guarding API threads itself. If so, a mesh program declaring 32 threads with max_vertices=64 that exports from lanes 32..63 without its own s_mov_b64 exec, -1 still starts those lanes inactive in both backends (here and emit.rs:5401 xcl_slot < threads). The vertex exports are dropped, which is the #3011 symptom. The PR says it didn't check whether retail programs widen EXEC, and the only positive test widens it explicitly.

/// The console's v5 per group: each group gets a disjoint range covering every launched
/// lane. Output extents can exceed declared threads, and guest code can widen EXEC later,
/// so this applies to every program, not only ones whose translation proves EXEC widening.
pub fn group_stride(&self, wave64: bool) -> u32 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not certain about this one, because it depends on unverified hardware behaviour: group_stride changes v5's per-group step from the declared threads to the rounded launch width for every mesh program where they differ, including ones that worked before. A wave64 program with threads=64, max_vertices=128 that decodes its group as v5 >> 6 used to see group 1 at v5=64, but now sees v5=128 and decodes it as group 2, reading the wrong per-group data. A 32-thread wave64 program now steps by 64 instead of 32. The test fixture decodes v5 >> 7, which matches the new assumption by construction, so it doesn't confirm the console behaves this way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:recompiler RDNA2 decoder, HLSL/direct-DXIL recompiler, wave64/wave32 area:shaders Shader cache, PSO compilation, pipeline libraries, precompilation area:tests Unit, integration, e2e tests, or testtitle gpu:amd Code is specific to AMD / RDNA / wave64 GPUs (scope tag; see needs:amd-test) needs-pr-check Failing the PR description check (CONTRIBUTING.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants