IVF-PQ build, including CAGRA's default graph-build fallback, can turn device-memory exhaustion on HMM systems into a sticky `cudaErrorIllegalAddress`: request for #2933/raft#3186 and #3016 release/backport guidance and a pressure regression test
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 20/100
Direzione di ricerca
Start by reviewing #2933, raft#3186, and #3016, then trace the IVF-PQ build path through ivf_pq_build.cuh, kmeans_balanced.cuh, and the workspace resource configuration. The report identifies pageable and managed memory GPU accesses under external device-memory pressure; reproduce these on an HMM system with the attached reduction and compare IVF-PQ with default CAGRA builds. Done means pressure causes a recoverable allocation error and a subsequent allocation and kernel still succeed, including with a managed workspace.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
On HMM-enabled A100 systems (cudaDevAttrPageableMemoryAccess=1, cudaDevAttrPageableMemoryAccessUsesHostPageTables=0), when another process holds nearly all device memory, a v26.04-based IVF-PQ build can access non-device memory from the GPU and fail with CUDA error 700 instead of a recoverable allocation error. Error 700 is sticky, so the process must restart.
Two access classes were identified with v26.04 on driver 580.126.09:
utils::memzeroroutes a pageableraft::host_vectorthroughcudaMemsetAsync. This first fault was confirmed with instrumentation.- GPU writes to managed allocations that the SDK creates itself (
rmm::mr::managed_memory_resourceinbuild_hierarchical;train_per_clusteruses the same pattern but is not on the defaultPER_SUBSPACEpath we ran). The 700 surfaced at the first synchronization afterbuild_clustersinitialized the managed labels, so we attribute it to that write by ordering rather than by a captured fault address.
On driver 595.99.02, the default CAGRA path below faulted in class 2 (instrumented: Xid 31 write fault inside the SDK-created managed labels buffer). Class 1, the pageable reset memset, did not fault at 46,530,560 B free. The class 2 fault came after a 40,388,608 B pool growth had left 2,490,368 B free, so the two classes were not compared at the same free memory.
CAGRA's default graph_build_params (std::monostate) makes this reachable without explicitly selecting IVF-PQ. nn_descent::has_enough_device_memory catches the bad_alloc from its first N × D × sizeof(half) probe allocation and selects IVF-PQ exactly when device memory is scarce.
main contains #2933 (with raft#3186), which addresses class 1 on HMM systems, and #3016, which removes the SDK-created managed resources. After #3016 the k-means labels and row-id buffers come from large_workspace_resource, so class 2 goes away only when that resource is device memory (the default). It remains when an application installs a managed large_workspace_resource, as ivf_pq_build.cuh suggests for scaling. Both changes are on release/26.12, and neither is in v26.10.00. We have not run the corrected code on a GPU.
Versions
| Version | Commit | Status |
|---|---|---|
| v26.04.00 | 60b19a0f62ba0bd716de349382828e43be6e2daa |
Observations A and B (downstream builds with patches to HNSW and to CAGRA's ACE path. For B, the AUTO heuristic, NN-descent probe, IVF-PQ build, ann_utils.cuh and kmeans_balanced.cuh sources are byte-identical to the tag. A used an earlier build of the same patch series.) |
| v26.10.00 | 24ee1bf1cb17cad0ac611e39643af39ee1870124 |
Source: pre-#2933 classification; direct managed resource present in kmeans_balanced.cuh and ivf_pq_build.cuh. Not GPU tested |
| release/26.12 | 485ffcfd2a30a8b66b71eabf744cd124113eab47 (2026-11-12) |
Source: contains #2933 (825e7438) and #3016 (4e698ee2); raft release/26.12 contains raft#3186 (c6007cd9). Not GPU tested |
Observation A: instrumented (driver 580.126.09)
Setup: cagra::build with IVF-PQ graph-build parameters (ivf_pq_params(dataset.extents()): 50,000 × 128 FP32, 25 lists) while an external process held device memory with cudaMalloc (1,441,792 B free). The first fault was the first of four reset memzero calls, on the 208-byte host accum_sorted_sizes buffer (cudaMemoryTypeUnregistered, hostPointer == devicePointer). The memset submit returned 0, and synchronization returned 700.
In a run where only the host pointers were given CPU preferred-location advice (5,636,096 B free), the four reset memsets passed. build_hierarchical then allocated its managed labels and sizes (200,000 B and 40 B), build_clusters initialized the labels with map_offset, and the next synchronization, after a 2,560-byte memset of the device-resident mesocluster centers, returned 700. The memset target was device memory, so we attribute the fault to the managed-labels write. Only applying both host advice and prefer-host for the SDK's managed temporaries let the build complete.
Standalone reduction (attached hmm_pressure.cu, 41 lines, SHA256 23438e88…, compiled and executed on that GPU; 208 bytes, cudaMemsetAsync then cudaDeviceSynchronize):
| Allocation | Free bytes | submit | sync |
|---|---|---|---|
malloc |
983,040 | 0 | 700 |
malloc, no pressure |
84,648,329,216 | 0 | 0 |
malloc + PreferredLocation=CPU + AccessedBy=0 |
5,177,344 / 7,274,496 | 0 | 0 |
cudaMalloc |
983,040 | 0 | 0 |
cudaHostAlloc (mapped) |
983,040 | 0 | 0 |
cudaMallocManaged |
7,274,496 | 0 | 700 |
cudaMallocManaged + PreferredLocation=CPU |
983,040 / 5,177,344 | 0 | 0 |
A separate reduction that writes managed labels from a kernel failed at synchronization with 700 in four runs at 983,040 B free (labels allocated before or after the holder, a 2 MiB leave target, or first touched on the host). It succeeded at 7,274,496 B free and above. The 208-byte managed memset in the table failed at the same 7,274,496 B, so we cannot state a single free-memory threshold.
Observation B: reachability through CAGRA defaults (driver 595.99.02)
Setup: cagra::build, 2,000,000 × 256 FP32 device dataset, L2, default graph-build parameters. After our admission check passed, the test harness paused the process with SIGSTOP, ramped an external cudaMalloc holder to 95.8% of device memory (46,530,560 B free), and resumed the process with SIGCONT about 60 s later. The dataset upload and a reduction over it completed after the resume, before the probe. The log shows:
[error ] [A][Stream …][Upstream 1024000000B][FAILURE maximum pool size exceeded: std::bad_alloc: out_of_memory: CUDA error (failed to allocate 1024000000 bytes) at: …/rmm/mr/cuda_memory_resource.hpp:51: cudaErrorMemoryAllocation out of memory]
CUDA Error detected. cudaErrorIllegalAddress an illegal memory access was encountered
…/rmm/mr/detail/stream_ordered_memory_resource.hpp:290: … get_event(rmm::cuda_stream_view) …: Assertion `status__ == cudaSuccess' failed.
The first line is the NN-descent probe's first allocation (2,000,000 × 256 × sizeof(half) = 1,024,000,000 B). With std::monostate the probe must run, the allocation cannot fit in 46 MB, and this is the only pool-growth failure in the log. The cudaMalloc behind it returned cudaErrorMemoryAllocation rather than a sticky error, and the preceding reduction had already been read back, so no sticky error existed at that point. Error 700 surfaced less than 0.65 s later (the client saw the connection reset at 02:31:30.778 UTC). By code order, the GPU work issued after the probe belongs to the IVF-PQ graph build.
We then reran the same scenario on the same instance type and driver with instrumentation (allocation and launch tracing, dmesg Xid capture, /proc/<pid>/maps). The 700 reproduced in all 9 runs: 3 traced, 2 traced with a synchronization after every launch, 2 untraced, and 2 untraced with an NDEBUG build. Each run logged exactly one Xid 31 write fault, always inside a 2 MiB /dev/nvidia-uvm (managed) mapping created after the resume. In the 5 traced runs that mapping was the labels allocation:
- The four reset
memzerocalls, including the pageable 8,008-byteaccum_sorted_sizesbuffer (n_lists = 1000), completed with submit 0 and synchronize 0 at 46,530,560 B free. Class 1 did not fault here. build_hierarchicalthen allocated its managed labels (2,000,000 B) and sizes (256 B). The labels initialization (map_offset) andsum_rows_by_keysucceeded.- With a synchronization after every launch, the first 700 came from the k-means
predictlabel write (raft::linalg::mapwithcompose_op<cast_op<uint32_t>, key_op>), 335 and 374 ms after launch in the two runs. The preceding fused distance kernel synchronized with 0. - In all five traced runs the kernel log showed Xid 31
FAULT_PDE ACCESS_TYPE_VIRT_WRITEat an address inside that 2,000,000-byte managed labels allocation (offset 0 or 0x1000; the allocation was made about 0.3 s after the process resumed).
We have not explained why the earlier write to the same managed buffer succeeded while the later predict write faulted; the external holder kept retrying 64 MiB cudaMalloc calls every 20 ms, which may have caused migration or eviction, but we did not verify that.
Why the process aborted rather than threw
The abort is RMM_ASSERT_CUDA_SUCCESS(cudaStreamGetId(...)) in get_event. It is active because the application compiled RMM's header templates without NDEBUG. A host-only reproduction ran RMM v26.04.00 sources (logger replaced by a printf shim) against a simulated runtime that reports a sticky 700:
- Without
NDEBUG: the same assertion fires when a pool block is returned while the exception unwinds. - With
NDEBUG: theraft::cuda_error(cudaErrorIllegalAddress) reaches the caller in the host reproduction. On the GPU, anNDEBUGbuild of the application did not abort in 2 of 2 runs. The exception that reached it was anrmm::cuda_error(cudaErrorIllegalAddress) thrown inside the SDK byrmm::device_uvector::element()(rmm/device_uvector.hpp:302).
Either way, the context is unusable afterwards. In a separate GPU test that triggered a 700 with an invalid-address kernel, cudaGetLastError returned 700 once after a failing call and then 0, while cudaStreamQuery, cudaStreamSynchronize, cudaMemGetInfo, cudaMalloc and cudaStreamGetId kept returning 700. Without a prior synchronization, cudaGetLastError still returned 0 200 ms after the faulting kernel, and cudaStreamQuery returned cudaErrorNotReady; the first 700 came from cudaStreamSynchronize. We do not consider this an RMM defect; the request is to avoid the 700.
Relationship to merged changes
- #2933 + raft#3186: pageable memory on HMM is classified
memory_type::host, somemzerouses::memset. This covers the reset first fault (host simulation). - #3016: removes the SDK-created managed resources in
build_hierarchical,build_fine_clustersandtrain_per_cluster. Sizes and offsets move to the workspace resource. Labels, row ids and the per-mesocluster trainset move tolarge_workspace_resource. With the default large workspace this turns class 2 into device allocations that can fail withbad_alloc. With a managedlarge_workspace_resourcethe GPU still writes managed memory (inference from source; not GPU tested). - #3029: affects only the HNSW typed copy and is unrelated.
Expected behavior
Under external device-memory exhaustion, IVF-PQ and CAGRA builds should fail with std::bad_alloc/rmm::out_of_memory, or a cuda_error carrying cudaErrorMemoryAllocation, and leave the context usable. They should not issue GPU accesses to pageable or SDK-created managed memory that can end in a sticky 700.
Requests
- Confirm that #2933 + raft#3186 and #3016 are planned for 26.12, and whether a backport to 26.10 (and 26.04) is intended.
- Add a pressure regression test on an HMM system for
ivf_pq::buildand forcagra::buildwith default graph parameters, while an external process holds nearly all device memory. Assert that failure surfaces as an allocation exception and that a subsequent small allocation and kernel succeed. Include ATS, pinned, managed, and device controls. - After #3016, audit the remaining GPU accesses to pageable or managed memory in the IVF-PQ build path, including a user-provided managed
large_workspace_resource. - If managed memory faulting with 700 under external occupancy (rather than evicting) is expected driver behavior, document that a managed
large_workspace_resourceneeds CPU preferred-location advice under pressure.
Reproduction material
We can share the 41-line GPU reduction (hmm_pressure.cu) and a host-only RMM reproduction on request. The host-only reproduction is explicitly not a GPU reproduction: it runs RMM v26.04.00 sources against a simulated CUDA runtime. Its assumption that cudaGetLastError keeps returning a sticky error does not match what we measured on the GPU (reported once, then 0), so it only illustrates the abort path, not error detection.
- Lingua principale
- Cuda
- Stelle
- 902
- Fork
- 267
- Merge medio
- 2g 21h
- PR unite (30g)
- 57
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di NVIDIA/cuvs
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
[BUG] CAGRA multi-CTA and multi-kernel search over-allocate the hashmap they useForse già presa @mc8max l’ha presa 12 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
NVIDIA/cuvs#2856 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] cuVS Bench Faiss CAGRA b_ratio reads the wrong JSON keyForse già presa @arcusbuilds l’ha presa 55 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
doc
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Upgrade faiss to v1.16.0Forse già presa @aamijar l’ha presa 8 giorni fa. Apertafaiss improvement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
vllm-project/vllm#70030 ·
I maintainer di solito rispondono entro 1 giorno
-
help wanted small extra
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
t: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 3 giorni
-
Retry an empty final answer when Gemini reports MALFORMED_RESPONSE (gemini-4-hydrogen)Forse già presa @waleedkadous l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
iaser-ai/ansari#444 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno