Skip to content

fix(shader): record BDA lookup faults from one call site - #3989

Closed
MarcZX10 wants to merge 1 commit into
boykopovar:mainfrom
MarcZX10:codex/carry-bda-fault-one-exit-2972
Closed

MarcZX10 wants to merge 1 commit into
boykopovar:mainfrom
MarcZX10:codex/carry-bda-fault-one-exit-2972

Conversation

@MarcZX10

@MarcZX10 MarcZX10 commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

What

  • Record every failed BDA lookup through one fault-reporting call site, then return the recorded address or zero.
  • Preserve the lookup checks, order, fault reason and reported address/size/instruction; keep probe lookups unchanged.
  • Carry the fix from issue #2972, retaining Miles Coviello's commit authorship.

This overlaps SpirvBdaLookup.cpp and BDA tests with open PRs #2837 and #3655, which optimize the page-table lookup for separate reasons. The changes may need a rebase depending on merge order.

Tested

  • The issue author reports the new SPIR-V assertion test and full CTest runs on Intel ANV and NVIDIA; results and hardware details are in the issue.
  • tools/check_conventions.py --base upstream/main and git diff --check passed locally.
  • A local Linux GCC 12.2 Release build of agc_shader_memory_tests did not complete in this environment; no local result is claimed.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • No new third-party code
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

get_bda_pointer and the write and atomic lookups returned from each of
their 16 checks through its own record_bda_fault call. The SPIR-V keeps
them as DontInline functions, but Mesa ANV inlines every function call,
so each lookup site carried 16 copies of the fault record: 768 in
agc_driver_flat_loads_x2_x3 and 435 compare-exchanges in its final NIR.

On Intel GPUs with a per-thread scratch limit of 256 KiB (Xe-HPG and
later: Arc, Meteor Lake, Arrow Lake) the SIMD32 compile that wave32
programs require then spills past the limit on Mesa before 26.2, which
gives every spilled register its own scratch slot, and
vkCreateComputePipelines fails with VK_ERROR_UNKNOWN ("Scratch space
required is larger than supported"): agc_driver_flat_loads_x2_x3 and
agc_driver_masked_global_store on Arrow Lake, Mesa 26.1.8.

A failing check now stores its reason and leaves through nested
selections to one exit, which records the fault when a reason was stored
and returns the address, or zero after a fault. The checks, their order,
the recorded reason, address, bytes and instruction are unchanged, and
the probe lookups, which record nothing, are emitted as before.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tb9hwmvLWxNkJWG2XdjxKM
(cherry picked from commit 934348f)
@milescoviello

Copy link
Copy Markdown
Contributor

Thanks for carrying it, @MarcZX100, and for keeping the authorship. Some numbers that may help with the order against #3655, which also fixes #2972. Intel Arrow Lake, Mesa 26.1.8 ANV, every run a cold compile (ANYPS5_NO_SHADER_CACHE=1, MESA_SHADER_CACHE_DISABLE=true):

Intel ANV, cold flat_store masked_global_store flat_loads_x2_x3
main a11c8f7 times out (300 s) 25 s 4.8 s
this commit on main 65 s 10 s 1.1 s
#3655 65 s 4.7 s 0.2 s
#3655 + one fault site on top 51 s 3.8 s 0.2 s

#3655 also fixes the NVIDIA hangs from #3291 (details on #3655), so it covers more than this commit. The last row is the same one-call-site idea rebuilt on #3655's structure, with phis instead of function variables: milescoviello:fix/bda-lookup-single-fault-site (980534d). As I said on #3655, I plan to open it as a follow-up once #3655 is merged. Which order to take is the maintainers' call.

AI-assisted: yes

@MarcZX10

Copy link
Copy Markdown
Contributor Author

Closing this carry PR after reviewing issue #2972: the ready branch was explicitly offered for a maintainer to carry, and I cannot claim maintainer authorization. The source commit and test evidence remain documented in the issue.

@MarcZX10 MarcZX10 closed this Oct 11, 2026
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.

2 participants