Gpu 0.1.0 devicetokenhashes upload - CyrilB1531/lodestar GitHub Wiki

Lodestar.Gpu 0.1.0. This page is frozen at that release. Read the current documentation for what main says now. A link to a decision or a migration page follows main, and leaves the archive.

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** ⚠️