Skip to content

fix(ci): preserve CUDA guard polarity in DSR ratchet - #20

Open
localai-org-maint-bot wants to merge 1 commit into
mudler:mainfrom
localai-org-maint-bot:codex/dsr-guard-polarity
Open

fix(ci): preserve CUDA guard polarity in DSR ratchet#20
localai-org-maint-bot wants to merge 1 commit into
mudler:mainfrom
localai-org-maint-bot:codex/dsr-guard-polarity

Conversation

@localai-org-maint-bot

@localai-org-maint-bot localai-org-maint-bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Outcome

Fixes a fail-open branch-polarity defect in the CPU-only device-specific-reference (DSR) ratchet under ROAD-V1-A6 / BACKEND-SEAM-AUDIT S1.

The checker previously stored only whether a preprocessor condition mentioned a CUDA-family macro. As a result, #ifndef VLLM_CPP_CUDA and #if !defined(VLLM_CPP_CUDA) incorrectly exempted CUDA includes in portable code, while their CUDA #else arms were classified in reverse.

Design selected

I considered three approaches:

  1. special-case only #ifndef, which leaves equivalent !defined expressions broken;
  2. assign precedence to textual positive/negative terms, which fails on disjunctions;
  3. model branch implication for CUDA-family-only boolean expressions, with conservative handling for unknown mixed expressions.

This PR implements option 3. CUDA-family predicates are evaluated under the portable-build assumption that all such macros are undefined. A false condition marks the current arm CUDA-only; a true condition marks its #else CUDA-only. Unknown disjunctions are counted conservatively. The accepted S1 contract and checkpoint records are updated without changing lifecycle, support, or the DSR baseline.

TDD evidence

RED first:

  • 4 direct mutations proved #ifndef and !defined arms were exactly inverted
  • 2 compound mutations caught a regression in defined(CUDA) && !defined(VT_OPTION)
  • 2 disjunction mutations caught the CPU-reachable !defined(CUDA) || defined(VT_OPTION) arm

GREEN:

  • focused polarity mutations 8/8
  • full device-leakage mutation suite 32/32
  • full script suite 103/103
  • real tree remains DSR 32/32 with zero exemptions

Verification

  • python3 -m unittest discover -s tests/scripts -p 'test_*.py' (103 tests)
  • python3 scripts/check-device-leakage.py (DSR 32 equals baseline 32)
  • python3 scripts/check-agent-record.py (ENGINE=131, MODEL=327, QUANT=82, KERNEL=45, BACKEND=68)
  • python3 scripts/check-doc-checkpoint.py --commit HEAD
  • README structure, model checklist, fusion consistency, and environment-documentation checkers
  • git diff-tree --check HEAD
  • independent code review: no Critical or Important findings

No runtime C/C++, baseline count, workflow, lifecycle, support claim, README, GPU, model, download, or performance behavior changes. Benchmark disposition is NOT APPLICABLE with benchmark_binding=false.

Slack

The required selection notification was attempted through the bundled secret-safe sender. No Slack channel is configured; #general returned channel_not_found. No credential was read or exposed.

FOLLOWING_AGENTS_PROTOCOL

Classify negative and compound CUDA-family preprocessor conditions by whether their arm is reachable in a portable build. Add RED-first mutations for direct, compound, and disjunctive guards without changing the binding DSR baseline.

FOLLOWING_AGENTS_PROTOCOL

Assisted-by: Codex:gpt-5 [Codex]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant