Repository navigation
cutile: one CodegenMode for device debug, plus CUTILE_JIT_* run-time overrides - #1600
Open
almightychang wants to merge 2 commits into
Open
almightychang wants to merge 2 commits into
almightychang wants to merge 2 commits into
Conversation
…nMode
`tileiras` accepts `--device-debug` only at optimization level 0, but
`CompileOptions` kept the level and the debug flag as independent fields.
Debug builds default to full debug, so adding only `.opt_level(3)` produced
`--opt-level 3 --device-debug`, which `tileiras` rejects at JIT time.
Replace `opt_level`, `device_debug`, and `lineinfo` with
`codegen: CodegenMode`, where `Debug` owns level 0 and
`Optimized { level, lineinfo }` covers the rest. Every value now maps to
flags `tileiras` accepts. `debug_info()` and `opt_level()` select a mode,
and the last call wins. The level-0 default rule in
`TileirasOptions::from_compile_options` is gone, and the frontend reads the
same mode to decide check hoisting.
Remove the `device_debug(bool)` and `lineinfo(bool)` setters, which
`debug_info()` covers. The cache key and entry header bytes are unchanged
for every mode; a test pins them against the previous encoding.
Signed-off-by: almightychang (Sam, Joochul Chang) <[email protected]>
Nothing could switch an already-built application to a debug or sanitizer build without changing its code. Add three process-wide variables, read once per process: - CUTILE_JIT_DEBUG=none|line|full acts like `debug_info()` - CUTILE_JIT_OPT_LEVEL=0|1|2|3 acts like `opt_level()` - CUTILE_JIT_SANITIZE=memcheck|none acts like `sanitize_memcheck()` Each applies after the code's options, as if its setter were called last. `CompileOptions::with_jit_env_overrides()` applies them once before both compile stages, so the frontend's check placement and the `tileiras` flags always come from the same options. Invalid values, and full debug together with an explicit level, return a JIT error naming the variable. This continues NVlabs/cutile-rs#237, which applied the overrides only to the `tileiras` flags and left the frontend hoisting checks under `CUTILE_JIT_OPTIMIZATION=debug`. Signed-off-by: almightychang (Sam, Joochul Chang) <[email protected]>
Collaborator
|
Reviewing this against #1428. The setter/parser unit tests, subprocess full-debug test, previous-cache-encoding regression, and recorded real Two integration gaps to close:
For the debug-mode claim, retain a source-breakpoint/inline-backtrace smoke test on the produced full-debug cubin. This PR controls compilation mode; it should not be treated as the fix for #1379's trap attribution or #1476's inline-call breakpoint resolver. Once accepted, #1428 is the issue this PR should close; the other source-location audit items remain independent. |
This branch has not been deployed
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.
Continues NVlabs/cutile-rs#237, tracked in #1428.
Problem
tileirasaccepts--device-debugonly at--opt-level 0. That rule spans two fields, butCompileOptionsstores them independently, and each source writes them field by field:A field-by-field merge cannot keep a rule that spans two fields. Each writer would need its own copy of the "level 0 if debug" rule. Today the only copy, the default in
from_compile_options, applies only when no level is set. The resolved options can still hold the rejected pair, so the only real check istileirasitself, at JIT time, far from the setter that caused it.NVlabs/cutile-rs#285 made the build profile another writer. Dev-profile builds now start in full debug, so
CompileOptions::new().opt_level(3)alone fails at JIT time, while the same code passes with--release. The run-time overrides that NVlabs/cutile-rs#237 proposed would add a third writer and a third copy of the rule.Change
Make the rejected pair unrepresentable, and have each writer replace the whole value:
The rule is removed instead of copied. The run-time overrides then reduce to the same setters, applied after the code's:
CUTILE_JIT_DEBUGnone,line,fulldebug_info(...)CUTILE_JIT_OPT_LEVEL0–3opt_level(n)CUTILE_JIT_SANITIZEmemcheck,nonesanitize_memcheck(...)CUTILE_JIT_DEBUG=fulltogether withCUTILE_JIT_OPT_LEVEL, or an invalid value, fails with a JIT error that names the variable. The overrides are applied once before both compile stages, so the frontend andtileirassee the same mode. NVlabs/cutile-rs#237 applied them only to thetileirasflags.Behavior and API changes
opt_level(3)-O3 --device-debug, rejected-O3.debug_info(Full).opt_level(3)-O3 --device-debug, rejected-O3(last call wins).opt_level(3).debug_info(Full)-O3 --device-debug, rejected-O0 --device-debugdevice_debug(bool),lineinfo(bool)debug_info()covers themopt_level,device_debug,lineinfofieldscodegenCache key and entry-header bytes are unchanged for every mode; a test pins them against the previous encoding.
DebugInfoLevelanddebug_info()from NVlabs/cutile-rs#285 stay. I leftCHANGELOG.mdfor the maintainers.Validation
Local container from
nvidia/cuda:13.3.1-devel-ubuntu24.04with an RTX 5080 (driver 580, CUDA 13.0):cargo fmt -- --check;cargo clippy --workspace --exclude cuda-tile-rs --all-targets(only the existingrmsnorm.rsunused-unsafewarning)scripts/run_cpu_tests.shandscripts/run_gpu_tests.sh: all passedscripts/test_debug_defaults.sh: passedtileiras(CUTILE_TILEIRAS_PATH, empty disk cache) recorded the flags it received: