Skip to content

Commit 03c3e13

Browse files
committed
docs
Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
1 parent 76bb74b commit 03c3e13

4 files changed

Lines changed: 12 additions & 25 deletions

File tree

vortex-cuda/cub/src/scan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

4-
//! Safe wrappers around CUB DeviceScan operations used by CUDA kernels.
4+
//! Rust wrappers around CUB DeviceScan operations used by CUDA kernels.
55
66
use std::ffi::c_void;
77

vortex-cuda/src/arrow/canonical.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,19 +162,15 @@ fn export_canonical(
162162
export_fixed_size(bits, len, offset, validity_buffer, null_count, ctx)
163163
}
164164
Canonical::List(listview) => {
165-
// cuDF expects standard Arrow `List`, while Vortex canonical lists are list-views.
166-
// Try the CUDA path first, copying host metadata/children to GPU as needed. If a
167-
// host list-view hits a GPU implementation gap, rebuild it to `ListArray` on CPU;
168-
// `export_list` still exports the rebuilt Arrow layout back to GPU buffers.
165+
// cuDF imports standard Arrow `List`, while Vortex canonical lists are list-views.
166+
// Try the GPU path first; host list-views can fall back to a CPU rebuild.
169167
let is_host = listview.as_ref().is_host();
170168
let gpu_err = match export_device_list_view(listview.clone(), ctx).await {
171169
Ok(exported) => return Ok(exported),
172170
Err(err) => err,
173171
};
174172

175-
// The fallback calls the CPU list-view rebuild, which requires host-resident
176-
// buffers. Device-resident fallback would need an explicit D2H materialization
177-
// step; until then, preserve the original GPU export error.
173+
// CPU rebuild requires host-resident buffers; device-resident arrays keep the GPU error.
178174
if !is_host {
179175
return Err(gpu_err);
180176
}
@@ -328,9 +324,8 @@ pub(super) async fn export_list_layout(
328324

329325
/// Export a Vortex fixed-size-list as Arrow `List`.
330326
///
331-
/// Arrow has a native `FixedSizeList` layout, but cuDF's Arrow Device import currently maps Arrow
332-
/// `List`/`LargeList` to cuDF `LIST` and rejects `FixedSizeList`. Emit equivalent standard Arrow
333-
/// `List` offsets so fixed-size-list columns can be consumed by cuDF.
327+
/// cuDF's Arrow Device import accepts `List`/`LargeList` as cuDF `LIST`, but rejects
328+
/// `FixedSizeList`, so emit equivalent standard Arrow `List` offsets.
334329
async fn export_fixed_size_list(
335330
array: FixedSizeListArray,
336331
ctx: &mut CudaExecutionCtx,

vortex-cuda/src/arrow/list_view.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use crate::CudaExecutionCtx;
3535
use crate::cub::exclusive_sum_i32;
3636
use crate::executor::CudaArrayExt;
3737

38-
/// Export a device-resident Vortex list-view as Arrow `List` without staging offsets on host.
38+
/// Export a Vortex list-view as Arrow `List` using device kernels.
3939
///
4040
/// Contiguous list-views reuse their child elements. Non-contiguous list-views are rebuilt on GPU
4141
/// only when the child is primitive and non-nullable/non-null; other child shapes are rejected.
@@ -101,7 +101,7 @@ enum DeviceListViewOffsets {
101101
RequiresRebuild,
102102
}
103103

104-
/// Build cuDF-supported `i32` Arrow `List` offsets for a contiguous device-resident list-view.
104+
/// Build cuDF-supported `i32` Arrow `List` offsets from list-view offset/size device buffers.
105105
#[expect(clippy::cognitive_complexity)]
106106
async fn export_device_list_view_offsets(
107107
offsets_ptype: PType,

vortex-test/e2e-cuda/src/lib.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

4-
//! This file is a simple C-compatible API that is called from the cudf-test-harness at CI time.
5-
//!
6-
//! The flow is:
7-
//!
8-
//! * test harness calls `dlopen` in this library
9-
//! * invokes the `export_array` function to get back the device array
10-
//! * pass the array to `cudf`'s `from_arrow_device`
11-
//! * convert the loaded table back to Arrow host data for validation
12-
//! * call `array->release()` to drop the data allocated from the Rust side
4+
//! C ABI used by `cudf-test-harness` to export and validate Arrow Device data in CI.
135
146
#![expect(clippy::expect_used)]
157

@@ -129,7 +121,7 @@ fn fixed_size_list_as_list_array() -> VortexArrayRef {
129121
}
130122

131123
/// # Safety
132-
/// called by C++ code.
124+
/// `schema_ptr` and `array_ptr` must be valid writable pointers.
133125
#[unsafe(no_mangle)]
134126
pub unsafe extern "C" fn export_array(
135127
schema_ptr: &mut FFI_ArrowSchema,
@@ -207,7 +199,7 @@ fn export_array_inner(schema_ptr: &mut FFI_ArrowSchema, array_ptr: &mut ArrowDev
207199
}
208200

209201
/// # Safety
210-
/// called by C++ code.
202+
/// `ffi_schema` and `ffi_array` must describe a valid Arrow C Data array.
211203
#[unsafe(no_mangle)]
212204
pub unsafe extern "C" fn validate_array(
213205
ffi_schema: &FFI_ArrowSchema,
@@ -229,7 +221,7 @@ fn ffi_boundary(name: &str, f: impl FnOnce() -> i32) -> i32 {
229221
}
230222

231223
fn validate_array_inner(ffi_schema: &FFI_ArrowSchema, ffi_array: &mut FFI_ArrowArray) -> i32 {
232-
// SAFETY: the provided pointers must not be null, and must point at valid FFI Arrow types.
224+
// SAFETY: guaranteed by the C ABI contract.
233225
let array_data = unsafe {
234226
let ffi_array = mem::replace(ffi_array, FFI_ArrowArray::empty());
235227
match from_ffi(ffi_array, ffi_schema) {

0 commit comments

Comments
 (0)