Repository navigation
ci(naming-guard): guard every reserved symbol prefix, not three of them - #646
Merged
Merged
Conversation
The step comment says it rejects any hardcoded reserved prefix and that reserved-oxide-symbols is their single source of truth, but the pattern matched only kernel|device|instantiate. That left CONSTANT_PREFIX, ARTIFACT_ANCHOR_PREFIX and PTX_MERGE_REQUIRED_PREFIX unguarded, and now that the guard actually executes it was hiding one live violation: the cuda-core embedded-artifact test hand-wrote an artifact-anchor symbol. Widen the alternation to the six segments that cover all ten symbol constants, and route that test through reserved_oxide_symbols::artifact_anchor_symbol, which produces the same string byte for byte. The violation sits in `#[cfg(test)] mod tests`, so reserved-oxide-symbols becomes a dev-dependency and stays out of the shipped library; it is already a workspace dependency of llvm-export, cargo-oxide and mir-lower, so the Cargo.lock delta is one line. The pattern deliberately still does not match bare `cuda_oxide_`. That word-space also holds pliron op-attribute keys, rustc --cfg names, dlopen probe symbols and temp-directory names — 57 literals this crate does not own. The step comment now records that boundary so it does not have to be re-derived. Fixes NVIDIA#645 Signed-off-by: Vyncint Ng <[email protected]>
This was referenced Aug 3, 2026
… family
The pattern is anchored to the opening quote, so a hardcoded full
modern prefix ("cuda_oxide_codegen_v1_...") kept its embedded
cuda_oxide_kernel_ segment mid-string where no family could match.
Add codegen_v1 to the alternation (zero false positives tree-wide)
and reword the coverage comment to say precisely which constant each
family catches.
Collaborator
|
Verified this end to end:
I pushed one commit on top:
|
nihalpasham
approved these changes
Aug 4, 2026
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 #645. This is the separate discussion you suggested when approving #644.
What was wrong
naming-guard's comment says it rejects any hardcoded reserved prefix and thatreserved-oxide-symbolsis their single source of truth, but the pattern matched onlykernel|device|instantiate. Four of the crate's ten exported symbol constants were unguarded, and now that the guard actually executes, that gap hid exactly one live violation:Coverage before and after:
KERNEL_PREFIX,LEGACY_KERNEL_PREFIX,KERNEL_SCOPE_LOCALcuda_oxide_kernel_DEVICE_PREFIX,LEGACY_DEVICE_PREFIX,DEVICE_EXTERN_PREFIXcuda_oxide_device_INSTANTIATE_PREFIXcuda_oxide_instantiate_CONSTANT_PREFIXcuda_oxide_const_ARTIFACT_ANCHOR_PREFIXcuda_oxide_artifact_anchor_PTX_MERGE_REQUIRED_PREFIXcuda_oxide_ptx_merge_required_Why six families and not bare
cuda_oxide_The obvious simplification is to drop the list and match
RESERVED_ROOToutright. I measured it: that hits 58 literals, and ~57 belong to a namespace this crate does not own and must not police —cuda_oxide_asm_kind,cuda_oxide_debug_local_*,cuda_oxide_op_alignment,cuda_oxide_gep_inbounds--cfgnames:cuda_oxide_internal_backend_identity,cuda_oxide_internal_codegen_envdlopenprobe symbols:cuda_oxide_probecuda_oxide_stale_artifacts_*,cuda_oxide_clean_cache_*cuda_oxide_intrinsic_markerWidening that far would mean ~57 false positives and a pointless refactor. The six symbol families cover all ten constants and produce exactly the one real hit. I put that reasoning in the step comment so the boundary does not have to be re-derived next time.
The dev-dependency
The violation is inside
#[cfg(test)] mod tests, soreserved-oxide-symbolsgoes in[dev-dependencies]and stays out of the shippedcuda-corelibrary. It is already a workspace dependency ofllvm-export,cargo-oxide, andmir-lower, so this adds no licensing surface and theCargo.lockdelta is one line.Verification
CPU-only, no GPU. Guard step extracted from the YAML and run directly:
embedded.rsfixedcuda_oxide_asm_kind/..._internal_backend_identity/..._probeThe rebuilt symbol is byte-identical — I temporarily added
assert_eq!(anchor, "cuda_oxide_artifact_anchor_246e25db_linked_0_0_0")to the test, confirmed it passed, then removed it.artifact_bundles_from_binary_path_reads_linked_executablealso links a real executable carrying the anchor and reads it back, and still passes.cargo test -p cuda-core --lib: 26 passed / 0 failed.reserved-oxide-symbols: 13 unit + 17 doc tests pass.cargo clippy -p cuda-core --all-targets -- -D warningsclean;cargo fmt --all --checkclean.One unrelated thing I noticed, not touched here
Checking whether CONTRIBUTING's "update
dependency-licenses.csvwhen adding a dependency" applied, I found the CSV lists 11 first-party workspace crates while the workspace has 23 members. Missing:cuda-intrinsics,cuda-intrinsics-gen,cuda-artifact-finalizer,cuda-oxide-codegen,mir-transforms,nvvm-transforms,cargo-oxide,oxide-artifacts,cuda-async,libnvvm-sys,nvjitlink-sys,reserved-oxide-symbols,fuzzer. That predates this change; say the word and I'll file it separately.