Skip to content

Shaders: automatically avoid divergent barrier sync on narrow-wave GPUs - #608

Open
rivaldodev wants to merge 1 commit into
fxceless:mainfrom
rivaldodev:fix/nvidia-heap-and-barrier-guards
Open

rivaldodev wants to merge 1 commit into
fxceless:mainfrom
rivaldodev:fix/nvidia-heap-and-barrier-guards

Conversation

@rivaldodev

@rivaldodev rivaldodev commented Nov 25, 2026 •

Copy link
Copy Markdown

Rebased onto main (a253706) and ported the group_threads <= console_wave restriction and 128-thread regression test from Zettrox/ztrx#30 per @TokyoMkt's feedback.

What changed

  • Restricts automatic divergent barrier sync omission (barrier_mode in crates/victory-shader/src/emit/lower.rs) to single-console-wave groups (group_threads <= console_wave), so multi-console-wave groups (e.g. 128+ threads in wave64) always keep SyncThreadGroup and preserve cross-wave LDS synchronization.
  • Uses main's existing translation_fingerprint() (which already hashes host_max_wave()).
  • Preserves uniform barriers, translation-added meeting barriers, memory fences (2 | 8), and explicit VICTORY_GROUP_SYNC overrides (0, 1, 2).

Tests

  • emit::lower::tests::automatic_barriers_keep_fences_and_only_drop_unsafe_sync (covers single-wave, 128-thread multi-wave, unknown group size, uniform, wave64, and explicit overrides).
  • emit::lower::tests::automatic_barrier_flags_reach_the_emitted_shader (verifies emitted DXIL barrier mode for 64-thread vs. 128-thread groups on wave32 and wave64 hosts).
  • emit::wave64_tests::an_automatic_barrier_inside_a_lane_branch_runs_on_narrow_hardware (runs on live narrow-wave GPU hardware).

Copilot AI balanced review requested due to automatic review settings November 25, 2026 03:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@TokyoMkt

Copy link
Copy Markdown

Could you bring over the group_threads <= console_wave check and the 128-thread regression from Zettrox/ztrx#30? This version can drop GroupSync in a group with multiple console waves, where the memory fence alone doesn’t make the LDS producer and consumer wait for each other.

Adapted from Marvisak/VIctory#1133 to the existing fence_only analysis. Preserves memory fences and explicit overrides, keys the shader cache by host wave width, and adds emitted-flag and hardware-dispatch regression tests.
@rivaldodev
rivaldodev force-pushed the fix/nvidia-heap-and-barrier-guards branch from 626a650 to 8d02480 Compare November 25, 2026 12:34
@rivaldodev

Copy link
Copy Markdown
Author

Done! Rebased onto main (a253706) and ported both the group_threads <= console_wave check in barrier_mode() and the 128-thread multi-console-wave regression tests from Zettrox/ztrx#30.

All 3 automatic_barrier tests (including the live narrow-wave hardware dispatch test) pass locally.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants