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

未关闭
#2,806 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
cpp, rust
领域
api

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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

主要语言
Cuda
星标
902
派生
267
平均合并
2 天 21 小时
30 天内合并 PR
57

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

NVIDIA/cuvs 的其他 Issue

查看 NVIDIA/cuvs 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。