baracuda_types/stream_mode.rs
1//! The default-stream semantics switch.
2//!
3//! CUDA's default stream (the null stream) has two legal behaviors:
4//!
5//! * **Legacy** — the default stream synchronizes implicitly with all other
6//! per-thread streams in the same context. This is the historical default
7//! and is what you get when you don't pass `--default-stream per-thread`
8//! to `nvcc`.
9//! * **PerThread** — each host thread has its own default stream and it
10//! does not synchronize with the legacy default stream. This is what
11//! every modern CUDA app should use and what the CUDA SDK has defaulted
12//! to since CUDA 7.
13//!
14//! The choice is process-global at the C API level: the symbol names that
15//! `cuGetProcAddress_v2` resolves depend on which mode we ask for. The
16//! enum itself lives here in `-types` (no I/O); the `OnceLock`-backed
17//! setter lives in `baracuda-core::stream_mode`.
18
19/// The default-stream semantics the baracuda loader should request from
20/// `cuGetProcAddress_v2`.
21#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Default)]
22pub enum StreamMode {
23 /// Historical default: the null stream synchronizes with everything.
24 Legacy,
25 /// Modern default: each host thread owns its own default stream.
26 #[default]
27 PerThread,
28}