ClikaRT::placement::PlacementScope
class
Header: ClikaRT/compute/placement.h
Ambient placement: a per-thread default StreamOrDevice that ops use when a call does not name a stream or device. Set it for a region with the RAII PlacementScope, or directly with set_ambient(). Every placement parameter's unspecified form consults the ambient (see StreamOrDevice::resolve()), so the whole op surface honors it with no per-call plumbing. An explicit stream argument always wins; an explicit device names placement: the work follows its inputs and otherwise takes the calling thread's current lane on that device, the ambient's stream when the scope set one there, otherwise the thread's own asynchronous lane (StreamOrDevice(device).resolve() names it). A device's default stream is never chosen on its own; scope one explicitly (PlacementScope(Stream::default_stream(d))) to run synchronously.
The ambient is per-thread. Setting it on one thread never affects work dispatched from another, and a traced capture resolves the ambient at capture time (the recorded graph keeps the placement it was captured with).
ClikaRT::placement::PlacementScope scope(gpu0);
auto y = ClikaRT::ops::add(a, b); // runs on the thread's lane for gpu0
// scope ends: the previous ambient is restored
RAII region: sets the calling thread's ambient placement on construction and restores the previous one on destruction (normal exit and exception unwind alike). Scopes nest; each restores exactly what it displaced. Not copyable or movable: the scope is bound to the thread and region that created it.
Member functions
PlacementScope(StreamOrDevice)
explicit PlacementScope(StreamOrDevice value)
Declared in ClikaRT/compute/placement.h, line 49
~PlacementScope()
~PlacementScope()
Declared in ClikaRT/compute/placement.h, line 51
PlacementScope(PlacementScope)
PlacementScope(const PlacementScope&) =delete
Declared in ClikaRT/compute/placement.h, line 53
operator=(PlacementScope)
PlacementScope& operator=(const PlacementScope&) =delete
Declared in ClikaRT/compute/placement.h, line 54
PlacementScope(PlacementScope)
PlacementScope(PlacementScope&&) =delete
Declared in ClikaRT/compute/placement.h, line 55
operator=(PlacementScope)
PlacementScope& operator=(PlacementScope&&) =delete
Declared in ClikaRT/compute/placement.h, line 56