Repository navigation
Conversation
…ures
Google Maps WebGL vertex shaders with vertex texture fetches hit bank-1
register pressure ("qualified vertex texture result needs 4 dword(s), 30
of 32 in use") because dying texture inputs remained live across the
result allocation, output-feeding values and addressed buffer loads
occupied bank 1, and bank-1 eviction only checked 8-aligned runs on
straight-line shaders.
- Release dying SSA texture sources in emit_vertex_qualified_texture()
before allocating the 4-dword bank-1 result run (all operands are
already copied into the recipe's bank-1 scratch).
- Generalise bank-1 -> bank-0 eviction (evict_vertex_bank1_n()) to
evict arbitrary contiguous runs on demand inside alloc_run() and
address-pair loops at cf_depth 0, skipping decl_reg homes.
- Allow control flow in the vs_evict pressure retry: keep output values
and decl_out in bank 0 (vs_out_reg() moves each into bank 1 at vout),
park addressed UBO/SSBO load results in bank 0 after wait, and free a
12-dword bank-1 window before entering top-level if/loop blocks.
- Release vs_out_reg() scratch after each eager vertex output.
Assisted-by: LLM
Signed-off-by: Berkay Kösebay <brkosebay@users.noreply.github.com>
…st vertex retry Google Maps (WebGL through Zink) still refuses a vertex program with "register pressure: qualified vertex texture result needs 4 dword(s), 30 of 32 in use" after cd1169a. The coupled vertex sample needs its recipe (coordinates, level or derivatives, extras, the 4-dword result) in bank 1, and the last vertex retry's eviction (evict_vertex_bank1_n()) cannot always make room: it never runs inside control flow (a move on one path would leave the value in another register on the other), and it never moves a decl's register. In the last vertex retry (vs_evict) only, when a bank-1 run of the recipe still cannot be allocated, lend the registers of the cheapest run to the recipe for this instruction: each held value moves into a free bank-0 register (the bank-1-to-bank-0 move eviction already emits), and once the result has been parked in bank 0 it moves back into its own bank-1 register (the bank-0-to-bank-1 move of vertex_qualified_copy()). Every value ends the instruction in the register it started in, so this is valid at any control-flow depth and inside loops. The texture's own sources, the recipe's registers, reserved and pending registers and busy registers without a value are never lent, and a run is lent only when bank 0 keeps room for the result's parked components, so no component stays in a lent register. Programs that compile in an earlier retry are not affected. Also report the eviction retry's own refusal after the ladder's, so a program it still refuses names its reason. Assisted-by: LLM Signed-off-by: Berkay Kösebay <brkosebay@users.noreply.github.com>
Google Maps (WebGL through Zink) still refuses a vertex program after ec5699f: "qualified vertex texture result needs 4 dword(s), 30 of 32 in use; bank-1 eviction retry: ... 26 of 32 in use". The two attempts fail for opposite reasons. The ladder's last attempt (the pressure-driven order) has bank 0 nearly empty, but bank 1 is full of attributes held for later reads, and it never evicts. The eviction retry evicts, but in the program's own order: by the qualified vertex texture its evicted values fill all 32 bank-0 registers. Bank 1 then has six free registers, none four in a row, and lending (vtex_lend_run()) has no bank-0 register to lend into. When the eviction retry refuses too, go through the whole ladder once more with eviction (and so lending) in every two-bank attempt: in the program's own order and in the orders the scheduling retries make. In the pressure-driven order the program fits, with eviction alone (the captured program, 13062 bytes, 6 uploads). The eviction stays limited to programs without stores, as in the eviction retry. No new encodings: it emits the same moves the eviction retry already does. This runs only after every existing attempt has refused, so a program that compiles today keeps its bytes: offline replays of the Maps capture (51 other programs) and of the dolphin-mkw, nfscrb, nfsu2, ppsspp and selftest corpora give the same code hash before and after. A refusal now also names the eviction ladder's reason, after the eviction retry's. Assisted-by: LLM Signed-off-by: Berkay Kösebay <brkosebay@users.noreply.github.com>
Contributor
|
Thanks @brkosebay, a careful fix for the Maps shaders. We're happy to merge once you've seen Maps draw with it on the iPad 5 (please post that and mark it ready). One small request before then: two of the changes, freeing the texture read's dead inputs early and freeing scratch registers after each early vertex output, run whenever |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draft: the series is in the Mesa the iPad 5 runs, but nobody has yet checked on the device that Google Maps draws with it. It gets marked ready after that check.
Google Maps (WebGL through Zink) refused about 3,000 draws in 30 s on the A9. Its vertex shaders sample textures, and the coupled vertex sample needs a 4-dword run in bank 1 while bank 1 is full of attributes held for later reads: "qualified vertex texture result needs 4 dword(s), 30 of 32 in use". Three steps, each used only after the previous attempts have refused:
vout.Programs that compile in an earlier attempt are unaffected: the same code, byte for byte. Offline, on a corpus of captured shaders (the Maps capture plus Dolphin, PPSSPP and racing-game captures), Maps goes from 51 admitted + 1 refused to all 52 admitted, the other 51 keep their code hashes, and every other corpus is identical line for line. A vertex shader that still refuses costs one more ladder run at pipeline creation.
Built on this head (Vulkan imagination with asserts on); the G5P meson host tests pass, 9/9.
How to test
On a stock Orchard install with Mesa built from this branch:
Expected on the iPad 5: Maps draws its vector map with no register-pressure refusals. A10: unchanged, because this is the G5P vertex compiler.