Skip to content

fix(cutile): retain source origins for generated code and host checks - #1602

Merged
elibol merged 2 commits into
NVIDIA:mainfrom
elibol:fix/cutile-generated-source-provenance
Oct 22, 2026
Merged

elibol merged 2 commits into
NVIDIA:mainfrom
elibol:fix/cutile-generated-source-provenance

Conversation

@elibol

@elibol elibol commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Generated const-generic arrays and reduction bodies can point at the module header, and checks relocated to the host lose the original access and inline caller locations. Preserve those origins through compilation and show every distinct protected access when a shared launch check fails.

Part of #1475:

  • Attribute const-generic array materialization to the original signature for entry kernels, inlined functions, and inlined methods.
  • Attribute generated reduction-region operations to the reduction call, retaining its inline chain.
  • Deduplicate host checks by canonical predicate while retaining all distinct source origins internally in the compiler. Render the origins into the existing LaunchCheck.cause diagnostic at export, through the same path for KernelCompiler and the runtime validator. The public shared-host API, crate versions, dependencies, and check-evaluation behavior are unchanged.
  • Add exact source-file/line/caller-chain regressions for arrays, reductions, in-place/hoisted checks, loop/user assumptions, and deduplicated host errors. Device-check placement and assumption provenance already work on main; these cases protect that behavior.

Other claimed frontend work stays with #1385 (generated-constant fallback), #1480 (entry wrappers), and #1528 (short-circuit/folded expressions). This does not close the full audit. Actual assertion SIGTRAP/coredump attribution remains a Tile IR backend issue under #1379; caller-line breakpoint resolution belongs to NVIDIA/cuda-gdb#29 / #1476.

Validation on 825de3e38:

  • Both CI-equivalent semver commands pass for the host and Tile workspaces; no version update is required. Existing two-field LaunchCheck struct literals remain valid.
  • All CPU/assembler tests pass. Two new collection tests cover distinct/repeated/unknown origins, unchanged predicates and causes, and repeatable export.
  • All six source-location regressions pass, including real assembler/disassembler checks. They cover Line and Full modes, and host diagnostics additionally cover None. The array, reduction-region, and host-error cases fail on unchanged main (e027ac324).
  • All nine debug-info tests pass, including live CUDA-GDB, actual kernel execution, and cubin inspection. The GPU launch_checks_are_enforced_at_launch regression also passes.
  • Strict Clippy for the compiler library/tests and cuTile library/new test, root/Tile formatting, SPDX, and whitespace checks pass.

The earlier full-suite run on 89a3d688d passed CPU checks, 27 examples (one capability skip), and eight benchmark smoke tests. The GPU suite encountered the existing warmup-cache ordering failure documented in #1480; all 16 warmup tests passed serially. Benchmark validation supplied --features smoke-test because the existing runner drops its bare smoke-test argument. No runner changes are included.

Backend limitation: full-debug tileiras 13.3 coalesces one adjacent reduction source-line entry despite correct frontend metadata; all four call lines survive optimized line-info assembly. This change preserves frontend provenance and does not claim complete backend stepping accuracy.

Signed-off-by: Melih Elibol <1884921+elibol@users.noreply.github.com>
@elibol

elibol commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

CI follow-up for the v0.5.0 candidate: the CUDA 13.2/13.4 Tile lanes, shared-host tests, and other functional checks passed, but semver-checks correctly rejects the new public LaunchCheck.origins field: existing downstream struct literals no longer compile while cuda-async is still version 0.4.0.

The compatibility change is documented in the PR, but that does not satisfy the version gate. Before merging, this needs either the coordinated v0.5.0 shared-host crate version/dependency updates or an API-compatible representation. Keep the semver check enabled. Failure details: https://github.com/NVIDIA/cuda-rust/actions/runs/39655891846/job/119416778266

Signed-off-by: Melih Elibol <1884921+elibol@users.noreply.github.com>
@elibol

elibol commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator Author

Fixed the semver failure in 825de3e. Source frames now stay private to the compiler and are rendered into the existing LaunchCheck.cause string when checks are exported. LaunchCheck and the shared runtime are back to their original public API; no version bump or semver exemption is needed.

Validation: host and Tile semver suites pass; the CPU/assembler suite, two new collection tests, all six source-location regressions, all nine debug-info tests (including live CUDA-GDB), and the GPU host-check enforcement regression pass. Strict Clippy, formatting, SPDX, and whitespace checks pass. All build/test/semver CI jobs have now passed on this commit, including CUDA 13.2/13.4 and shared-host/reactor checks. Rust CodeQL also passed (verified 2026-10-22); all applicable CI checks are green.

Self-review completed:

  • Confirmed canonical predicates and one-comparison deduplication are unchanged, while distinct inline callers remain in diagnostics. Repeated export does not append duplicate origins; missing source data preserves the original cause.
  • Confirmed both standalone compilation and normal launches export through the same method after compilation, before the compiler is dropped. Runtime predicate evaluation is unchanged.
  • Checked that source-location guards end before ordinary user code resumes and retain the outer inline chain.
  • Tightened the array and reduction tests to verify the source file and reduction caller chain explicitly. No remaining correctness findings from this review. The backend trap/coredump issue remains outside this PR.

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