[Autotuner] Add crash recovery bash script for unrecoverable CUDA errors#1921
Closed
yf225 wants to merge 1 commit intoyf225/stack/90from
Closed
[Autotuner] Add crash recovery bash script for unrecoverable CUDA errors#1921yf225 wants to merge 1 commit intoyf225/stack/90from
yf225 wants to merge 1 commit intoyf225/stack/90from
Conversation
yf225
added a commit
that referenced
this pull request
Apr 2, 2026
…ning Run the entire autotuner in a spawned subprocess. When the subprocess crashes due to an unrecoverable CUDA error (illegal memory access, misaligned address, etc.), the parent detects the crash, records the poison config in a _bad_configs.txt file, and respawns a new child that resumes from the latest checkpoint while skipping the bad config. Key components: - New settings: autotune_auto_recover_from_cuda_error (env var HELION_AUTOTUNE_AUTO_RECOVER_FROM_CUDA_ERROR) and autotune_subprocess_max_attempts (env var HELION_AUTOTUNE_SUBPROCESS_MAX_ATTEMPTS, default 10) - subprocess_runner.py: spawn-based subprocess worker, parent monitor loop with bounded retries, _pending_config.txt/_bad_configs.txt file I/O - Worker catches only TritonUnrecoverableRuntimeError (exits without writing result so parent recovers via pending file); other exceptions propagate naturally with traceback visible in stderr - benchmark_function() writes _pending_config.txt before each benchmark and clears it after; the file is only left behind on process crash - Bad config tracking uses Config.__str__() (sorted keys, deterministic) as the canonical config identity - Parent raises immediately on non-CUDA crashes (no pending file) and after exceeding max_attempts on CUDA crashes Requires autotune_checkpoint_dir to be set. The kernel function must be in an importable module (not __main__). stack-info: PR: #1921, branch: yf225/stack/91
yf225
added a commit
that referenced
this pull request
Apr 2, 2026
…ning Run the entire autotuner in a spawned subprocess. When the subprocess crashes due to an unrecoverable CUDA error (illegal memory access, misaligned address, etc.), the parent detects the crash, records the poison config in a _bad_configs.txt file, and respawns a new child that resumes from the latest checkpoint while skipping the bad config. Key components: - New settings: autotune_auto_recover_from_cuda_error (env var HELION_AUTOTUNE_AUTO_RECOVER_FROM_CUDA_ERROR) and autotune_subprocess_max_attempts (env var HELION_AUTOTUNE_SUBPROCESS_MAX_ATTEMPTS, default 10) - subprocess_runner.py: spawn-based subprocess worker, parent monitor loop with bounded retries, _pending_config.txt/_bad_configs.txt file I/O - Worker catches only TritonUnrecoverableRuntimeError (exits without writing result so parent recovers via pending file); other exceptions propagate naturally with traceback visible in stderr - benchmark_function() writes _pending_config.txt before each benchmark and clears it after; the file is only left behind on process crash - Bad config tracking uses Config.__str__() (sorted keys, deterministic) as the canonical config identity - Parent raises immediately on non-CUDA crashes (no pending file) and after exceeding max_attempts on CUDA crashes Requires autotune_checkpoint_dir to be set. The kernel function must be in an importable module (not __main__). stack-info: PR: #1921, branch: yf225/stack/91
yf225
added a commit
that referenced
this pull request
Apr 2, 2026
Add scripts/autotune_with_crash_recovery.sh — a bash wrapper that
automatically recovers from CUDA errors (illegal memory access,
misaligned address, etc.) that poison the GPU context and kill the
autotuning process.
How it works:
- Before each benchmark, the autotuner writes the current config to a
pending file (_pending_config.txt) in the checkpoint directory
- If a CUDA error kills the process, the pending file survives on disk
- The bash script detects it, appends the poison config to
_bad_configs.txt, and re-launches the command from scratch
- On re-launch, the autotuner loads its checkpoint + bad configs list,
skips the poison config, and continues searching
Usage:
scripts/autotune_with_crash_recovery.sh \
--checkpoint-dir /tmp/ckpt -- python train.py
stack-info: PR: #1921, branch: yf225/stack/91
yf225
added a commit
that referenced
this pull request
Apr 2, 2026
Add scripts/autotune_with_crash_recovery.sh — a bash wrapper that
automatically recovers from CUDA errors (illegal memory access,
misaligned address, etc.) that poison the GPU context and kill the
autotuning process.
How it works:
- Before each benchmark, the autotuner writes the current config to a
pending file (_pending_config.txt) in the checkpoint directory
- If a CUDA error kills the process, the pending file survives on disk
- The bash script detects it, appends the poison config to
_bad_configs.txt, and re-launches the command from scratch
- On re-launch, the autotuner loads its checkpoint + bad configs list,
skips the poison config, and continues searching
Usage:
scripts/autotune_with_crash_recovery.sh \
--checkpoint-dir /tmp/ckpt -- python train.py
stack-info: PR: #1921, branch: yf225/stack/91
yf225
added a commit
that referenced
this pull request
Apr 2, 2026
Add scripts/autotune_with_crash_recovery.sh — a bash wrapper that
automatically recovers from CUDA errors (illegal memory access,
misaligned address, etc.) that poison the GPU context and kill the
autotuning process.
How it works:
- Before each benchmark, the autotuner writes the current config to a
pending file (_pending_config.txt) in the checkpoint directory
- If a CUDA error kills the process, the pending file survives on disk
- The bash script detects it, appends the poison config to
_bad_configs.txt, and re-launches the command from scratch
- On re-launch, the autotuner loads its checkpoint + bad configs list,
skips the poison config, and continues searching
Usage:
scripts/autotune_with_crash_recovery.sh \
--checkpoint-dir /tmp/ckpt -- python train.py
stack-info: PR: #1921, branch: yf225/stack/91
yf225
added a commit
that referenced
this pull request
Apr 2, 2026
Add scripts/autotune_with_crash_recovery.sh — a bash wrapper that
automatically recovers from CUDA errors (illegal memory access,
misaligned address, etc.) that poison the GPU context and kill the
autotuning process.
How it works:
- Before each benchmark, the autotuner writes the current config to a
pending file (_pending_config.txt) in the checkpoint directory
- If a CUDA error kills the process, the pending file survives on disk
- The bash script detects it, appends the poison config to
_bad_configs.txt, and re-launches the command from scratch
- On re-launch, the autotuner loads its checkpoint + bad configs list,
skips the poison config, and continues searching
Usage:
scripts/autotune_with_crash_recovery.sh \
--checkpoint-dir /tmp/ckpt -- python train.py
stack-info: PR: #1921, branch: yf225/stack/91
yf225
added a commit
that referenced
this pull request
Apr 2, 2026
Add scripts/autotune_with_crash_recovery.sh — a bash wrapper that
automatically recovers from CUDA errors (illegal memory access,
misaligned address, etc.) that poison the GPU context and kill the
autotuning process.
How it works:
- Before each benchmark, the autotuner writes the current config to a
pending file (_pending_config.txt) in the checkpoint directory
- If a CUDA error kills the process, the pending file survives on disk
- The bash script detects it, appends the poison config to
_bad_configs.txt, and re-launches the command from scratch
- On re-launch, the autotuner loads its checkpoint + bad configs list,
skips the poison config, and continues searching
Usage:
scripts/autotune_with_crash_recovery.sh \
--checkpoint-dir /tmp/ckpt -- python train.py
stack-info: PR: #1921, branch: yf225/stack/91
yf225
added a commit
that referenced
this pull request
Apr 2, 2026
Add scripts/autotune_with_crash_recovery.sh — a bash wrapper that
automatically recovers from CUDA errors (illegal memory access,
misaligned address, etc.) that poison the GPU context and kill the
autotuning process.
How it works:
- Before each benchmark, the autotuner writes the current config to a
pending file (_pending_config.txt) in the checkpoint directory
- If a CUDA error kills the process, the pending file survives on disk
- The bash script detects it, appends the poison config to
_bad_configs.txt, and re-launches the command from scratch
- On re-launch, the autotuner loads its checkpoint + bad configs list,
skips the poison config, and continues searching
Usage:
scripts/autotune_with_crash_recovery.sh \
--checkpoint-dir /tmp/ckpt -- python train.py
stack-info: PR: #1921, branch: yf225/stack/91
yf225
added a commit
that referenced
this pull request
Apr 2, 2026
Add scripts/autotune_with_crash_recovery.sh — a bash wrapper that
automatically recovers from CUDA errors (illegal memory access,
misaligned address, etc.) that poison the GPU context and kill the
autotuning process.
How it works:
- Before each benchmark, the autotuner writes the current config to a
pending file (_pending_config.txt) in the checkpoint directory
- If a CUDA error kills the process, the pending file survives on disk
- The bash script detects it, appends the poison config to
_bad_configs.txt, and re-launches the command from scratch
- On re-launch, the autotuner loads its checkpoint + bad configs list,
skips the poison config, and continues searching
Usage:
scripts/autotune_with_crash_recovery.sh \
--checkpoint-dir /tmp/ckpt -- python train.py
stack-info: PR: #1921, branch: yf225/stack/91
yf225
added a commit
that referenced
this pull request
Apr 2, 2026
Add scripts/autotune_with_crash_recovery.sh — a bash wrapper that
automatically recovers from CUDA errors (illegal memory access,
misaligned address, etc.) that poison the GPU context and kill the
autotuning process.
How it works:
- Before each benchmark, the autotuner writes the current config to a
pending file (_pending_config.txt) in the checkpoint directory
- If a CUDA error kills the process, the pending file survives on disk
- The bash script detects it, appends the poison config to
_bad_configs.txt, and re-launches the command from scratch
- On re-launch, the autotuner loads its checkpoint + bad configs list,
skips the poison config, and continues searching
Usage:
scripts/autotune_with_crash_recovery.sh \
--checkpoint-dir /tmp/ckpt -- python train.py
stack-info: PR: #1921, branch: yf225/stack/91
yf225
added a commit
that referenced
this pull request
Apr 2, 2026
Add scripts/autotune_with_crash_recovery.sh — a bash wrapper that
automatically recovers from CUDA errors (illegal memory access,
misaligned address, etc.) that poison the GPU context and kill the
autotuning process.
How it works:
- Before each benchmark, the autotuner writes the current config to a
pending file (_pending_config.txt) in the checkpoint directory
- If a CUDA error kills the process, the pending file survives on disk
- The bash script detects it, appends the poison config to
_bad_configs.txt, and re-launches the command from scratch
- On re-launch, the autotuner loads its checkpoint + bad configs list,
skips the poison config, and continues searching
Usage:
scripts/autotune_with_crash_recovery.sh \
--checkpoint-dir /tmp/ckpt -- python train.py
stack-info: PR: #1921, branch: yf225/stack/91
Add scripts/autotune_with_crash_recovery.sh — a bash wrapper that
automatically recovers from CUDA errors (illegal memory access,
misaligned address, etc.) that poison the GPU context and kill the
autotuning process.
How it works:
- Before each benchmark, the autotuner writes the current config to a
pending file (_pending_config.txt) in the checkpoint directory
- If a CUDA error kills the process, the pending file survives on disk
- The bash script detects it, appends the poison config to
_bad_configs.txt, and re-launches the command from scratch
- On re-launch, the autotuner loads its checkpoint + bad configs list,
skips the poison config, and continues searching
Usage:
scripts/autotune_with_crash_recovery.sh \
--checkpoint-dir /tmp/ckpt -- python train.py
stack-info: PR: #1921, branch: yf225/stack/91
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.
Stacked PRs:
[Autotuner] Add crash recovery bash script for unrecoverable CUDA errors
Add scripts/autotune_with_crash_recovery.sh — a bash wrapper that
automatically recovers from CUDA errors (illegal memory access,
misaligned address, etc.) that poison the GPU context and kill the
autotuning process.
How it works:
pending file (_pending_config.txt) in the checkpoint directory
_bad_configs.txt, and re-launches the command from scratch
skips the poison config, and continues searching
Usage:
scripts/autotune_with_crash_recovery.sh
--checkpoint-dir /tmp/ckpt -- python train.py