Skip to content

Commit ba700ca

Browse files
authored
Remove LEGACY_SESSION from benchmarks and back compat tests (#8554)
1 parent 71319b7 commit ba700ca

44 files changed

Lines changed: 279 additions & 386 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

fuzz/src/gpu/mod.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use arbitrary::Unstructured;
1212
use vortex_array::ArrayRef;
1313
use vortex_array::Canonical;
1414
use vortex_array::IntoArray;
15-
use vortex_array::LEGACY_SESSION;
1615
use vortex_array::VortexSessionExecute;
1716
use vortex_array::arrays::dict::ArbitraryDictArray;
1817
use vortex_array::dtype::Nullability;
@@ -110,13 +109,11 @@ pub async fn run_compress_gpu(fuzz: FuzzCompressGpu) -> VortexFuzzResult<bool> {
110109
}
111110

112111
let FuzzCompressGpu { array } = fuzz;
112+
let mut ctx = SESSION.create_execution_ctx();
113113

114114
let original_len = array.len();
115115

116-
let cpu_canonical = match array
117-
.clone()
118-
.execute::<Canonical>(&mut LEGACY_SESSION.create_execution_ctx())
119-
{
116+
let cpu_canonical = match array.clone().execute::<Canonical>(&mut ctx) {
120117
Ok(c) => c,
121118
Err(e) => {
122119
return Err(VortexFuzzError::VortexError(e, Backtrace::capture()));
@@ -165,10 +162,10 @@ pub async fn run_compress_gpu(fuzz: FuzzCompressGpu) -> VortexFuzzResult<bool> {
165162

166163
for i in 0..original_len {
167164
let cpu_scalar = cpu_array
168-
.execute_scalar(i, &mut LEGACY_SESSION.create_execution_ctx())
165+
.execute_scalar(i, &mut ctx)
169166
.map_err(|e| VortexFuzzError::VortexError(e, Backtrace::capture()))?;
170167
let gpu_scalar = gpu_array
171-
.execute_scalar(i, &mut LEGACY_SESSION.create_execution_ctx())
168+
.execute_scalar(i, &mut ctx)
172169
.map_err(|e| VortexFuzzError::VortexError(e, Backtrace::capture()))?;
173170

174171
if cpu_scalar != gpu_scalar {

vortex-array/benches/aggregate_grouped.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
#![expect(clippy::cast_possible_truncation)]
55
#![expect(clippy::unwrap_used)]
66

7+
use std::sync::LazyLock;
8+
79
use divan::Bencher;
810
use rand::RngExt;
911
use rand::SeedableRng;
1012
use rand::rngs::StdRng;
1113
use vortex_array::ArrayRef;
1214
use vortex_array::IntoArray;
13-
use vortex_array::LEGACY_SESSION;
1415
use vortex_array::VortexSessionExecute;
1516
use vortex_array::aggregate_fn::AggregateFnVTable;
1617
use vortex_array::aggregate_fn::DynGroupedAccumulator;
@@ -24,11 +25,14 @@ use vortex_array::arrays::VarBinViewArray;
2425
use vortex_array::dtype::DType;
2526
use vortex_array::validity::Validity;
2627
use vortex_buffer::Buffer;
28+
use vortex_session::VortexSession;
2729

2830
fn main() {
2931
divan::main();
3032
}
3133

34+
static SESSION: LazyLock<VortexSession> = LazyLock::new(vortex_array::array_session);
35+
3236
const GROUP_COUNT: usize = 128;
3337
const GROUP_SIZE_SEED: u64 = 42;
3438
const MIN_VALUES_PER_GROUP: usize = 1;
@@ -157,7 +161,7 @@ where
157161
list_element_dtype(list_view),
158162
)
159163
.unwrap();
160-
acc.accumulate_list(list_view, &mut LEGACY_SESSION.create_execution_ctx())
164+
acc.accumulate_list(list_view, &mut SESSION.create_execution_ctx())
161165
.unwrap();
162166
divan::black_box(acc.finish().unwrap())
163167
}

vortex-array/benches/bool_zip.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,24 @@
33

44
#![expect(clippy::unwrap_used)]
55

6+
use std::sync::LazyLock;
7+
68
use divan::Bencher;
79
use vortex_array::ArrayRef;
810
use vortex_array::IntoArray;
9-
use vortex_array::LEGACY_SESSION;
1011
use vortex_array::RecursiveCanonical;
1112
use vortex_array::VortexSessionExecute;
1213
use vortex_array::arrays::BoolArray;
1314
use vortex_array::builtins::ArrayBuiltins;
1415
use vortex_mask::Mask;
16+
use vortex_session::VortexSession;
1517

1618
fn main() {
1719
divan::main();
1820
}
1921

22+
static SESSION: LazyLock<VortexSession> = LazyLock::new(vortex_array::array_session);
23+
2024
const LEN: usize = 65_536;
2125

2226
/// Fragmented (alternating) mask: the worst case for the generic per-run builder this kernel
@@ -53,7 +57,7 @@ fn run(bencher: Bencher, if_true: ArrayRef, if_false: ArrayRef) {
5357
if_true.clone(),
5458
if_false.clone(),
5559
mask.clone().into_array(),
56-
LEGACY_SESSION.create_execution_ctx(),
60+
SESSION.create_execution_ctx(),
5761
)
5862
})
5963
.bench_refs(|(t, f, m, ctx)| {

vortex-array/benches/primitive_zip.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,24 @@
77
reason = "benchmark fixtures use indices that fit in the chosen widths"
88
)]
99

10+
use std::sync::LazyLock;
11+
1012
use divan::Bencher;
1113
use vortex_array::IntoArray;
12-
use vortex_array::LEGACY_SESSION;
1314
use vortex_array::RecursiveCanonical;
1415
use vortex_array::VortexSessionExecute;
1516
use vortex_array::arrays::PrimitiveArray;
1617
use vortex_array::builtins::ArrayBuiltins;
1718
use vortex_buffer::BufferMut;
1819
use vortex_mask::Mask;
20+
use vortex_session::VortexSession;
1921

2022
fn main() {
2123
divan::main();
2224
}
2325

26+
static SESSION: LazyLock<VortexSession> = LazyLock::new(vortex_array::array_session);
27+
2428
// Sized so the bench stays well under a few hundred microseconds under CodSpeed's instruction-count
2529
// simulation, which runs ~10x the local walltime; the branchless value blend is still exercised.
2630
const LEN: usize = 16_384;
@@ -53,7 +57,7 @@ fn run(bencher: Bencher, if_true: vortex_array::ArrayRef, if_false: vortex_array
5357
if_true.clone(),
5458
if_false.clone(),
5559
mask.clone().into_array(),
56-
LEGACY_SESSION.create_execution_ctx(),
60+
SESSION.create_execution_ctx(),
5761
)
5862
})
5963
.bench_refs(|(t, f, m, ctx)| {

vortex-cuda/benches/alp_cuda.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ use criterion::Throughput;
2121
use cudarc::driver::DeviceRepr;
2222
use futures::executor::block_on;
2323
use vortex::array::IntoArray;
24-
use vortex::array::LEGACY_SESSION;
2524
use vortex::array::VortexSessionExecute;
25+
use vortex::array::array_session;
2626
use vortex::array::arrays::PrimitiveArray;
2727
use vortex::array::validity::Validity::NonNullable;
2828
use vortex::buffer::Buffer;
@@ -74,7 +74,7 @@ where
7474
let encoded = alp_encode(
7575
primitive_array.as_view(),
7676
None,
77-
&mut LEGACY_SESSION.create_execution_ctx(),
77+
&mut array_session().create_execution_ctx(),
7878
)
7979
.vortex_expect("failed to ALP-encode array");
8080

vortex-cuda/benches/bitpacked_cuda.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ use criterion::Throughput;
2121
use cudarc::driver::DeviceRepr;
2222
use futures::executor::block_on;
2323
use vortex::array::IntoArray;
24-
use vortex::array::LEGACY_SESSION;
2524
use vortex::array::VortexSessionExecute;
25+
use vortex::array::array_session;
2626
use vortex::array::arrays::PrimitiveArray;
2727
use vortex::array::validity::Validity::NonNullable;
2828
use vortex::buffer::Buffer;
@@ -57,7 +57,7 @@ where
5757
.collect();
5858

5959
let primitive_array = PrimitiveArray::new(Buffer::from(values), NonNullable);
60-
let mut ctx = LEGACY_SESSION.create_execution_ctx();
60+
let mut ctx = array_session().create_execution_ctx();
6161
BitPackedData::encode(&primitive_array.into_array(), bit_width, &mut ctx)
6262
.vortex_expect("failed to create BitPacked array")
6363
}
@@ -98,7 +98,7 @@ where
9898
.collect();
9999

100100
let primitive_array = PrimitiveArray::new(Buffer::from(values), NonNullable).into_array();
101-
let mut ctx = LEGACY_SESSION.create_execution_ctx();
101+
let mut ctx = array_session().create_execution_ctx();
102102
BitPackedData::encode(&primitive_array, bit_width, &mut ctx)
103103
.vortex_expect("failed to create BitPacked array with patches")
104104
}

0 commit comments

Comments
 (0)