Skip to content

fix(libSceAgcDriver): create a compute pipeline of a huge program without driver optimization - #51

Open
AlxcBTW wants to merge 1 commit into
mainfrom
fix/huge-compute-optimization
Open

AlxcBTW wants to merge 1 commit into
mainfrom
fix/huge-compute-optimization

Conversation

@AlxcBTW

@AlxcBTW AlxcBTW commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

What

A compute program of 400000 SPIR-V words or more is now created with VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT (APS5_HUGE_SHADER_WORDS sets the limit, 0 turns it off), and the capture format accepts that flag so such a pipeline can still be captured and replayed.

Why: a compute program captured from PPSA02429 (10 497 106 byte capture) is 2 624 211 SPIR-V words in one function of 321 blocks, and 99% of its instructions sit in five blocks. One block alone holds 447 491 instructions, a straight line of about 33 000 f32 subtractions (plus 1 500 multiplications and 1 000 additions) with no loop and no switch. Each float operation costs about 13 instructions because the emulated f32 denormal flush and NaN canonicalisation (the host has no f32 flush-to-zero mode on NVIDIA) wrap it, with bitcasts between them. The NVIDIA driver's compiler (nvgpucomp64.dll) does not finish this pipeline in 4 minutes; an AMD Radeon 880M compiles it in about 2 minutes. The other four captured compute pipelines of the run are 3.9 KB to 110 KB.

This is a mitigation, not yet shown to help on NVIDIA: whether the driver honours the flag as a faster compile is checked with the pipeline watch of #50. A follow-up in the recompiler can shrink the per-operation expansion (drop the NaN canonicalisation between chained float operations).

Tested

Unit test agc_huge_shader_policy (limit and parsing). Not run against a game or an NVIDIA device.

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; no silent stubs added
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source: none added
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: none yet (NVIDIA RTX 5070 Laptop run pending)
  • AI-assisted: yes

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

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.

1 participant