Debugging the async traceback without CUDA_LAUNCH_BLOCKING=1
Without synchronous execution, the traceback points at whichever collective or .item() synced next.
Operator task guide
CUDA error 700 (cudaErrorIllegalAddress: an illegal memory access was encountered) and device-side assert triggered are asynchronous kernel faults: the Python traceback almost always points to a later synchronization line rather than the kernel that broke. Always re-run a minimal reproducer with CUDA_LAUNCH_BLOCKING=1 first.
For device-side asserts, check embedding token IDs and classification target labels (such as negative labels other than ignore_index -100, or token IDs >= vocab_size). For illegal memory access in custom or attention kernels, run compute-sanitizer --tool memcheck and inspect host dmesg for concurrent Xid 31/48/79 events.
Reviewed . Reference guidance is not a diagnosis of your workload.
Set CUDA_LAUNCH_BLOCKING=1 (and TORCH_USE_CUDA_DSA=1 if your PyTorch build supports device-side assertions) so the traceback stops at the exact offending op.
CUDA_LAUNCH_BLOCKING=1 TORCH_USE_CUDA_DSA=1 python3 train.pyDevice-side asserts in Embedding or CrossEntropyLoss happen when input_ids >= vocab_size, input_ids < 0, or labels sit outside [0, num_classes - 1] without matching ignore_index.
python3 -c "# Validate batch bounds in your dataloader check:
# assert input_ids.min() >= 0 and input_ids.max() < model.config.vocab_size"When CUDA_LAUNCH_BLOCKING=1 still points to an illegal memory access inside a fused attention, LoRA, or C++ extension kernel, run compute-sanitizer --tool memcheck on a 1-step minimal reproducer.
compute-sanitizer --tool memcheck --show-backtrace=device python3 minimal_repro.pyCheck dmesg for simultaneous Xid 31, 48, 79, or 95 errors. For Expected all tensors to be on the same device errors, register persistent buffers with register_buffer() and avoid mixing CPU index tensors with CUDA tensors unintentionally.
dmesg -T | grep -iE 'NVRM: Xid|ECC'| Signal | What it means | Next action |
|---|---|---|
| device-side assert inside Embedding or NLLLoss/CrossEntropy | Out-of-range token ID or target class label. | Assert input_ids < vocab_size and verify resize_token_embeddings matches tokenizer. |
| CUDA error 700 / illegal memory access in custom or attention kernel | Out-of-bounds pointer, bad stride, or corrupted workspace. | Run compute-sanitizer --tool memcheck and check FlashAttention/Triton versions. |
| Expected all tensors to be on the same device | Operand, mask, or restored optimizer tensor remains on CPU or wrong rank. | Use register_buffer() and move batch/optimizer tensors to local rank device. |
| Illegal memory access coincides with Xid 48/79/94/95 in dmesg | Device memory or link hardware error poisoned GPU state. | Preserve UUID/dmesg and drain GPU for hardware diagnostics. |
Without synchronous execution, the traceback points at whichever collective or .item() synced next.
Adding pad/chat tokens bumps tokenizer IDs past embedding table rows and triggers immediate device-side asserts.
Hardware ECC or PCIe faults can surface as illegal address errors; always verify dmesg.
Isolate bad kernel pointers and memory bounds.
Fix embedding and loss index-out-of-bounds triggers.
Run memcheck, racecheck, and initcheck cleanly.
Resolve indices and tensor placement mismatches.
Error code 700 in the CUDA runtime/driver enum is cudaErrorIllegalAddress (an illegal memory access was encountered), meaning a GPU kernel read or wrote invalid memory and poisoned the CUDA context.
PyTorch embedding layers and loss functions assert inside CUDA kernels that indices fall within valid vocabulary or class bounds. Adding chat/special tokens without resizing model embeddings is a frequent cause.
No. Once an illegal memory access occurs, the CUDA context is corrupted until the OS process exits and restarts.
Inspect operands at the failing line, register non-parameter tensors with self.register_buffer(), and confirm multi-GPU ranks move inputs to torch.device("cuda", local_rank).
Get the likely cause, supporting evidence, and next safe steps with the same cloud reasoning used by paid plans. A crash the engine recognizes is answered in seconds, then checked by an independent AI review that updates this page when it finishes. A crash it does not recognize waits for the AI's own answer, which can take a few minutes. No account, card, or installation. Logs are masked at Denpex API ingress and are not saved to account history.
Before uploading, review cloud data handling and local options.
Upload your log file. Large files are processed in your browser. Only selected evidence is submitted when you run diagnosis.
No credit card. No automatic subscription. See whether Denpex helps with an incident you already understand.
Up to 50 diagnoses a day for 30 days. Verify your work email to activate an eligible company evaluation, then replay a resolved incident and compare the evidence and next steps with your team's confirmed cause.
Use the three free diagnoses to review your error and relevant evidence. Keep reference guidance separate from the cause and recovery status of your own workload.
Diagnose your incident