Initialize Standard JSON device padding and sentinels#15
Merged
Conversation
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.
Fixes #3
Root cause
The reported initcheck finding and the returned-result gap are two distinct uninitialized regions:
depth_init_MathAPIreads packed 32-bit words fromout_string_open_close_8_GPU. When the open/close count is not divisible by four, the allocation contains 1-3 tail bytes thatremoveCopynever writes.structural[last]andpair_pos[0], but that synthetic root/closing sentinel was not initialized until iterator construction.The host result buffer is allocated only after
depth_init_MathAPIand CUB sorting complete, so initializing that host buffer alone cannot resolve the earlier device read.Fix
removeCopyanddepth_init_MathAPI.structural[0]and the overlappingstructural[last]/pair_pos[0]sentinel before returning.Validation
Environment: NVIDIA A100 80GB PCIe (
sm_80), driver 580.173.02, CUDA 13.3, Compute Sanitizer 2026.2.1.depth_init_MathAPIinitcheck findings by tail padding: padding 0:0 -> 0; padding 1:1 -> 0; padding 2:1 -> 0; padding 3:1 -> 0.tuple<uint32_t,uint8_t>padding diagnostics remain unchanged (3 x open_close_count) and are independent of the application tail/sentinel storage.SLAST=0, P0=0; fixedSLAST=22389, P0=22389; overlap verified.lang=en.twitter_large_record.jsonoutput unchanged: 61,072,730 elements andlang=en.2211520110405220824; 4,676,467 opening pairs; opening-pair hash8222789647060382053.+0.748%, within run-to-run noise).The change is limited to five lines in
cujson/parse_standard_json.cu.