-
Notifications
You must be signed in to change notification settings - Fork 198
Add CUDA decompression kernels for OnPair #8920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
robert3005
wants to merge
11
commits into
develop
Choose a base branch
from
rk/onpairgpu
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
042d01c
Add CUDA decompression kernels for OnPair
robert3005 f24ca01
fuse
robert3005 d852602
fixes
robert3005 2207cf6
less
robert3005 2aaa231
formatted
robert3005 43e97df
less
robert3005 01b2414
less
robert3005 f713667
fixes
robert3005 f2818df
fix more
robert3005 c708ed0
fix
robert3005 1732f2a
fixes
robert3005 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,6 @@ | |
|
|
||
| #![expect(clippy::unwrap_used)] | ||
|
|
||
| #[allow(dead_code)] | ||
| mod bench_config; | ||
| mod timed_launch_strategy; | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // SPDX-FileCopyrightText: Copyright the Vortex contributors | ||
|
|
||
| //! CUDA benchmarks for OnPair decompression. | ||
|
|
||
| #![expect(clippy::unwrap_used)] | ||
|
|
||
| mod bench_config; | ||
| mod timed_launch_strategy; | ||
|
|
||
| use std::sync::Arc; | ||
| use std::sync::atomic::Ordering; | ||
| use std::time::Duration; | ||
|
|
||
| use criterion::BenchmarkId; | ||
| use criterion::Criterion; | ||
| use criterion::Throughput; | ||
| use futures::executor::block_on; | ||
| use vortex::array::ArrayRef; | ||
| use vortex::array::IntoArray; | ||
| use vortex::array::arrays::VarBinArray; | ||
| use vortex::dtype::DType; | ||
| use vortex::dtype::Nullability; | ||
| use vortex::error::VortexExpect; | ||
| use vortex_cuda::CudaDispatchMode; | ||
| use vortex_cuda::CudaSession; | ||
| use vortex_cuda::executor::CudaArrayExt; | ||
| use vortex_cuda_macros::cuda_available; | ||
| use vortex_cuda_macros::cuda_not_available; | ||
| use vortex_onpair::DEFAULT_CONFIG; | ||
| use vortex_onpair::onpair_compress; | ||
|
|
||
| use crate::timed_launch_strategy::TimedLaunchStrategy; | ||
|
|
||
| // Bench-local size instead of the workspace 100M default: each input is a | ||
| // URL-shaped string, much heavier per-element than the fixed-width primitives | ||
| // other kernels benchmark. | ||
| const BENCH_SIZES: &[(usize, &str)] = &[(10_000_000, "10M")]; | ||
|
|
||
| struct OnPairBenchFixture { | ||
| array: ArrayRef, | ||
| uncompressed_size: u64, | ||
| } | ||
|
|
||
| fn make_fixture(n: usize) -> OnPairBenchFixture { | ||
| let mut setup_ctx = CudaSession::create_execution_ctx(&vortex_cuda::cuda_session()) | ||
| .vortex_expect("failed to create execution context"); | ||
|
|
||
| let strings: Vec<String> = (0..n) | ||
| .map(|i| format!("https://www.example.com/path/{i}/segment?q={}", i % 97)) | ||
| .collect(); | ||
| let uncompressed_size = strings.iter().map(|s| s.len() as u64).sum(); | ||
| let varbin = VarBinArray::from_iter( | ||
| strings.iter().map(|s| Some(s.as_str())), | ||
| DType::Utf8(Nullability::NonNullable), | ||
| ) | ||
| .into_array(); | ||
| let array = onpair_compress(&varbin, DEFAULT_CONFIG, setup_ctx.execution_ctx()) | ||
| .vortex_expect("OnPair compression failed"); | ||
|
|
||
| OnPairBenchFixture { | ||
| array, | ||
| uncompressed_size, | ||
| } | ||
| } | ||
|
|
||
| fn benchmark_onpair_cuda_decompress(c: &mut Criterion) { | ||
| let mut group = c.benchmark_group("cuda"); | ||
|
|
||
| for &(n, len_str) in BENCH_SIZES { | ||
| let fixture = make_fixture(n); | ||
|
|
||
| group.throughput(Throughput::Bytes(fixture.uncompressed_size)); | ||
| group.bench_with_input( | ||
| BenchmarkId::new("cuda/onpair/decompress_to_varbinview", len_str), | ||
| &fixture.array, | ||
| |b, onpair_array| { | ||
| b.iter_custom(|iters| { | ||
| let timed = TimedLaunchStrategy::default(); | ||
| let timer = timed.timer(); | ||
|
|
||
| let mut cuda_ctx = | ||
| CudaSession::create_execution_ctx(&vortex_cuda::cuda_session()) | ||
| .vortex_expect("failed to create execution context") | ||
| .with_dispatch_mode(CudaDispatchMode::StandaloneOnly) | ||
| .with_launch_strategy(Arc::new(timed)); | ||
|
|
||
| for _ in 0..iters { | ||
| block_on(onpair_array.clone().execute_cuda(&mut cuda_ctx)).unwrap(); | ||
| } | ||
| Duration::from_nanos(timer.load(Ordering::Relaxed)) | ||
| }); | ||
| }, | ||
| ); | ||
| } | ||
|
|
||
| group.finish(); | ||
| } | ||
|
|
||
| criterion::criterion_group! { | ||
| name = benches; | ||
| config = bench_config::cuda_bench_config(); | ||
| targets = benchmark_onpair_cuda_decompress | ||
| } | ||
|
|
||
| #[cuda_available] | ||
| criterion::criterion_main!(benches); | ||
|
|
||
| #[cuda_not_available] | ||
| fn main() {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.