Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vortex-array/src/arrays/decimal/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ impl DecimalArray {
}
}

/// Return the `DecimalType` used to represent the values in the array.
pub fn values_type(&self) -> DecimalType {
self.values_type
}
Expand Down
3 changes: 2 additions & 1 deletion vortex-cuda/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ vortex-alp = { workspace = true }
vortex-array = { workspace = true }
vortex-buffer = { workspace = true }
vortex-decimal-byte-parts = { workspace = true }
vortex-dtype = { workspace = true }
vortex-dtype = { workspace = true, features = ["cudarc"] }
vortex-error = { workspace = true }
vortex-fastlanes = { workspace = true }
vortex-nvcomp = { path = "nvcomp" }
Expand All @@ -45,6 +45,7 @@ rstest = { workspace = true }
tokio = { workspace = true, features = ["rt", "macros"] }
vortex-array = { workspace = true, features = ["_test-harness"] }
vortex-cuda = { path = ".", features = ["_test-harness"] }
vortex-dtype = { workspace = true, features = ["cudarc"] }

[build-dependencies]

Expand Down
2 changes: 1 addition & 1 deletion vortex-cuda/benches/dict_cuda.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ mod cuda_benchmarks {
let events = vortex_cuda::launch_cuda_kernel!(
execution_ctx: cuda_ctx,
module: "dict",
ptypes: &[value_ptype, code_ptype],
ptypes: &[value_ptype.to_string().as_str(), code_ptype.to_string().as_str()],
launch_args: [codes_view, codes_len_u64, values_view, output_view],
event_recording: CU_EVENT_BLOCKING_SYNC,
array_len: codes_len
Expand Down
8 changes: 4 additions & 4 deletions vortex-cuda/benches/for_cuda.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ mod cuda_benchmarks {
let events = vortex_cuda::launch_cuda_kernel!(
execution_ctx: cuda_ctx,
module: "for",
ptypes: &[for_array.ptype()],
ptypes: &[for_array.ptype().to_string().as_str()],
launch_args: [device_data, reference, array_len_u64],
event_recording: CU_EVENT_BLOCKING_SYNC,
array_len: for_array.len()
Expand All @@ -112,7 +112,7 @@ mod cuda_benchmarks {
let events = vortex_cuda::launch_cuda_kernel!(
execution_ctx: cuda_ctx,
module: "for",
ptypes: &[for_array.ptype()],
ptypes: &[for_array.ptype().to_string().as_str()],
launch_args: [device_data, reference, array_len_u64],
event_recording: CU_EVENT_BLOCKING_SYNC,
array_len: for_array.len()
Expand All @@ -133,7 +133,7 @@ mod cuda_benchmarks {
let events = vortex_cuda::launch_cuda_kernel!(
execution_ctx: cuda_ctx,
module: "for",
ptypes: &[for_array.ptype()],
ptypes: &[for_array.ptype().to_string().as_str()],
launch_args: [device_data, reference, array_len_u64],
event_recording: CU_EVENT_BLOCKING_SYNC,
array_len: for_array.len()
Expand All @@ -154,7 +154,7 @@ mod cuda_benchmarks {
let events = vortex_cuda::launch_cuda_kernel!(
execution_ctx: cuda_ctx,
module: "for",
ptypes: &[for_array.ptype()],
ptypes: &[for_array.ptype().to_string().as_str()],
launch_args: [device_data, reference, array_len_u64],
event_recording: CU_EVENT_BLOCKING_SYNC,
array_len: for_array.len()
Expand Down
5 changes: 5 additions & 0 deletions vortex-cuda/kernels/dict.cu
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <stdint.h>

#include "config.cuh"
#include "types.cuh"

template<typename ValueT, typename IndexT>
__device__ void dict_kernel(
Expand Down Expand Up @@ -55,3 +56,7 @@ GENERATE_DICT_KERNELS_FOR_VALUE(u32, uint32_t)
GENERATE_DICT_KERNELS_FOR_VALUE(i32, int32_t)
GENERATE_DICT_KERNELS_FOR_VALUE(u64, uint64_t)
GENERATE_DICT_KERNELS_FOR_VALUE(i64, int64_t)

// Decimal types (128-bit and 256-bit)
GENERATE_DICT_KERNELS_FOR_VALUE(i128, int128_t)
GENERATE_DICT_KERNELS_FOR_VALUE(i256, int256_t)
20 changes: 20 additions & 0 deletions vortex-cuda/kernels/types.cuh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright the Vortex contributors

#ifndef VORTEX_CUDA_TYPES_CUH
#define VORTEX_CUDA_TYPES_CUH

#include <stdint.h>

// 128-bit signed integer type for decimal values
struct __align__(16) int128_t {
int64_t lo;
int64_t hi;
};

// 256-bit signed integer type for decimal values
struct __align__(32) int256_t {
int64_t parts[4];
};

#endif // VORTEX_CUDA_TYPES_CUH
38 changes: 36 additions & 2 deletions vortex-cuda/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,42 @@ impl CudaExecutionCtx {
/// # Errors
///
/// Returns an error if kernel loading fails.
pub fn load_function(&self, module_name: &str, ptypes: &[PType]) -> VortexResult<CudaFunction> {
self.cuda_session.load_function(module_name, ptypes)
pub fn load_function_ptype(
&self,
module_name: &str,
ptypes: &[PType],
) -> VortexResult<CudaFunction> {
let type_suffixes: Vec<String> = ptypes.iter().map(|ptype| ptype.to_string()).collect();
self.load_function(
module_name,
type_suffixes
.iter()
.map(|t| t.as_str())
.collect::<Vec<_>>()
.as_slice(),
)
}

/// Loads a CUDA kernel function by module name and type suffixes.
///
/// This is a lower-level version of `load_function` that accepts string suffixes
/// directly, useful for types that don't have a `PType` (e.g., i128, i256).
///
/// # Arguments
///
/// * `module_name` - Name of the module (`kernels/{module_name}.ptx`)
/// * `type_suffixes` - List of type suffix strings for the kernel name
///
/// # Errors
///
/// Returns an error if kernel loading fails.
pub fn load_function(
&self,
module_name: &str,
type_suffixes: &[&str],
) -> VortexResult<CudaFunction> {
self.cuda_session
.load_function_with_suffixes(module_name, type_suffixes)
}

/// Returns a launch builder for a CUDA kernel function.
Expand Down
Loading
Loading