Repository navigation
Harden worker/buffer pools, DGC0 scratch dims, and PJRT shape/HBM accounting against overflow and partial-publish leaks - #49
Open
saariuslystoned wants to merge 1 commit into
Conversation
…ounting against overflow and partial-publish leaks
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.
Summary
Fixes 6 integer-overflow, wraparound, HBM-accounting, and partial-publish bugs across untouched
libopenbuenosandllama-cpp-cloudtpuruntime code (zero overlap with PRs #15, #45, #46, #47, #48):libopenbuenos/src/ob_worker_pool.cpp:uint32_tfetch_addwraparound could reissue work ranges whentotalapproachedUINT32_MAX; replaced with saturating CAS claim publishingtotal.libopenbuenos/src/ob_buffer_pool.cpp:ob_buffer_alloc(SIZE_MAX - 100)page-alignment wrapped to a0-byte slab and returned success; now returnsOB_ERR_OVERFLOW.libopenbuenos/src/ob_dgc0.cpp: DGC0 scratch dimensions (e.g.,65536^4) wrapped to0and parsed as success; now returnsOB_ERR_OVERFLOWwhile valid dims ({4, 5}) continue to yield20.llama-cpp-cloudtpu/pjrt_runtime.cpp(shape/byte overflow & negative dim leak): Checked overflow innum_elements,pjrt_dtype_nbytes, andpjrt_host_nbytes(preventingf32 {(1<<62)+1}allocating4bytes,{1<<40, 1<<40}reporting0elements, anddim -1throwing mid-allocation and leaking HBM); now fails cleanly withPjrtErrorand leaves HBM accounting unchanged.llama-cpp-cloudtpu/pjrt_runtime.cpp(device-id HBM accounting): Scrambledtpu7x-1tdevice maps previously charged a device-0 constant tensor to device 1; counters are now keyed by hardware device ID.llama-cpp-cloudtpu/pjrt_runtime.cpp(atomicExecuteoutput publication): AnExecutereturning one valid tensor and one missing SSA name previously published the first buffer before throwing, leaking HBM; outputs are now staged and published atomically with counter rollback on failure.Proof (Offline Host Verification)
origin/main,openbuenos_pool_guards_testfailed 4 checks andpjrt_runtime_guards_testfailed 8 checks. On HEAD both compile cleanly with-fsanitize=address,undefined -Werrorand PASS.make -C libopenbuenos test(27/27 +quant-unpackPASS);test_cloudtpu_host(OVERALL ALL PASSED, 0 failures).git diff --checkclean; single trailing newline on all 6 files; clean-room public check clean; TruffleHogverified_secrets=0, unverified_secrets=0.