Validate reconstruct kernel indices before dispatch - #310
Merged
turboderp merged 1 commit intoSep 2, 2026
Merged
Conversation
|
Thanks for providing the link in the case! |
Member
|
Thanks. I'm not sure how you'd end up with a bitrate less than 1 or greater than 8, but it can't hurt to bounds check. |
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
reconstruct_sliceandreconstruct_had_sliceselect CUDA kernels by indexing fixed 24-entry function-pointer tables. The index is derived fromK, which ultimately comes from the EXL3 checkpoint's trellis shape, but neither dispatch site currently checks thatKis within the supported range.This change validates
Kas1..8before any size arithmetic, then validates the computed index before dispatch. InvalidKvalues reaching either reconstruct entry point now produce aRuntimeErrorinstead of indexing outside the reconstruct kernel table.This addresses the issue coordinated as CERT/CC VU#369611 and discussed in #250.
Validation
The affected
reconstruct.cublob on currentmaster(0c49587a7c235e6303a6bbedc8b665272ad3a2ea) is byte-identical to the source used for the A100 validation. This uses the same validated guards, with theKcheck moved ahead of the existing256 * K / 16size expression so malformed values cannot reach that arithmetic first.On the patched A100 build:
K=1,K=4, andK=8boundary/control cases returned normally;K=0andK=9cases were rejected withRuntimeError: K must be in 1..8in both reconstruct dispatch paths;turboderp/Llama-3.2-1B-Instruct-exl3at 2.0 bpw loaded and generated normally.The compatibility check covers that tested checkpoint and configuration; it is not intended as a survey of every EXL3 model.
Scope
The patch changes only the two load/reconstruct dispatch sites. It does not alter valid kernel selection or model output.
AI assistance was used while preparing the patch and validation. I reviewed the change and am responsible for it.