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

Đang mở
#3,050 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
20/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Lĩnh vực
backend, databases

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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:

  1. utils::memzero routes a pageable raft::host_vector through cudaMemsetAsync. This first fault was confirmed with instrumentation.
  2. GPU writes to managed allocations that the SDK creates itself (rmm::mr::managed_memory_resource in build_hierarchical; train_per_cluster uses the same pattern but is not on the default PER_SUBSPACE path we ran). The 700 surfaced at the first synchronization after build_clusters initialized 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 memzero calls, including the pageable 8,008-byte accum_sorted_sizes buffer (n_lists = 1000), completed with submit 0 and synchronize 0 at 46,530,560 B free. Class 1 did not fault here.
  • build_hierarchical then allocated its managed labels (2,000,000 B) and sizes (256 B). The labels initialization (map_offset) and sum_rows_by_key succeeded.
  • With a synchronization after every launch, the first 700 came from the k-means predict label write (raft::linalg::map with compose_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_WRITE at 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: the raft::cuda_error (cudaErrorIllegalAddress) reaches the caller in the host reproduction. On the GPU, an NDEBUG build of the application did not abort in 2 of 2 runs. The exception that reached it was an rmm::cuda_error (cudaErrorIllegalAddress) thrown inside the SDK by rmm::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, so memzero uses ::memset. This covers the reset first fault (host simulation).
  • #3016: removes the SDK-created managed resources in build_hierarchical, build_fine_clusters and train_per_cluster. Sizes and offsets move to the workspace resource. Labels, row ids and the per-mesocluster trainset move to large_workspace_resource. With the default large workspace this turns class 2 into device allocations that can fail with bad_alloc. With a managed large_workspace_resource the 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

  1. Confirm that #2933 + raft#3186 and #3016 are planned for 26.12, and whether a backport to 26.10 (and 26.04) is intended.
  2. Add a pressure regression test on an HMM system for ivf_pq::build and for cagra::build with 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.
  3. 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.
  4. If managed memory faulting with 700 under external occupancy (rather than evicting) is expected driver behavior, document that a managed large_workspace_resource needs 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.

Ngôn ngữ chính
Cuda
Star
902
Fork
267
Merge trung bình
2 ngày 21 giờ
Pull request đã merge (30 ngày)
57

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của NVIDIA/cuvs

Tất cả issue của NVIDIA/cuvs

Issue tương tự

Thêm issue về Backend & API Design

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.