[BUG] illegal memory access due to negative offset in map_kernel on large array (1.8 billion elements)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- cpp
- Domain
- performance
Research direction
Start at cpp/include/raft/linalg/detail/map.cuh around line 56, where map_kernel checks that the offset is below the length. Reproduce the issue with a roughly 1.8-billion-element array under compute-sanitizer, then verify the kernel handles the negative-offset case without illegal GPU memory access.
Written by the indexing model from the issue text.
Description
Describe the bug
map_kernel multiplies the thread ID by 2, which causes integer overflow when the data size approaches INT_MAX. This results in negative array indexing, leading to illegal memory access errors on the GPU.
Steps/Code to reproduce bug
Run compute-sanitizer on code that involks the map_kernel on large array (e.g. 1.8 billion elements) in our case.
It seems an easy way to fix this is to check negative array index in the GPU kernel.
There is a checking already to ensure offset < len. Maybe also ensure offset >=0: https://github.com/rapidsai/raft/blob/cc165d9efc45962de90b15d1e29da849bb340ef9/cpp/include/raft/linalg/detail/map.cuh#L56
Expected behavior
1.8 billion is within range of int32.
Environment details (please complete the following information):
A100 GPU, 1.5TB CPU memory, rapids 25.04 environment.
- Dominant language
- Cuda
- Stars
- 1.1k
- Forks
- 260
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 21
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from NVIDIA/raft
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
[BUG] Half-precision gemm fails with CUBLAS_STATUS_NOT_SUPPORTED when A or B is not 16-byte alignedOpenbug
Difficulty 4/5 3-5 days Newbie friendliness 55/100
Maintainers usually reply within 1 day
-
[BUG] A column with one infinity sums to NaN in `raft::stats::sum`Possibly taken @galleonli claimed this 4 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 45/100
Maintainers usually reply within 1 day
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Maintainers usually reply within 1 day
-
[FEA] Return centers generated by raft::random::make_blobsPossibly taken @NIne-WIngEd claimed this 36 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 53/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
keystonejs/keystone#10143 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
area:server kind:perf priority:p2 ready
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Insertion pointOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
addyosmani/critical#636 ·
-
HXsetdir strdup leakOpen
Difficulty 1/5 1-3 hours Newbie friendliness 82/100