Repository navigation
fix(intrinsics-gen): fail closed when an unsafe family has no safety renderer - #1153
Merged
Merged
Conversation
Two invariants over the rendered raw-ABI # Safety blocks:
- a safety block that names `addr` must belong to a record that takes a
pointer argument
- no two families may render the identical safety block
Both fail on main: the # Safety dispatch in render_raw_abi silently falls
back to the packed-atomic contract for families without a dedicated arm,
so the six clc_* intrinsics document a four-byte global atomic they do
not perform, and four of them take no pointer at all.
unsafe safety docs reference `addr` without a pointer argument:
clc_query_get_first_ctaid_x, clc_query_get_first_ctaid_y,
clc_query_get_first_ctaid_z, clc_query_is_canceled
unsafe safety blocks shared across families: [{"clc", "packed_atomic"}]
Signed-off-by: Joochul Chang <[email protected]>
…renderer The unsafe-record guard in validate_renderable only checked that a family name appeared in a hand-maintained allowlist, while the # Safety dispatch in render_raw_abi silently fell back to the packed-atomic contract for any family without a dedicated arm. Adding an allowlist line was enough to pass the guard, which is how the clc family shipped six intrinsics carrying a four-byte global-atomic contract they do not perform. Give packed_atomic an explicit arm and make the terminal else a generation error naming the record and family, so a family missing from the dispatch can no longer inherit another family's contract. Delete the allowlist: the per-family shape checks it duplicated remain, and the dispatch itself is now the single source of truth. Add a dedicated clc arm. Its contracts are shared with render_compat_clc through clc_safety_lines, so the raw and compatibility renderers cannot drift, and they now state the obligations the repository already documents: the 16-byte shared::cta response and its expect-tx arming, the prohibition on retrying after an observed failed cancellation, and that the query results are meaningful only after a successful cancellation. Signed-off-by: Joochul Chang <[email protected]>
almightychang
marked this pull request as draft
August 23, 2026 15:36
almightychang
marked this pull request as ready for review
August 23, 2026 15:48
Collaborator
|
Verified end to end. On main only packed_atomic and clc reach the silent catch-all, so the six CLC intrinsics really did ship an atomic contract they never perform:
Two notes, neither blocking:
CI is approved on the newest head. The #1152 contract-depth question stays a separate decision. Labels added. |
nihalpasham
approved these changes
Aug 28, 2026
nihalpasham
left a comment
Collaborator
There was a problem hiding this comment.
Verified on the merged tree with #1105 in: generator tests green, generated outputs byte-current; CI green. Merging.
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 #1152. The unsafe-family guard checked a hand-maintained family allowlist rather than whether
render_raw_abihad a matching safety renderer, allowing CLC intrinsics to inherit the terminal packed-atomic contract. This change makes raw-ABI safety rendering fail closed and gives CLC shared safety contracts across the raw and compatibility renderers.Changes
b0b57459adds two rendered-safety invariants. At that commit they are RED: 298 existing tests pass and exactly the two new tests expose the CLC/packed-atomic collision.50a4d0b1makes the tests GREEN by givingpacked_atomican explicit arm, returning a generation error for any unhandled unsafe family, removing the redundant mirrored allowlist, and rendering reviewed CLC contracts through one shared helper.abi_v1.rsandclc.rsare doc comments only; comparison confirmed that no non-///line changed. No catalog, ABI ledger, PTX, or lowering file is touched, so runtime/GPU validation is not applicable.Testing
just checkpasses (the local mirror of CI: fmt, clippy, tests, CUDA-linked tests, guards, generated-intrinsic checks, rustdoc, and doctests). Exit 0 on the commits in this PR, with CUDA 12.9.86 and the pinned toolchain; 90 test binaries pass and none fail.deploywas skipped, as it is on every pull request.cargo oxide run <example>passes, orscripts/smoketest.sh -o '^<example>$'(not applicable: documentation-only generated changes; no runtime, PTX, or lowering change)Checklist
git commit -s)