Table of Contents

Class TensorRtGpuAllocatorCallbackOwner

Namespace
JYPPX.TensorRtSharp
Assembly
JYPPX.TensorRtSharp.dll

Owns a native TensorRT IGpuAllocator and its pointer-free managed policy callback. 管理 native TensorRT IGpuAllocator 及其无指针托管策略回调。

public sealed class TensorRtGpuAllocatorCallbackOwner : IDisposable
Inheritance
TensorRtGpuAllocatorCallbackOwner
Implements
Inherited Members

Remarks

Native code owns all CUDA allocations. Runtime and builder wrappers retain this owner, and every engine they create inherits an additional lease because TensorRT may keep using the allocator after its creator is detached or disposed. 所有 CUDA 分配均由 native 代码持有。Runtime、builder 及其创建的每个 engine 都会保留 owner 租约。

Constructors

TensorRtGpuAllocatorCallbackOwner(TensorRtApiLine, TensorRtGpuAllocatorHandler)

Creates a real native GPU allocator owner. 创建真实 native GPU allocator owner。

public TensorRtGpuAllocatorCallbackOwner(TensorRtApiLine line, TensorRtGpuAllocatorHandler handler)

Parameters

line TensorRtApiLine

TensorRT 8, 10, or 11. TensorRT 8、10 或 11。

handler TensorRtGpuAllocatorHandler

The pointer-free managed policy handler. 无指针托管策略处理器。

Properties

AttachmentTarget

Gets the current managed attachment target. 获取当前托管挂载目标。

public TensorRtGpuAllocatorAttachmentTarget AttachmentTarget { get; }

Property Value

TensorRtGpuAllocatorAttachmentTarget

IsAttached

Gets whether the owner is attached to a runtime or builder. 获取 owner 是否挂载到 runtime 或 builder。

public bool IsAttached { get; }

Property Value

bool

IsDisposed

Gets whether dispose was requested. 获取是否已请求释放。

public bool IsDisposed { get; }

Property Value

bool

Line

Gets the TensorRT API line. 获取 TensorRT API 版本线。

public TensorRtApiLine Line { get; }

Property Value

TensorRtApiLine

Methods

Dispose()

Requests release; actual release is deferred until every TensorRT borrower is gone. 请求释放;实际释放延迟到所有 TensorRT 借用者结束。

public void Dispose()

~TensorRtGpuAllocatorCallbackOwner()

Releases native resources after all TensorRT borrowers are gone when the caller did not dispose the owner explicitly. 调用方未显式释放 owner 时,在所有 TensorRT 借用者结束后释放 native 资源。

protected ~TensorRtGpuAllocatorCallbackOwner()

GetRuntimeSnapshot()

Gets a copied, pointer-free native runtime snapshot. 获取复制后的无指针 native 运行快照。

public TensorRtGpuAllocatorRuntimeSnapshot GetRuntimeSnapshot()

Returns

TensorRtGpuAllocatorRuntimeSnapshot