Table of Contents

Class TensorRtTimingCache

Namespace
JYPPX.TensorRtSharp
Assembly
JYPPX.TensorRtSharp.dll

Managed wrapper around a TensorRT timing cache. TensorRT timing cache 的托管封装。

public sealed class TensorRtTimingCache : IDisposable
Inheritance
TensorRtTimingCache
Implements
Inherited Members

Fields

KeySizeInBytes

The fixed size of one TensorRT timing-cache key in bytes. 单个 TensorRT timing cache key 的固定字节长度。

public const int KeySizeInBytes = 16

Field Value

int

Properties

Line

Gets the TensorRT API line used by this timing cache. 获取当前 timing cache 使用的 TensorRT API line。

public TensorRtApiLine Line { get; }

Property Value

TensorRtApiLine

Methods

Combine(TensorRtTimingCache, bool)

Merges another timing cache into this timing cache. 将另一个 timing cache 合并到当前 timing cache 中。

public bool Combine(TensorRtTimingCache inputCache, bool ignoreMismatch = false)

Parameters

inputCache TensorRtTimingCache

The timing cache to merge. 要合并的 timing cache。

ignoreMismatch bool

Whether TensorRT should ignore cache mismatches. TensorRT 是否忽略 cache 不匹配。

Returns

bool

true when TensorRT applied the merge. TensorRT 应用合并时返回 true

Dispose()

Releases the TensorRT timing-cache handle. 释放 TensorRT timing cache 句柄。

public void Dispose()

QueryKeyBytes()

Copies the flattened timing-cache key bytes. 复制扁平化的 timing cache key 字节数据。

public byte[] QueryKeyBytes()

Returns

byte[]

The concatenated key bytes. 拼接后的 key 字节数组。

QueryKeyCount()

Gets the number of timing-cache keys stored in the cache. 获取当前 cache 中存储的 timing cache key 数量。

public long QueryKeyCount()

Returns

long

The key count. key 数量。

QueryKeys()

Returns timing-cache keys as individual 16-byte arrays. 将 timing cache key 作为独立的 16 字节数组返回。

public IReadOnlyList<byte[]> QueryKeys()

Returns

IReadOnlyList<byte[]>

A read-only list of keys. key 的只读列表。

Reset()

Resets the timing cache contents. 重置 timing cache 内容。

public bool Reset()

Returns

bool

true when the cache was reset successfully. 成功重置 cache 时返回 true

Serialize()

Serializes the timing cache into TensorRT host memory. 将 timing cache 序列化为 TensorRT host memory。

public TensorRtHostMemory Serialize()

Returns

TensorRtHostMemory

The serialized timing-cache payload. 序列化的 timing cache 负载。

TryQuery(byte[], out TensorRtTimingCacheValue)

Tries to query one timing-cache entry by key. 尝试按 key 查询一个 timing cache 条目。

public bool TryQuery(byte[] key, out TensorRtTimingCacheValue value)

Parameters

key byte[]

The 16-byte timing-cache key. 16 字节 timing cache key。

value TensorRtTimingCacheValue

The queried value. 查询到的值。

Returns

bool

true when the key exists. key 存在时返回 true

Update(byte[], TensorRtTimingCacheValue)

Updates one timing-cache entry with a prebuilt value object. 使用预构建值对象更新一个 timing cache 条目。

public bool Update(byte[] key, TensorRtTimingCacheValue value)

Parameters

key byte[]

The 16-byte timing-cache key. 16 字节 timing cache key。

value TensorRtTimingCacheValue

The value to store. 要写入的值。

Returns

bool

true when TensorRT accepted the update. TensorRT 接受更新时返回 true

Update(byte[], ulong, float)

Updates one timing-cache entry with explicit tactic and timing data. 使用显式 tactic 与 timing 数据更新一个 timing cache 条目。

public bool Update(byte[] key, ulong tacticHash, float timingMilliseconds)

Parameters

key byte[]

The 16-byte timing-cache key. 16 字节 timing cache key。

tacticHash ulong

The TensorRT tactic hash. TensorRT tactic 哈希值。

timingMilliseconds float

The observed timing in milliseconds. 观测到的 timing,单位为毫秒。

Returns

bool

true when TensorRT accepted the update. TensorRT 接受更新时返回 true