Skip to content

cubecl-cuda 0.10.0: deterministic reproduction of the stale-page panics from #1384 (Memory page N doesn't exist, CUDA 13.3) #1401

Description

@Lunasciel

PR #1384 (stale page index after ExclusiveMemoryPool::cleanup renumbers pages; the lookup panics on the dispatch worker) was closed as no longer reproducible.

I hit the same panics deterministically, every run, in a single process with no concurrent requests — a plain forward pass or greedy generation — where #1384 needed a batching server at concurrency ≥ 2.

8B model, during generation:

thread 'DSD-0-0' panicked at cubecl-cuda-0.10.0/src/compute/stream.rs:101:
called `Result::unwrap()` on an `Err` value:
couldn't find resource for that handle: Memory page 0 doesn't exist
WARN Task failed: Any { .. }

Sites (which of them fire is workload-dependent):

  • src/compute/stream.rs:101handle_cursorget_cursor(binding.memory.clone()).unwrap(): survivable (the cursor is cross-stream sync metadata), but fires ~3× per generated token; the unwind overhead drops throughput ~50–100×.
  • src/compute/server.rs:701command.resource(binding).expect("Resource to exist."): fatal, exit 101.
  • src/compute/server.rs:124command.reserve(size).unwrap() in initialize_memory: fatal; the reserve().unwrap() knock-on class that fix(memory): resolve stale page lookups instead of panicking #1384's A/B table counted 794×.

Environment:

  • RTX 4090 (24 GB), driver 610.43.02, CUDA 13.3, cudarc 0.19.8,
  • cubecl-cuda 0.10.0, burn 0.21.0, native bf16, fusion disabled,
  • Linux (Arch-based).

Trigger: a dense-transformer forward (36 layers, vocab = 151936, bf16) creating many short-lived device bindings under real pool pressure — layer-streamed weights (upload → matmul → drop, hidden = 2560) or a ~16 GB resident model (hidden = 4096) computing a chunked full-vocab logits projection (chunks up to n = 65536).

Ruled out: autotune (cache-warm run panics identically), max_streams = 1 (no effect), fusion (disabled), bf16 math (surviving runs produce numerically correct output).

An isolated binding-churn program (same pattern, 1280 uploads) does not reproduce it — the stale index seems to need cleanup renumbering under real pool pressure (~16 GB resident on a 24 GB card).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions