Declared Resource Manager#
-
class DeclaredResourceAllocator#
Allocation seam for Initialization/healthy Deinitialization and local fault injection. On failure, output still identifies any acquired resource; release failure retains ownership. Memory has at least fundamental alignment. The allocator outlives the resource manager.
Public Functions
-
virtual ~DeclaredResourceAllocator() = default#
- virtual SafetyStatus allocate(
- RuntimeMemoryRequest const &request,
- void *&output
-
virtual SafetyStatus release(RuntimeMemoryView memory) noexcept = 0#
-
virtual SafetyStatus createStream(cudaStream_t &output) noexcept = 0#
-
virtual SafetyStatus destroyStream(cudaStream_t stream) noexcept = 0#
-
virtual SafetyStatus createEvent(cudaEvent_t &output) noexcept = 0#
-
virtual SafetyStatus destroyEvent(cudaEvent_t event) noexcept = 0#
-
virtual ~DeclaredResourceAllocator() = default#
-
class DeclaredResourceManager#
Owned by SafetyRuntime; access and lifecycle calls are externally serialized. Destroy capabilities/model-local objects before deinitialize(). Destruction performs no SDK calls.
Public Functions
- explicit DeclaredResourceManager(
- LifecycleState &lifecycleState
- DeclaredResourceManager(
- LifecycleState &lifecycleState,
- DeclaredResourceAllocator &allocator
-
~DeclaredResourceManager() noexcept#
-
DeclaredResourceManager(DeclaredResourceManager const&) = delete#
- DeclaredResourceManager &operator=(
- DeclaredResourceManager const&
- SafetyStatus prepareResources(
- std::vector<ResourceDeclaration> const &declarations
Validate every declaration, then allocate owned resources. Views become available only on success.
- SafetyStatus resolveBorrowedResources(
- ResourceOwnerId owner,
- BorrowedResourceResolver const &resolver
Resolve one owner’s borrows atomically. Resolve factory inputs before constructing model-local objects, then resolve capabilities borrowing those objects. All owners must be resolved before Operational.
- SafetyStatus resourcesFor(
- ResourceOwnerId owner,
- PreparedResources &output
- SafetyStatus memory(
- ResourceOwnerId owner,
- RuntimeResourceKey key,
- RuntimeMemoryView &output
Typed lookups validate the owner, preparation and lifecycle before exposing a borrowed view.
- SafetyStatus tensor(
- ResourceOwnerId owner,
- RuntimeResourceKey key,
- RuntimeTensorView const *&output
- SafetyStatus stream(
- ResourceOwnerId owner,
- RuntimeResourceKey key,
- cudaStream_t &output
- SafetyStatus event(
- ResourceOwnerId owner,
- RuntimeResourceKey key,
- cudaEvent_t &output
- SafetyStatus modelLocalData(
- ResourceOwnerId owner,
- RuntimeResourceKey key,
- SafetyModelLocalData *&output
- SafetyStatus containerStorage(
- ResourceOwnerId owner,
- SafetyContainerStorage *&output
- SafetyStatus validateInitialization(
- ResourceOwnerId owner
Factory/capability setup requires prepared resources during Initialization.
-
SafetyStatus validatePrepared() const noexcept#
Check all borrows before SafetyRuntime publishes Operational readiness.
-
SafetyStatus status() const noexcept#
-
inline bool hasResources() const noexcept#
-
SafetyStatus deinitialize() noexcept#
SafetyRuntime closes execution before caller-owned objects and declared storage are released.
-
void abandonAfterFatal(SafetyStatus status) noexcept#
Latch an external fatal failure before any attempted teardown; retain resources for containment.