Repository navigation
Description
Follow-up to #643 / #644, opened as the separate discussion suggested in review.
Summary
naming-guard's step comment says it rejects any hardcoded cuda_oxide_* prefix and that "the single source of truth for these prefixes is crates/reserved-oxide-symbols/". The pattern matches only kernel|device|instantiate, so 4 of the crate's 10 exported symbol constants are unguarded:
| Constant | Distinguishing segment | Guarded today |
|---|---|---|
KERNEL_PREFIX, LEGACY_KERNEL_PREFIX, KERNEL_SCOPE_LOCAL |
cuda_oxide_kernel_ |
yes |
DEVICE_PREFIX, LEGACY_DEVICE_PREFIX, DEVICE_EXTERN_PREFIX |
cuda_oxide_device_ |
yes |
INSTANTIATE_PREFIX |
cuda_oxide_instantiate_ |
yes |
CONSTANT_PREFIX |
cuda_oxide_const_ |
no |
ARTIFACT_ANCHOR_PREFIX |
cuda_oxide_artifact_anchor_ |
no |
PTX_MERGE_REQUIRED_PREFIX |
cuda_oxide_ptx_merge_required_ |
no |
Now that the guard actually executes (#644), that gap hides exactly one live violation:
$ grep -rEn --include='*.rs' \
'"cuda_oxide_(kernel|device|instantiate|const|artifact_anchor|ptx_merge_required)_' \
crates | grep -v '^crates/reserved-oxide-symbols/' | grep -vE ':[0-9]+:[[:space:]]*//'
crates/cuda-core/src/embedded.rs:236: Some("cuda_oxide_artifact_anchor_246e25db_linked_0_0_0"),Where the boundary should sit
I checked whether the guard should simply use RESERVED_ROOT ("cuda_oxide_") and drop the per-family list. It should not. That matches 58 literals, and ~57 are a different namespace the crate does not own and must not police:
- pliron op-attribute keys —
cuda_oxide_asm_kind,cuda_oxide_debug_local_*,cuda_oxide_op_alignment,cuda_oxide_gep_inbounds(llvm-export, dialect-mir, mir-lower) - rustc
--cfgnames —cuda_oxide_internal_backend_identity,cuda_oxide_internal_codegen_env(cargo-oxide) dlopenprobe symbols —cuda_oxide_probe(libnvvm-sys, nvjitlink-sys)- unique temp-directory names —
cuda_oxide_stale_artifacts_*,cuda_oxide_clean_cache_*,cuda_oxide_libdevice_link_* - the generated marker attribute —
cuda_oxide_intrinsic_marker
So the right shape is the six symbol families, which cover all ten constants and produce exactly the one hit above. I've written that reasoning into the step comment so the boundary is not re-litigated later.
Proposed fix
- Widen the alternation to the six families.
- Route
crates/cuda-core/src/embedded.rs:236throughreserved_oxide_symbols::artifact_anchor_symbol("linked", "0.0.0").
Point 2 needs reserved-oxide-symbols as a [dev-dependencies] entry on cuda-core — the violation is inside #[cfg(test)] mod tests, so it stays out of the shipped library. This adds no licensing surface: reserved-oxide-symbols is already a workspace dependency of llvm-export, cargo-oxide, and mir-lower, and the Cargo.lock delta is one line.
Verification
CPU-only; no GPU. Guard step extracted from the YAML and run directly:
| # | Scenario | Expected | Result |
|---|---|---|---|
| 1 | Widened guard, embedded.rs fixed |
pass | exit 0 |
| 2 | Widened guard, violation restored | fail | exit 1, names file and line |
| 3 | Old 3-family pattern vs. that same violation | — | 0 matches, confirming the blind spot |
| 4 | Synthetic violation for each of the six families | fail | all six caught |
| 5 | cuda_oxide_asm_kind / ..._internal_backend_identity / ..._probe |
pass | not flagged, no false positive |
The rebuilt symbol is byte-identical: I temporarily added assert_eq!(anchor, "cuda_oxide_artifact_anchor_246e25db_linked_0_0_0") to the test and it passed, then removed it.
cargo test -p cuda-core --lib: 26 passed / 0 failed, including artifact_bundles_from_binary_path_reads_linked_executable, which links a real executable carrying the anchor and reads it back. reserved-oxide-symbols: 13 unit + 17 doc tests pass. cargo clippy -p cuda-core --all-targets -- -D warnings and cargo fmt --all --check are clean.
Unrelated observation
While checking whether CONTRIBUTING's "update dependency-licenses.csv when adding a dependency" applied here, I noticed the CSV lists 11 first-party workspace crates but 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 and is not something I've touched here; happy to file it separately if you want those rows added.
Activity
ci(naming-guard): guard every reserved symbol prefix, not three of th…
docs(reserved-oxide-symbols): document all ten symbol constants (#738)