#[non_exhaustive]pub enum StreamPolicy {
PerThread,
PerTask,
Single,
}Expand description
How the current stream is derived when no explicit override is active.
Loaded from the [streaming] section of cubecl.toml by cubecl-runtime,
or set programmatically with set_policy. An explicit set_policy call
always wins over the configuration file.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
PerThread
One stream per OS thread (the historical behavior and the default).
Correct for applications that submit work from plain threads. Under an async executor with work stealing, a logical task hopping between worker threads changes streams, causing spurious synchronization.
PerTask
One stream per logical task.
With the tokio feature enabled, a task keeps a stable stream across
.await points even when the executor moves it between worker
threads. Outside a task, or without the tokio feature, this behaves
like PerThread.
Single
Everything runs on stream 0.
The effective behavior on wasm and no-std targets today.
Trait Implementations§
Source§impl Clone for StreamPolicy
impl Clone for StreamPolicy
Source§fn clone(&self) -> StreamPolicy
fn clone(&self) -> StreamPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for StreamPolicy
Source§impl Debug for StreamPolicy
impl Debug for StreamPolicy
Source§impl Default for StreamPolicy
impl Default for StreamPolicy
Source§fn default() -> StreamPolicy
fn default() -> StreamPolicy
Source§impl<'de> Deserialize<'de> for StreamPolicy
impl<'de> Deserialize<'de> for StreamPolicy
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<StreamPolicy, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<StreamPolicy, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for StreamPolicy
Source§impl PartialEq for StreamPolicy
impl PartialEq for StreamPolicy
Source§impl Serialize for StreamPolicy
impl Serialize for StreamPolicy
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for StreamPolicy
Auto Trait Implementations§
impl Freeze for StreamPolicy
impl RefUnwindSafe for StreamPolicy
impl Send for StreamPolicy
impl Sync for StreamPolicy
impl Unpin for StreamPolicy
impl UnsafeUnpin for StreamPolicy
impl UnwindSafe for StreamPolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more