[BUG] Rust DatasetView::new fails on padded rows: cuvsDatasetMakePaddedView only accepts packed rows

Aperta
#2,806 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Start with is_cagra_padded_layout in rust/cuvs/src/dataset.rs, which decides when DatasetView::new calls cuvsDatasetMakePaddedView, then read the packed-row check in c/src/core/detail/interop.hpp around line 99. Reproduce with a 3-column f32 tensor whose strides are [4, 1]. Done means either the padded path accepts that layout, matching the C++ make_device_padded_dataset_view, or DatasetView::new rejects it with a clear error and the docs say so. Pick the direction first, since it decides whether the change is in C or in Rust.

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

Descrizione

Describe the bug

DatasetView::new decides whether a tensor is padded by reading its row stride (is_cagra_padded_layout). A padded tensor goes to cuvsDatasetMakePaddedView. But that function only accepts packed rows, so a tensor with padded rows always fails:

Tensor DatasetView::new picks Result
4 f32 columns, packed padded view ✓
3 f32 columns, packed standard view ✓
3 f32 columns, rows padded to 4 (strides [4, 1]) padded view ✗ Expected a row-major matrix

Steps/Code to reproduce bug

let res = Resources::new().unwrap();
let mut data = std::ptr::null_mut();
unsafe { cudaMalloc(&mut data, 8 * 4 * size_of::<f32>()) };
let device = DLDevice { device_type: DLDeviceType::kDLCUDA, device_id: 0 };
// 8 rows of 3 columns, each row padded to 4 values.
let view = unsafe {
    DLTensorView::from_raw_parts(data, device, &[8, 3], Some(&[4, 1]), f32::dl_dtype())
}
.unwrap();
DatasetView::new(&res, &view).unwrap();
// RAFT failure at .../c/src/core/detail/interop.hpp line=99: Expected a row-major matrix

Expected behavior

Either cuvsDatasetMakePaddedView accepts padded rows, as the C++ make_device_padded_dataset_view does, or DatasetView::new rejects a strided tensor with a clear error and its docs say so.

Environment details

  • Bare-metal, RTX 1000 Ada
  • conda libcuvs 26.10.00a61 (CUDA 13.3); the code is unchanged at 24b0b170

Additional context

Might be related: #2482, #2394 (tracker #2402).

Generated with Claude Code Reviewed by Human

Lingua principale
Cuda
Stelle
902
Fork
267
Merge medio
2g 21h
PR unite (30g)
57

Preparare l'ambiente

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/cuvs

Tutte le issue di NVIDIA/cuvs

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.