[BUG] A column with one infinity sums to NaN in `raft::stats::sum`

Aperta
#3,232 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@galleonli ci sta già lavorando.

Dal 28/11/2026.

  • #3233 di @galleonli — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
cpp
Ambito
data

Direzione di ricerca

Start in the raft::stats::sum implementation, which is identified by the reproducer’s raft/stats/sum.cuh include. Trace how partial sums and compensation are combined, then run the provided 32-float reproducer for positive infinity, negative infinity, and both signs. Done means single-sign infinity returns that infinity while mixed signs still return NaN; pull request #3233 is already open.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe the bug

Put one positive infinity in a column of 32 floats and fill the rest with ones. raft::stats::sum returns NaN. The same thing happens with a single negative infinity and with doubles.

Steps to reproduce

#include <raft/stats/sum.cuh>
#include <rmm/device_uvector.hpp>

#include <array>
#include <cstdio>
#include <limits>

int main()
{
  raft::resources handle;
  auto stream = raft::resource::get_cuda_stream(handle);
  std::array<float, 32> host;
  host.fill(1.0f);
  host[0] = std::numeric_limits<float>::infinity();

  rmm::device_uvector<float> x(host.size(), stream), y(1, stream);
  raft::update_device(x.data(), host.data(), host.size(), stream);
  raft::stats::sum(handle,
                   raft::make_device_matrix_view<const float, int, raft::row_major>(x.data(), 32, 1),
                   raft::make_device_vector_view(y.data(), 1));
  float result;
  raft::update_host(&result, y.data(), 1, stream);
  raft::resource::sync_stream(handle);
  std::printf("%g\n", double(result));
}

Expected behavior

The example should print inf. Changing the first entry to negative infinity should give -inf. A column that contains both signs of infinity should still give NaN.

Environment

RAFT main at b74966f, CUDA 12.9.1, GeForce GTX 1660 SUPER, driver 580.159.03. The example was compiled against the source headers with nvcc in the nvidia/cuda:12.9.1-devel-ubuntu24.04 image on Vast.ai.

Additional context

The running sum reaches infinity, then the compensation step subtracts infinity from itself and gets NaN. Adding that correction back changes the result. A local patch keeps the ordinary partial sum when it is already nonfinite. The same example prints inf with that patch.

Lingua principale
Cuda
Stelle
1.1k
Fork
260
Merge medio
1g 18h
PR unite (30g)
21

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di NVIDIA/raft

Tutte le issue di NVIDIA/raft

Issue simili

Altre issue su Data Engineering

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.