Commit Graph

2 Commits

Author SHA1 Message Date
1524a0913a tools/address_guard: match runtime 48-bit wraparound spans and header last_module field
Support 48-bit spans crossing 0 (both signed negative and unsigned 48-bit two's complement)
using chunk-level bit-range marking matching runtime/src/address_guard.h, add optional
last_module parameter to header(), and add unit + semantic regression tests verified with
address_guard_test and RTX 3060 run_address_guard_gpu_test.py.

AI-assisted: Antigravity gemini-4-neon.
2026-11-26 22:11:37 -03:00
1156672942 rdna2spirv: --address-guard checks every heap_base access against the runtime's page table
Every Gen.host_addr access (buffer, global_, scalar and BVH loads, stores and atomics) calls one
%guard_fn with its sign-extended 48-bit heap offset, kind and span. Below the arena's size it passes
after a compare; elsewhere the 4 KiB pages of its first and last byte are looked up in a two-level
page table (level 1 by offset bits 47..32, level 2 one bit per page). A refused load reads the zero
area, a refused store or atomic the dump area (an atomic returns 0), and the refusal is counted in
the guard header. Without the header's magic every access passes; without the flag the module is
unchanged byte for byte.

tools/address_guard.py is the Python reference of the table and the check. cs_address_guard is the
fixture of the translator test and of scripts/run_address_guard_gpu_test.py, which runs it on a heap
where every address it touches is real memory, so no run can fault.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 09:07:52 -05:00