Skip to content

Commit 61b7163

Browse files
committed
Fix session kernel benchmark setup
Initialize direct encoding benchmark sessions with their crate-level kernel registrations so they exercise the session execute-parent path instead of fallback materialization. Cache the ArrayKernels handle in ExecutionCtx to avoid repeated session lookups while trying execute-parent kernels. Signed-off-by: "Nicholas Gates" <nick@nickgates.com>
1 parent 94de103 commit 61b7163

17 files changed

Lines changed: 93 additions & 25 deletions

encodings/alp/benches/alp_compress.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ const BENCH_ARGS: &[(usize, f64, f64)] = &[
5050
(10_000, 0.1, 1.0),
5151
];
5252

53-
static SESSION: LazyLock<VortexSession> = LazyLock::new(vortex_array::array_session);
53+
static SESSION: LazyLock<VortexSession> = LazyLock::new(|| {
54+
let session = vortex_array::array_session();
55+
vortex_alp::initialize(&session);
56+
session
57+
});
5458

5559
#[divan::bench(types = [f32, f64], args = BENCH_ARGS)]
5660
fn compress_alp<T: ALPFloat + NativePType>(bencher: Bencher, args: (usize, f64, f64)) {

encodings/experimental/onpair/benches/decode.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ impl DecodeInputs {
7979
use vortex_onpair::onpair_compress;
8080
use vortex_session::VortexSession;
8181

82-
static SESSION: LazyLock<VortexSession> = LazyLock::new(vortex_array::array_session);
82+
static SESSION: LazyLock<VortexSession> = LazyLock::new(|| {
83+
let session = vortex_array::array_session();
84+
vortex_onpair::initialize(&session);
85+
session
86+
});
8387

8488
#[derive(Copy, Clone, Debug)]
8589
enum Shape {

encodings/fastlanes/benches/bitpack_compare.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ fn main() {
3535
divan::main();
3636
}
3737

38-
static SESSION: LazyLock<VortexSession> = LazyLock::new(vortex_array::array_session);
38+
static SESSION: LazyLock<VortexSession> = LazyLock::new(|| {
39+
let session = vortex_array::array_session();
40+
vortex_fastlanes::initialize(&session);
41+
session
42+
});
3943

4044
const LENS: &[usize] = &[1024, 64 * 1024];
4145
const BIT_WIDTHS: &[u8] = &[4, 16];

encodings/fastlanes/benches/bitpack_compare_sweep.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ fn main() {
3939
divan::main();
4040
}
4141

42-
static SESSION: LazyLock<VortexSession> = LazyLock::new(vortex_array::array_session);
42+
static SESSION: LazyLock<VortexSession> = LazyLock::new(|| {
43+
let session = vortex_array::array_session();
44+
vortex_fastlanes::initialize(&session);
45+
session
46+
});
4347

4448
/// Number of elements per benchmarked array (64 full FastLanes blocks).
4549
const LEN: usize = 64 * 1024;

encodings/fastlanes/benches/bitpacking_take.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ fn main() {
2626
divan::main();
2727
}
2828

29-
static SESSION: LazyLock<VortexSession> = LazyLock::new(vortex_array::array_session);
29+
static SESSION: LazyLock<VortexSession> = LazyLock::new(|| {
30+
let session = vortex_array::array_session();
31+
vortex_fastlanes::initialize(&session);
32+
session
33+
});
3034

3135
#[divan::bench]
3236
fn take_10_stratified(bencher: Bencher) {

encodings/fastlanes/benches/canonicalize_bench.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ const BENCH_ARGS: &[(usize, usize, f64)] = &[
3434
(10000, 1000, 0.00),
3535
];
3636

37-
static SESSION: LazyLock<VortexSession> = LazyLock::new(vortex_array::array_session);
37+
static SESSION: LazyLock<VortexSession> = LazyLock::new(|| {
38+
let session = vortex_array::array_session();
39+
vortex_fastlanes::initialize(&session);
40+
session
41+
});
3842

3943
#[cfg(not(codspeed))]
4044
#[divan::bench(args = BENCH_ARGS)]

encodings/fastlanes/benches/cast_bitpacked.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ fn main() {
3838
divan::main();
3939
}
4040

41-
static SESSION: LazyLock<VortexSession> = LazyLock::new(vortex_array::array_session);
41+
static SESSION: LazyLock<VortexSession> = LazyLock::new(|| {
42+
let session = vortex_array::array_session();
43+
vortex_fastlanes::initialize(&session);
44+
session
45+
});
4246

4347
const U32: DType = DType::Primitive(PType::U32, Nullability::NonNullable);
4448

encodings/fastlanes/benches/compute_between.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ fn main() {
2424
divan::main();
2525
}
2626

27-
static SESSION: LazyLock<VortexSession> = LazyLock::new(vortex_array::array_session);
27+
static SESSION: LazyLock<VortexSession> = LazyLock::new(|| {
28+
let session = vortex_array::array_session();
29+
vortex_fastlanes::initialize(&session);
30+
session
31+
});
2832

2933
fn generate_primitive_array<T: NativePType + NumCast>(
3034
rng: &mut StdRng,

encodings/fsst/benches/chunked_dict_fsst_builder.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ const BENCH_ARGS: &[(usize, usize, usize)] = &[
2828
(1000, 1000, 100),
2929
];
3030

31-
static SESSION: LazyLock<VortexSession> = LazyLock::new(vortex_array::array_session);
31+
static SESSION: LazyLock<VortexSession> = LazyLock::new(|| {
32+
let session = vortex_array::array_session();
33+
vortex_fsst::initialize(&session);
34+
session
35+
});
3236

3337
fn make_dict_fsst_chunks<T: NativePType>(
3438
len: usize,

encodings/fsst/benches/fsst_compress.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ fn main() {
3131
divan::main();
3232
}
3333

34-
static SESSION: LazyLock<VortexSession> = LazyLock::new(vortex_array::array_session);
34+
static SESSION: LazyLock<VortexSession> = LazyLock::new(|| {
35+
let session = vortex_array::array_session();
36+
vortex_fsst::initialize(&session);
37+
session
38+
});
3539

3640
// [(string_count, avg_len, unique_chars)]
3741
const BENCH_ARGS: &[(usize, usize, u8)] = &[

0 commit comments

Comments
 (0)