Skip to content

Translation: buffer range checks without a division - #66

Merged
ThatRecompDev merged 1 commit into
ThatRecompDev:mainfrom
guialmm:fix/buf-limit-no-division
Nov 27, 2026
Merged

ThatRecompDev merged 1 commit into
ThatRecompDev:mainfrom
guialmm:fix/buf-limit-no-division

Conversation

@guialmm

@guialmm guialmm commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Fixes the E_OUTOFMEMORY group from #9 (21 cases on an RTX 3060, driver 32.0.16.1714).

NVIDIA refuses the pipeline when a guarded store depends on 0xffffffff / stride, which buf_limit and sbuf_limit used for the 4 GiB overflow check. buf_index_overflows answers index * stride >= 2^32 without dividing: the stride has 14 bits, so splitting the index at bit 18 keeps both products under 32 bits. I checked it against the division for every stride (0..0x3fff).

Tests: WARP 550 passed, 0 failed. On the 3060 none of the 21 fail anymore; what's left there is the rootdesc variant (next PR) and what #61/#62 fix.

AI-assisted (Claude), reviewed and tested by me.

NVIDIA refused the pipelines of 21 shader tests with E_OUTOFMEMORY
(RTX 3060, driver 32.0.16.1714): their guarded stores depend on
0xffffffff / stride in buf_limit and sbuf_limit. buf_index_overflows
answers index * stride >= 2^32 with shifts and two products that stay
under 32 bits (checked against the division for every stride).
@ThatRecompDev

Copy link
Copy Markdown
Owner

thanks, this is a nice one. went through the math: with the 14-bit stride the hi/lo split gives exactly index * stride >= 2^32 and nothing passes 32 bits, and stride 0 behaves like before, so it's equivalent to the division. ran it here together with #61, #62, #67 and our own pending translator changes: 572 passed / 0 failed on WARP, and the buffer, typed view, wave emulation and user-data tests (50) pass on a 4090 too. it changes translation output so it lands with that batch, should be soon

@ThatRecompDev

Copy link
Copy Markdown
Owner

in main now with the translator batch (976cc3e). it ran in all of last night's boots on the 4090 without trouble, thanks for this one.

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