Gpu devicetokenhashes upload - CyrilB1531/lodestar GitHub Wiki

Development build. This page describes main, not a released package. The latest published Lodestar.Gpu is 0.1.0 — read its documentation.

HomeGpuGPU kernels

DeviceTokenHashes.Upload

Flattens a batch of documents and uploads it.

public static DeviceTokenHashes Upload(GpuContext context, IReadOnlyList<IReadOnlyList<uint>> documents)

Parameterscontext is the accelerator to upload to. documents holds one sequence of token hashes per document; a document may be empty, and repeats are harmless.

ReturnsDeviceTokenHashes, owning two device buffers the caller disposes.

ExceptionsArgumentNullException when context, documents, or one of the documents, is null; ArgumentException when documents is empty.

Example — the shape a caller writes.

using Lodestar.Gpu.Compute;

using var context = GpuContext.Create(preferCpu: true);
using var resident = DeviceTokenHashes.Upload(context, [[7u, 9u], []]);

int held = resident.Count;  // => 2

Remarks — the batch is flattened into one array with an offset per document, the same shape DeviceTextBlock uses: a jagged array cannot cross into a kernel, and one allocation beats one per document.

An empty document is legal; an empty batch is not. The first is a set with no members and gets a signature of every slot at its maximum; the second leaves nothing to launch a kernel over.

Applies to — net10.0, netstandard2.1.

See alsoDeviceTokenHashes.

⚠️ **GitHub.com Fallback** ⚠️