From 5bcd39d03bb4eb2dc4052d48fd826f60bdd4f993 Mon Sep 17 00:00:00 2001 From: Alexander Droste Date: Tue, 27 Oct 2026 14:24:18 +0000 Subject: [PATCH 1/2] refactor(cuda): stop registering default session variables in benches that register `ArraySession`, `KernelSession`, `DTypeSession`, `ScalarFnSession`, `AggregateFnSession` and `MemorySession` up front, although `VortexSession::empty()` creates each of them with the same defaults on first use. Register only the `CudaSession`. Signed-off-by: Alexander Droste --- vortex-cuda/benches/alp_cuda.rs | 18 ++------------- vortex-cuda/benches/arrow_validity_cuda.rs | 18 ++------------- vortex-cuda/benches/bitpacked_cuda.rs | 18 ++------------- vortex-cuda/benches/delta_cuda.rs | 18 ++------------- vortex-cuda/benches/dynamic_dispatch_cuda.rs | 18 ++------------- vortex-cuda/benches/for_cuda.rs | 18 ++------------- vortex-cuda/benches/fsst_cuda.rs | 23 +++++--------------- 7 files changed, 17 insertions(+), 114 deletions(-) diff --git a/vortex-cuda/benches/alp_cuda.rs b/vortex-cuda/benches/alp_cuda.rs index 7450957f164..79b19b49965 100644 --- a/vortex-cuda/benches/alp_cuda.rs +++ b/vortex-cuda/benches/alp_cuda.rs @@ -33,12 +33,6 @@ use vortex::encodings::alp::ALPFloat; use vortex::encodings::alp::alp_encode; use vortex::error::VortexExpect; use vortex::session::VortexSession; -use vortex_array::aggregate_fn::session::AggregateFnSession; -use vortex_array::dtype::session::DTypeSession; -use vortex_array::memory::MemorySession; -use vortex_array::optimizer::kernels::KernelSession; -use vortex_array::scalar_fn::session::ScalarFnSession; -use vortex_array::session::ArraySession; use vortex_array::test_harness::mark_optimized; use vortex_cuda::CudaDispatchMode; use vortex_cuda::CudaSession; @@ -50,16 +44,8 @@ use vortex_cuda_macros::cuda_not_available; use crate::bench_config::BENCH_SIZES; use crate::timed_launch_strategy::TimedLaunchStrategy; -static SESSION: LazyLock = LazyLock::new(|| { - VortexSession::empty() - .with::() - .with::() - .with::() - .with::() - .with::() - .with::() - .with::() -}); +static SESSION: LazyLock = + LazyLock::new(|| VortexSession::empty().with::()); #[global_allocator] static GLOBAL: MiMalloc = MiMalloc; diff --git a/vortex-cuda/benches/arrow_validity_cuda.rs b/vortex-cuda/benches/arrow_validity_cuda.rs index de6a2b174ed..ed388ffa0a0 100644 --- a/vortex-cuda/benches/arrow_validity_cuda.rs +++ b/vortex-cuda/benches/arrow_validity_cuda.rs @@ -29,12 +29,6 @@ use vortex::dtype::PType; use vortex::error::VortexExpect; use vortex::error::VortexResult; use vortex::session::VortexSession; -use vortex_array::aggregate_fn::session::AggregateFnSession; -use vortex_array::dtype::session::DTypeSession; -use vortex_array::memory::MemorySession; -use vortex_array::optimizer::kernels::KernelSession; -use vortex_array::scalar_fn::session::ScalarFnSession; -use vortex_array::session::ArraySession; use vortex_array::test_harness::mark_optimized; use vortex_cuda::CudaExecutionCtx; use vortex_cuda::CudaSession; @@ -46,16 +40,8 @@ use vortex_cuda_macros::cuda_not_available; use crate::timed_launch_strategy::TimedLaunchStrategy; -static SESSION: LazyLock = LazyLock::new(|| { - VortexSession::empty() - .with::() - .with::() - .with::() - .with::() - .with::() - .with::() - .with::() -}); +static SESSION: LazyLock = + LazyLock::new(|| VortexSession::empty().with::()); #[global_allocator] static GLOBAL: MiMalloc = MiMalloc; diff --git a/vortex-cuda/benches/bitpacked_cuda.rs b/vortex-cuda/benches/bitpacked_cuda.rs index bbbf501724c..36880829245 100644 --- a/vortex-cuda/benches/bitpacked_cuda.rs +++ b/vortex-cuda/benches/bitpacked_cuda.rs @@ -32,12 +32,6 @@ use vortex::encodings::fastlanes::BitPackedData; use vortex::encodings::fastlanes::unpack_iter::BitPacked; use vortex::error::VortexExpect; use vortex::session::VortexSession; -use vortex_array::aggregate_fn::session::AggregateFnSession; -use vortex_array::dtype::session::DTypeSession; -use vortex_array::memory::MemorySession; -use vortex_array::optimizer::kernels::KernelSession; -use vortex_array::scalar_fn::session::ScalarFnSession; -use vortex_array::session::ArraySession; use vortex_array::test_harness::mark_optimized; use vortex_cuda::CudaDispatchMode; use vortex_cuda::CudaSession; @@ -48,16 +42,8 @@ use vortex_cuda_macros::cuda_not_available; use crate::timed_launch_strategy::TimedLaunchStrategy; -static SESSION: LazyLock = LazyLock::new(|| { - VortexSession::empty() - .with::() - .with::() - .with::() - .with::() - .with::() - .with::() - .with::() -}); +static SESSION: LazyLock = + LazyLock::new(|| VortexSession::empty().with::()); #[global_allocator] static GLOBAL: MiMalloc = MiMalloc; diff --git a/vortex-cuda/benches/delta_cuda.rs b/vortex-cuda/benches/delta_cuda.rs index 67d2b77f829..af788f80c00 100644 --- a/vortex-cuda/benches/delta_cuda.rs +++ b/vortex-cuda/benches/delta_cuda.rs @@ -33,12 +33,6 @@ use vortex::encodings::fastlanes::Delta; use vortex::encodings::fastlanes::DeltaArray; use vortex::error::VortexExpect; use vortex::session::VortexSession; -use vortex_array::aggregate_fn::session::AggregateFnSession; -use vortex_array::dtype::session::DTypeSession; -use vortex_array::memory::MemorySession; -use vortex_array::optimizer::kernels::KernelSession; -use vortex_array::scalar_fn::session::ScalarFnSession; -use vortex_array::session::ArraySession; use vortex_array::test_harness::mark_optimized; use vortex_cuda::CudaDispatchMode; use vortex_cuda::CudaSession; @@ -50,16 +44,8 @@ use vortex_cuda_macros::cuda_not_available; use crate::bench_config::BENCH_SIZES; use crate::timed_launch_strategy::TimedLaunchStrategy; -static SESSION: LazyLock = LazyLock::new(|| { - VortexSession::empty() - .with::() - .with::() - .with::() - .with::() - .with::() - .with::() - .with::() -}); +static SESSION: LazyLock = + LazyLock::new(|| VortexSession::empty().with::()); #[global_allocator] static GLOBAL: MiMalloc = MiMalloc; diff --git a/vortex-cuda/benches/dynamic_dispatch_cuda.rs b/vortex-cuda/benches/dynamic_dispatch_cuda.rs index 281989a3beb..947488fea16 100644 --- a/vortex-cuda/benches/dynamic_dispatch_cuda.rs +++ b/vortex-cuda/benches/dynamic_dispatch_cuda.rs @@ -54,12 +54,6 @@ use vortex::error::VortexResult; use vortex::error::vortex_err; use vortex::error::vortex_panic; use vortex::session::VortexSession; -use vortex_array::aggregate_fn::session::AggregateFnSession; -use vortex_array::dtype::session::DTypeSession; -use vortex_array::memory::MemorySession; -use vortex_array::optimizer::kernels::KernelSession; -use vortex_array::scalar_fn::session::ScalarFnSession; -use vortex_array::session::ArraySession; use vortex_cuda::CudaBufferExt; use vortex_cuda::CudaDispatchMode; use vortex_cuda::CudaExecutionCtx; @@ -81,16 +75,8 @@ use vortex_cuda_macros::cuda_not_available; use crate::bench_config::BENCH_SIZES; -static SESSION: LazyLock = LazyLock::new(|| { - VortexSession::empty() - .with::() - .with::() - .with::() - .with::() - .with::() - .with::() - .with::() -}); +static SESSION: LazyLock = + LazyLock::new(|| VortexSession::empty().with::()); #[global_allocator] static GLOBAL: MiMalloc = MiMalloc; diff --git a/vortex-cuda/benches/for_cuda.rs b/vortex-cuda/benches/for_cuda.rs index f0bae21176d..2786a5d8b6c 100644 --- a/vortex-cuda/benches/for_cuda.rs +++ b/vortex-cuda/benches/for_cuda.rs @@ -34,12 +34,6 @@ use vortex::encodings::fastlanes::FoRArray; use vortex::error::VortexExpect; use vortex::scalar::Scalar; use vortex::session::VortexSession; -use vortex_array::aggregate_fn::session::AggregateFnSession; -use vortex_array::dtype::session::DTypeSession; -use vortex_array::memory::MemorySession; -use vortex_array::optimizer::kernels::KernelSession; -use vortex_array::scalar_fn::session::ScalarFnSession; -use vortex_array::session::ArraySession; use vortex_array::test_harness::mark_optimized; use vortex_cuda::CudaDispatchMode; use vortex_cuda::CudaSession; @@ -51,16 +45,8 @@ use vortex_cuda_macros::cuda_not_available; use crate::bench_config::BENCH_SIZES; use crate::timed_launch_strategy::TimedLaunchStrategy; -static SESSION: LazyLock = LazyLock::new(|| { - VortexSession::empty() - .with::() - .with::() - .with::() - .with::() - .with::() - .with::() - .with::() -}); +static SESSION: LazyLock = + LazyLock::new(|| VortexSession::empty().with::()); #[global_allocator] static GLOBAL: MiMalloc = MiMalloc; diff --git a/vortex-cuda/benches/fsst_cuda.rs b/vortex-cuda/benches/fsst_cuda.rs index be2b34e539e..bb0d7e3a1fe 100644 --- a/vortex-cuda/benches/fsst_cuda.rs +++ b/vortex-cuda/benches/fsst_cuda.rs @@ -20,14 +20,8 @@ use futures::executor::block_on; use mimalloc::MiMalloc; use vortex::array::ArrayRef; use vortex::array::IntoArray; -use vortex::array::aggregate_fn::session::AggregateFnSession; use vortex::array::arrays::PrimitiveArray; -use vortex::array::dtype::session::DTypeSession; use vortex::array::match_each_integer_ptype; -use vortex::array::memory::MemorySession; -use vortex::array::optimizer::kernels::KernelSession; -use vortex::array::scalar_fn::session::ScalarFnSession; -use vortex::array::session::ArraySession; use vortex::dtype::DType; use vortex::dtype::Nullability; use vortex::encodings::fsst::FSST; @@ -58,18 +52,11 @@ static GLOBAL: MiMalloc = MiMalloc; const BENCH_SIZES: &[(usize, &str)] = &[(10_000_000, "10M")]; fn session_with_varbin_layout(layout: VarBinExportLayout) -> VortexSession { - VortexSession::empty() - .with::() - .with::() - .with::() - .with::() - .with::() - .with::() - .with_some( - CudaSession::try_default() - .vortex_expect("failed to create CUDA session") - .with_varbin_export_layout(layout), - ) + VortexSession::empty().with_some( + CudaSession::try_default() + .vortex_expect("failed to create CUDA session") + .with_varbin_export_layout(layout), + ) } static VARBIN_SESSION: LazyLock = From 336e2233f898271d10934bcc649668460d0ff203 Mon Sep 17 00:00:00 2001 From: Alexander Droste Date: Wed, 4 Nov 2026 13:31:32 +0000 Subject: [PATCH 2/2] refactor(cuda): reuse benchmark session helper Signed-off-by: Alexander Droste --- vortex-cuda/benches/alp_cuda.rs | 3 +-- vortex-cuda/benches/arrow_validity_cuda.rs | 3 +-- vortex-cuda/benches/bitpacked_cuda.rs | 3 +-- vortex-cuda/benches/delta_cuda.rs | 3 +-- vortex-cuda/benches/dynamic_dispatch_cuda.rs | 3 +-- vortex-cuda/benches/for_cuda.rs | 3 +-- vortex-cuda/src/lib.rs | 5 +++-- 7 files changed, 9 insertions(+), 14 deletions(-) diff --git a/vortex-cuda/benches/alp_cuda.rs b/vortex-cuda/benches/alp_cuda.rs index 79b19b49965..4f8c6e5e423 100644 --- a/vortex-cuda/benches/alp_cuda.rs +++ b/vortex-cuda/benches/alp_cuda.rs @@ -44,8 +44,7 @@ use vortex_cuda_macros::cuda_not_available; use crate::bench_config::BENCH_SIZES; use crate::timed_launch_strategy::TimedLaunchStrategy; -static SESSION: LazyLock = - LazyLock::new(|| VortexSession::empty().with::()); +static SESSION: LazyLock = LazyLock::new(vortex_cuda::cuda_session); #[global_allocator] static GLOBAL: MiMalloc = MiMalloc; diff --git a/vortex-cuda/benches/arrow_validity_cuda.rs b/vortex-cuda/benches/arrow_validity_cuda.rs index ed388ffa0a0..ecef2f02dd6 100644 --- a/vortex-cuda/benches/arrow_validity_cuda.rs +++ b/vortex-cuda/benches/arrow_validity_cuda.rs @@ -40,8 +40,7 @@ use vortex_cuda_macros::cuda_not_available; use crate::timed_launch_strategy::TimedLaunchStrategy; -static SESSION: LazyLock = - LazyLock::new(|| VortexSession::empty().with::()); +static SESSION: LazyLock = LazyLock::new(vortex_cuda::cuda_session); #[global_allocator] static GLOBAL: MiMalloc = MiMalloc; diff --git a/vortex-cuda/benches/bitpacked_cuda.rs b/vortex-cuda/benches/bitpacked_cuda.rs index 36880829245..4dcb0a20b1f 100644 --- a/vortex-cuda/benches/bitpacked_cuda.rs +++ b/vortex-cuda/benches/bitpacked_cuda.rs @@ -42,8 +42,7 @@ use vortex_cuda_macros::cuda_not_available; use crate::timed_launch_strategy::TimedLaunchStrategy; -static SESSION: LazyLock = - LazyLock::new(|| VortexSession::empty().with::()); +static SESSION: LazyLock = LazyLock::new(vortex_cuda::cuda_session); #[global_allocator] static GLOBAL: MiMalloc = MiMalloc; diff --git a/vortex-cuda/benches/delta_cuda.rs b/vortex-cuda/benches/delta_cuda.rs index af788f80c00..da2e7870c8a 100644 --- a/vortex-cuda/benches/delta_cuda.rs +++ b/vortex-cuda/benches/delta_cuda.rs @@ -44,8 +44,7 @@ use vortex_cuda_macros::cuda_not_available; use crate::bench_config::BENCH_SIZES; use crate::timed_launch_strategy::TimedLaunchStrategy; -static SESSION: LazyLock = - LazyLock::new(|| VortexSession::empty().with::()); +static SESSION: LazyLock = LazyLock::new(vortex_cuda::cuda_session); #[global_allocator] static GLOBAL: MiMalloc = MiMalloc; diff --git a/vortex-cuda/benches/dynamic_dispatch_cuda.rs b/vortex-cuda/benches/dynamic_dispatch_cuda.rs index 947488fea16..bee5f2e3b77 100644 --- a/vortex-cuda/benches/dynamic_dispatch_cuda.rs +++ b/vortex-cuda/benches/dynamic_dispatch_cuda.rs @@ -75,8 +75,7 @@ use vortex_cuda_macros::cuda_not_available; use crate::bench_config::BENCH_SIZES; -static SESSION: LazyLock = - LazyLock::new(|| VortexSession::empty().with::()); +static SESSION: LazyLock = LazyLock::new(cuda_session); #[global_allocator] static GLOBAL: MiMalloc = MiMalloc; diff --git a/vortex-cuda/benches/for_cuda.rs b/vortex-cuda/benches/for_cuda.rs index 2786a5d8b6c..401d386bc25 100644 --- a/vortex-cuda/benches/for_cuda.rs +++ b/vortex-cuda/benches/for_cuda.rs @@ -45,8 +45,7 @@ use vortex_cuda_macros::cuda_not_available; use crate::bench_config::BENCH_SIZES; use crate::timed_launch_strategy::TimedLaunchStrategy; -static SESSION: LazyLock = - LazyLock::new(|| VortexSession::empty().with::()); +static SESSION: LazyLock = LazyLock::new(vortex_cuda::cuda_session); #[global_allocator] static GLOBAL: MiMalloc = MiMalloc; diff --git a/vortex-cuda/src/lib.rs b/vortex-cuda/src/lib.rs index 4edda7a3f98..90ec43f79e8 100644 --- a/vortex-cuda/src/lib.rs +++ b/vortex-cuda/src/lib.rs @@ -133,8 +133,9 @@ pub fn initialize_cuda(session: &CudaSession) { session.register_kernel(Slice.id(), &SliceExecutor); } -/// Builds a fresh [`VortexSession`](vortex::session::VortexSession) with all array session -/// variables plus a default [`CudaSession`], for use in CUDA tests and benchmarks. +/// Builds a fresh [`VortexSession`](vortex::session::VortexSession) with a default +/// [`CudaSession`] for CUDA tests and benchmarks. Array session variables are initialized +/// with their defaults on first use. /// /// Each call returns an independent session with its own kernel registry and stream pool. /// Live default sessions share a CUDA context and its device memory pool. Tests requiring isolated