Bounded intake
GgufParseOptions places explicit limits on tensor counts, metadata counts, dimensions, strings, arrays, and nesting before dependent work proceeds.
UAIX.LmRuntime / Package guide
Bounded GGUF parsing, strict validation, metadata, tensors, sharding, hashing, and mapped access.
Required For GGUF inspection and validation
UAIX.LmRuntime.Gguf
Bounded GGUF parsing, metadata and tensor catalogs, strict validation, sharding, hashing, and mapped tensor access.
GGUF parser, metadata model, tensor catalog, sharding, and validation for pure C# local LLM runtime packages.
dotnet add package UAIX.LmRuntime.Gguf
<PackageReference Include="UAIX.LmRuntime.Gguf" />
Version policy: The documentation deliberately omits UAIX.LmRuntime package version numbers. Resolve and pin versions through your normal dependency-management and lock-file process.
GgufParseOptions places explicit limits on tensor counts, metadata counts, dimensions, strings, arrays, and nesting before dependent work proceeds.
GgufModel represents container metadata and tensor descriptors. A structurally valid file can still be unsupported by a tokenizer or model-family loader.
MappedGgufFile owns the mapping lifetime. Tensor spans and views must not outlive the owner, and callers should dispose the mapping deterministically.
These are the main public entry points. The generated reference below includes the documented public package surface.
GgufReader GgufParseOptions GgufModel GgufStrictValidator GgufTensorDescriptor GgufHashingReader MappedGgufFile MappedTensorView Float32TensorReader SegmentedModelFileReader Examples use the documented public package surface. Paths, identities, runtime identifiers, device evidence, and application policy remain host inputs.
Return all structural validation errors without moving immediately into model execution.
using UAIX.LmRuntime.Gguf;
var options = new GgufParseOptions
{
MaxTensorCount = 100_000,
MaxMetadataCount = 100_000,
MaxDimensionCount = 8,
MaxStringBytes = 16 * 1024 * 1024,
MaxArrayLength = 10_000_000,
MaxArrayDepth = 8
};
GgufValidationReport report =
GgufStrictValidator.Validate("models/model.gguf", options);
if (!report.IsValid)
{
foreach (GgufValidationError error in report.Errors)
{
Console.Error.WriteLine(
$"{error.Code}: {error.Message} @ {error.ByteOffset?.ToString() ?? "n/a"}");
}
return;
}
Console.WriteLine($"Tensors: {report.Model.Tensors.Count}");
Console.WriteLine($"Metadata entries: {report.Model.Metadata.Count}");
Parse the container and enumerate the metadata/tensor catalog without materializing model weights.
using UAIX.LmRuntime.Gguf;
GgufModel model = GgufReader.Read(
"models/model.gguf",
new GgufParseOptions());
Console.WriteLine($"Artifact kind: {model.ArtifactKind}");
Console.WriteLine($"GGUF container version: {model.Version}");
Console.WriteLine($"Tensor data offset: {model.TensorDataOffset}");
Console.WriteLine($"Alignment: {model.Alignment}");
if (model.TryGetString("general.name", out string? modelName))
{
Console.WriteLine($"Model name: {modelName}");
}
foreach (GgufTensorDescriptor tensor in model.Tensors)
{
Console.WriteLine(
$"{tensor.Name}: {tensor.GgmlType}, " +
$"{tensor.ElementCount:N0} elements, {tensor.ByteLength:N0} bytes");
}
Calculate SHA-256 before accepting a local artifact into a trusted model catalog.
using UAIX.LmRuntime.Gguf;
public static class GgufIdentityVerifier
{
/// <summary>
/// Computes the current GGUF digest and rejects an artifact that does not match the trusted identity.
/// </summary>
/// <param name="modelPath">The local GGUF path to hash.</param>
/// <param name="expectedSha256">The expected 64-character SHA-256 digest.</param>
/// <returns>The normalized digest computed from the current file bytes.</returns>
public static string VerifySha256(
string modelPath,
string expectedSha256)
{
ArgumentException.ThrowIfNullOrWhiteSpace(modelPath);
ArgumentException.ThrowIfNullOrWhiteSpace(expectedSha256);
string actualSha256 = GgufHashingReader.ComputeSha256(modelPath);
if (!string.Equals(
actualSha256,
expectedSha256,
StringComparison.OrdinalIgnoreCase))
{
throw new InvalidDataException(
"The GGUF artifact hash does not match the trusted identity.");
}
return actualSha256;
}
}
Keep the mapped file alive while reading a tensor view and copy values only when the caller needs an owned array.
using System.Linq;
using UAIX.LmRuntime.Gguf;
using UAIX.LmRuntime.Tensors;
GgufModel model = GgufReader.Read(
"models/model.gguf",
new GgufParseOptions());
GgufTensorDescriptor descriptor = model.Tensors
.First(tensor => tensor.GgmlType == GgmlTensorType.F32);
using var mapped = new MappedGgufFile(model);
MappedTensorView view = mapped.CreateTensorView(
descriptor,
descriptor.Dimensions);
var reader = new Float32TensorReader(view);
float firstValue = reader.ReadElement(0);
float[] ownedValues = reader.ToArray();
Console.WriteLine($"First value: {firstValue}");
Console.WriteLine($"Copied values: {ownedValues.Length}");
Expand a type to review its documented public fields, properties, constructors, methods, parameter descriptions, and return descriptions.
GgufArtifactKindUAIX.LmRuntime.Gguf
5 members
Identifies the likely role of a GGUF artifact.
BaseModel
Base model artifact.
VocabOnly
Vocabulary-only artifact.
LoraSidecar
LoRA sidecar artifact.
MultimodalProjectorSidecar
Multimodal projector sidecar artifact.
MultiTokenPredictionSidecar
Multi-token-prediction sidecar artifact.
GgufByteOrderUAIX.LmRuntime.Gguf
3 members
Identifies the byte order used by a GGUF artifact.
Auto
Detect the byte order from the version field and reject ambiguous headers.
LittleEndian
Interpret multi-byte values as little-endian.
BigEndian
Interpret multi-byte values as big-endian.
GgufDiagnosticUAIX.LmRuntime.Gguf
3 members
Represents a structured GGUF parser diagnostic.
Code
Gets the stable diagnostic code.
Message
Gets the diagnostic message.
ByteOffset
Gets the byte offset associated with the diagnostic when known.
GgufParseResultUAIX.LmRuntime.Gguf
3 members
Represents a non-throwing GGUF parse result.
Model
Gets the parsed model when parsing succeeded.
Diagnostics
Gets parser diagnostics.
Succeeded
Gets a value indicating whether parsing succeeded without diagnostics.
GgufFormatExceptionUAIX.LmRuntime.Gguf
3 members
Represents a GGUF format violation with a stable code and byte offset.
GgufFormatException(string,string,System.Nullable<ulong>,System.Exception)
Initializes a new GgufFormatException instance with validated dependencies and operational bounds.
codemessagebyteOffsetinnerExceptionCode
Gets the stable diagnostic code.
ByteOffset
Gets the byte offset associated with the violation when known.
GgufDumpWriterUAIX.LmRuntime.Gguf
1 member
Writes human-readable GGUF metadata and tensor catalog dumps.
Write(UAIX.LmRuntime.Gguf.GgufModel)
Creates a textual dump for a parsed GGUF model.
modelReturns: The text produced by GgufDumpWriter.Write for this contract: Creates a textual dump for a parsed GGUF model. The returned string is detached from mutable caller storage and is not persisted by the operation.
GgufMetadataAccessorsUAIX.LmRuntime.Gguf
6 members
Provides strongly typed accessors for GGUF metadata values.
TryGetBoolean(UAIX.LmRuntime.Gguf.GgufModel,string,bool&)
Tries to read a Boolean metadata value.
modelkeyvalueReturns: True when the key exists and contains a Boolean value.
TryGetStringArray(UAIX.LmRuntime.Gguf.GgufModel,string,System.Collections.Generic.IReadOnlyList<string>&)
Tries to read a metadata string array.
modelkeyvaluesReturns: True when the key exists and contains only string elements.
TryGetSingleArray(UAIX.LmRuntime.Gguf.GgufModel,string,System.Collections.Generic.IReadOnlyList<float>&)
Tries to read a metadata single-precision floating point array.
modelkeyvaluesReturns: True when the key exists and contains numeric elements convertible to float.
TryGetInt32Array(UAIX.LmRuntime.Gguf.GgufModel,string,System.Collections.Generic.IReadOnlyList<int>&)
Tries to read a metadata 32-bit signed integer array.
modelkeyvaluesReturns: True when the key exists and contains integral elements convertible to int.
TryGetByteArray(UAIX.LmRuntime.Gguf.GgufModel,string,System.Collections.Generic.IReadOnlyList<byte>&)
Tries to read a metadata byte array.
modelkeyvaluesReturns: True when the key exists and contains integral elements convertible to bytes.
TryGetInt32(UAIX.LmRuntime.Gguf.GgufModel,string,int&)
Tries to read a metadata 32-bit signed integer scalar.
modelkeyvalueReturns: True when the key exists and contains an integral value convertible to int.
GgufMetadataValueUAIX.LmRuntime.Gguf
4 members
Represents a typed GGUF metadata value.
Type
Gets the metadata value type.
Value
Gets the scalar value or a for arrays.
Create(UAIX.LmRuntime.Gguf.GgufMetadataValueType,object)
Creates the GGUF metadata value from the validated inputs required by GgufMetadataValue.
typevalueReturns: The metadata value, with ownership and disposal obligations defined by the returned type and the Create contract.
ToString
Returns the string representation of this value.
Returns: The text produced by GgufMetadataValue.ToString for this contract: Returns the string representation of this value. The returned string is detached from mutable caller storage and is not persisted by the operation.
GgufMetadataArrayUAIX.LmRuntime.Gguf
3 members
Represents a typed GGUF metadata array.
ElementType
Gets the element type.
Items
Gets the array values.
ToString
Returns a concise description of this array.
Returns: The text produced by GgufMetadataArray.ToString for this contract: Returns a concise description of this array. The returned string is detached from mutable caller storage and is not persisted by the operation.
GgufMetadataValueTypeUAIX.LmRuntime.Gguf
13 members
Identifies GGUF metadata value types.
UInt8
8-bit unsigned integer.
Int8
8-bit signed integer.
UInt16
16-bit unsigned integer.
Int16
16-bit signed integer.
UInt32
32-bit unsigned integer.
Int32
32-bit signed integer.
Float32
32-bit floating point.
Bool
Boolean.
String
UTF-8 string.
Array
Typed array.
UInt64
64-bit unsigned integer.
Int64
64-bit signed integer.
Float64
64-bit floating point.
GgufModelUAIX.LmRuntime.Gguf
15 members
Represents a parsed GGUF artifact catalog and metadata dictionary.
Path
Gets the source file path.
Version
Gets the GGUF format version.
ByteOrder
Gets the resolved byte order used by the artifact.
FileLength
Gets the source file length captured during parsing.
Metadata
Gets the parsed metadata dictionary.
Tensors
Gets the tensor catalog.
TensorDataOffset
Gets the absolute tensor-data section start offset.
Alignment
Gets the tensor-data alignment.
Shard
Gets shard metadata.
ArtifactKind
Gets the inferred artifact kind.
Load(string,UAIX.LmRuntime.Gguf.GgufParseOptions)
Loads the GGUF model from a verified local source into GgufModel.
pathoptionsReturns: The parsed model catalog, with ownership and disposal obligations defined by the returned type and the Load contract.
TryGetString(string,string&)
Tries to get a string metadata value.
keyvalueReturns: True when the key exists and contains a string.
TryGetUInt32(string,uint&)
Tries to get an unsigned 32-bit metadata value.
keyvalueReturns: True when the key exists and can be converted to an unsigned 32-bit integer.
TryGetSingle(string,float&)
Tries to get a single-precision metadata value.
keyvalueReturns: True when the key exists and can be converted to a single-precision value.
TryGetTensor(string,UAIX.LmRuntime.Gguf.GgufTensorDescriptor&)
Tries to resolve a tensor descriptor by its exact GGUF name.
nametensorReturns: True when try get tensor succeeds for the supplied values; otherwise, false.
GgufParseOptionsUAIX.LmRuntime.Gguf
7 members
Defines safety limits for GGUF parsing.
ByteOrder
Gets the requested GGUF byte order. Auto uses the version-field heuristic.
MaxTensorCount
Gets the maximum supported tensor count.
MaxMetadataCount
Gets the maximum supported metadata key-value count.
MaxDimensionCount
Gets the maximum supported dimension count per tensor.
MaxStringBytes
Gets the maximum metadata string byte length.
MaxArrayLength
Gets the maximum metadata array length.
MaxArrayDepth
Gets the maximum recursive array depth.
GgufReaderUAIX.LmRuntime.Gguf
2 members
Reads and validates GGUF model artifacts.
Read(string,UAIX.LmRuntime.Gguf.GgufParseOptions)
Reads a GGUF artifact from disk without copying tensor payloads to managed memory.
pathoptionsReturns: The GgufModel result produced by GgufReader.Read for this contract: Reads a GGUF artifact from disk without copying tensor payloads to managed memory. It is published only after all documented validation and ownership transitions succeed.
TryRead(string,UAIX.LmRuntime.Gguf.GgufParseOptions)
Parses a GGUF artifact and returns structured diagnostics instead of throwing for format failures.
pathoptionsReturns: True when the GGUF parse result is produced successfully; otherwise, false and no successful result is published.
GgufShardInfoUAIX.LmRuntime.Gguf
3 members
Describes sharding metadata found in a GGUF artifact.
ShardIndex
Gets the shard index when present.
ShardCount
Gets the shard count when present.
IsSharded
Gets a value indicating whether sharding metadata was found.
GgufTensorDescriptorUAIX.LmRuntime.Gguf
7 members
Describes a tensor stored in a GGUF artifact without copying its payload.
Name
Gets the tensor name.
Dimensions
Gets tensor dimensions in GGUF order.
GgmlType
Gets the GGML storage type.
ElementCount
Gets the logical element count.
RelativeOffset
Gets the relative tensor offset from the tensor data section.
AbsoluteOffset
Gets the absolute file offset for this tensor.
ByteLength
Gets the physical tensor byte length.
GgufValidationReportUAIX.LmRuntime.Gguf
3 members
Represents the result of strict GGUF validation.
IsValid
Gets a value indicating whether validation succeeded.
Errors
Gets validation errors with byte offsets when known.
Model
Gets the parsed model when validation succeeded.
GgufValidationErrorUAIX.LmRuntime.Gguf
3 members
Represents a GGUF validation error.
Code
Gets the diagnostic code.
Message
Gets the diagnostic message.
ByteOffset
Gets the byte offset associated with the error, if known.
GgufStrictValidatorUAIX.LmRuntime.Gguf
1 member
Validates GGUF artifacts without claiming execution parity.
Validate(string,UAIX.LmRuntime.Gguf.GgufParseOptions)
Validates the supplied path and the supplied options against the invariants required by GgufStrictValidator.
pathoptionsReturns: The GgufValidationReport result produced by GgufStrictValidator.Validate for this contract: Validates the supplied path and the supplied options against the invariants required by GgufStrictValidator. It is published only after all documented validation and ownership transitions succeed.
GgufShardResolverUAIX.LmRuntime.Gguf
1 member
Resolves GGUF shard files adjacent to a root artifact.
ResolveShards(string)
Resolves likely shard paths for a GGUF model path.
pathReturns: An ordered read-only IReadOnlyList<string> result from GgufShardResolver.ResolveShards: Resolves likely shard paths for a GGUF model path. Mutable internal collection aliases are not exposed through the returned contract.
GgufTensorPayloadViewUAIX.LmRuntime.Gguf
3 members
Represents a zero-copy tensor payload range inside a GGUF file.
AbsoluteOffset
Gets the absolute file offset.
LengthBytes
Gets the payload byte length.
FromTensor(UAIX.LmRuntime.Gguf.GgufTensorDescriptor)
Creates a payload view from a tensor descriptor.
tensorReturns: The GgufTensorPayloadView result produced by GgufTensorPayloadView.FromTensor for this contract: Creates a payload view from a tensor descriptor. It is published only after all documented validation and ownership transitions succeed.
GgufArtifactClassifierUAIX.LmRuntime.Gguf
1 member
Classifies GGUF artifacts from metadata.
Classify(UAIX.LmRuntime.Gguf.GgufModel)
Classifies the GGUF artifact kind from validated metadata and tensor-layout evidence.
modelReturns: The GgufArtifactKind result produced by GgufArtifactClassifier.Classify for this contract: Classifies the GGUF artifact kind from validated metadata and tensor-layout evidence. It is published only after all documented validation and ownership transitions succeed.
GgufMetadataKeyPolicyUAIX.LmRuntime.Gguf
1 member
Validates GGUF metadata key syntax.
Validate(string)
Validates the supplied key against the invariants required by GgufMetadataKeyPolicy.
keyReturns: The GgufValidationError? result produced by GgufMetadataKeyPolicy.Validate for this contract: Validates the supplied key against the invariants required by GgufMetadataKeyPolicy. It is published only after all documented validation and ownership transitions succeed.
GgufHashingReaderUAIX.LmRuntime.Gguf
1 member
Computes integrity hashes for GGUF and related model artifacts.
ComputeSha256(string)
Computes the SHA-256 hash of a file.
pathReturns: The text produced by GgufHashingReader.ComputeSha256 for this contract: Computes the SHA-256 hash of a file. The returned string is detached from mutable caller storage and is not persisted by the operation.
GgufJsonDumpWriterUAIX.LmRuntime.Gguf
1 member
Writes machine-readable GGUF dump JSON.
Write(UAIX.LmRuntime.Gguf.GgufModel)
Writes a stable JSON dump for a parsed GGUF model.
modelReturns: The text produced by GgufJsonDumpWriter.Write for this contract: Writes a stable JSON dump for a parsed GGUF model. The returned string is detached from mutable caller storage and is not persisted by the operation.
IMappedModelFileUAIX.LmRuntime.Gguf
6 members
Defines bounded, zero-copy access to tensor payloads in a mapped model artifact.
Model
Gets the parsed GGUF model catalog associated with the mapping.
FileLength
Gets the mapped file length in bytes.
GetTensorBytes(UAIX.LmRuntime.Gguf.GgufTensorDescriptor)
Gets a synchronous read-only span over one tensor payload.
tensorReturns: A read-only span valid until this mapping is disposed.
GetTensorMemory(UAIX.LmRuntime.Gguf.GgufTensorDescriptor)
Gets a read-only memory view over one tensor payload.
tensorReturns: A read-only memory view whose owner remains the mapped file.
TryGetTensorMemory(string,System.ReadOnlyMemory<byte>&)
Attempts to get a read-only memory view by tensor name.
tensorNamememoryReturns: True when try get tensor memory succeeds for the supplied values; otherwise, false.
GetMemorySegments(ulong,ulong,int)
Creates bounded read-only memory windows for a validated mapped-file range.
absoluteOffsetbyteLengthmaximumSegmentByteCountReturns: Ordered borrowed segments whose combined length equals byteLength.
MappedGgufFileUAIX.LmRuntime.Gguf
14 members
Owns a read-only operating-system mapping of a GGUF artifact and exposes bounded tensor payload views.
The mapping is the sole owner of the acquired unmanaged pointer. Returned spans and memory views borrow that pointer and become invalid immediately after . Public entry points verify that descriptors belong to the parsed catalog before pointer arithmetic occurs.
MappedGgufFile(string,UAIX.LmRuntime.Gguf.GgufParseOptions)
Opens, validates, and maps a GGUF file read-only.
pathoptionsMappedGgufFile(UAIX.LmRuntime.Gguf.GgufModel)
Maps a GGUF file using an already validated catalog.
modelModel
Gets the immutable GGUF catalog that was validated before the operating-system mapping was opened.
FileLength
Gets the mapped file length captured from the validated catalog.
IsDisposed
Gets a value indicating whether the mapping has been disposed.
GetTensorBytes(UAIX.LmRuntime.Gguf.GgufTensorDescriptor)
Gets a synchronous borrowed span over one catalog tensor payload.
tensorReturns: A read-only span whose lifetime cannot exceed the current synchronous call chain.
GetTensorMemory(UAIX.LmRuntime.Gguf.GgufTensorDescriptor)
Gets a borrowed memory object over one catalog tensor payload.
tensorReturns: A read-only memory view backed directly by the operating-system mapping.
TryGetTensorMemory(string,System.ReadOnlyMemory<byte>&)
Tries to resolve a named tensor and create a borrowed mapped-memory view.
tensorNamememoryReturns: True when the tensor exists and a view was created; otherwise false.
GetMemorySegments(ulong,ulong,int)
Splits a validated mapped-file range into bounded borrowed memory segments.
absoluteOffsetbyteLengthmaximumSegmentByteCountReturns: Ordered borrowed memory segments that exactly cover the requested range.
GetBytes(ulong,ulong)
Gets a read-only span over a validated file range.
absoluteOffsetbyteLengthReturns: The bounded ReadOnlySpan<byte> view produced by MappedGgufFile.GetBytes: Gets a read-only span over a validated file range. Its lifetime and ownership remain tied to the owner identified by the containing type; no out-of-range region is exposed.
CopyBytes(ulong,System.Span<byte>)
Copies a validated mapped-file range into a caller-owned destination.
absoluteOffsetdestinationCopyTensorBytes(UAIX.LmRuntime.Gguf.GgufTensorDescriptor,System.Span<byte>)
Copies a complete tensor payload into a caller-owned destination.
tensordestinationCreateTensorView(UAIX.LmRuntime.Gguf.GgufTensorDescriptor,System.Collections.Generic.IReadOnlyList<ulong>)
Creates a read-only typed tensor view whose lifetime is owned by this mapping.
tensorlogicalDimensionsReturns: The borrowed mapped tensor view, with ownership and disposal obligations defined by the returned type and the CreateTensorView contract.
Dispose
Releases the acquired view pointer, operating-system mapping handles, and source file handle.
IReadOnlyTensorViewUAIX.LmRuntime.Gguf
8 members
Defines a read-only tensor view backed by validated model storage.
Descriptor
Gets the authoritative GGUF tensor descriptor.
StorageDimensions
Gets dimensions in GGUF storage order.
LogicalDimensions
Gets normalized logical row-major dimensions.
DataType
Gets the runtime data type.
ByteOrder
Gets the GGUF byte order.
IsDisposed
Gets whether the backing owner has been disposed.
GetMemory
Gets a borrowed read-only memory view over the tensor payload.
Returns: The memory region containing the memory, bounded to the validated range owned by the result.
GetSpan
Gets a synchronous borrowed span over the tensor payload.
Returns: The bounded ReadOnlySpan<byte> view produced by IReadOnlyTensorView.GetSpan: Gets a synchronous borrowed span over the tensor payload. Its lifetime and ownership remain tied to the owner identified by the containing type; no out-of-range region is exposed.
MappedTensorViewUAIX.LmRuntime.Gguf
9 members
Carries validated tensor geometry and a borrowed read-only view into a mapped GGUF file.
MappedTensorView(UAIX.LmRuntime.Gguf.MappedGgufFile,UAIX.LmRuntime.Gguf.GgufTensorDescriptor,System.Collections.Generic.IReadOnlyList<ulong>)
Initializes a new MappedTensorView instance with validated dependencies and operational bounds.
ownerdescriptorlogicalDimensionsDescriptor
StorageDimensions
LogicalDimensions
DataType
ByteOrder
IsDisposed
GetMemory
Retrieves the memory from the current MappedTensorView state after validating the requested access.
Returns: The memory region containing the memory, bounded to the validated range owned by the result.
GetSpan
Retrieves the span from the current MappedTensorView state after validating the requested access.
Returns: The bounded ReadOnlySpan<byte> view produced by MappedTensorView.GetSpan: Retrieves the span from the current MappedTensorView state after validating the requested access. Its lifetime and ownership remain tied to the owner identified by the containing type; no out-of-range region is exposed.
Float32TensorReaderUAIX.LmRuntime.Gguf
5 members
Reads float32 values from a validated tensor view with explicit GGUF byte-order handling.
Float32TensorReader(UAIX.LmRuntime.Gguf.IReadOnlyTensorView)
Initializes a new Float32TensorReader instance with validated dependencies and operational bounds.
viewElementCount
Gets the logical float32 element count.
ReadElement(int)
Reads one element by flat storage index.
indexReturns: The float value computed by Float32TensorReader.ReadElement for this contract: Reads one element by flat storage index. Range, finite-value, and overflow checks are completed before the value is returned.
CopyTo(System.Span<float>)
Decodes every element into a caller-provided destination.
destinationToArray
Creates an explicit bounded managed copy for scalar reference execution.
Returns: A newly allocated float[] containing the ordered result of Float32TensorReader.ToArray: Creates an explicit bounded managed copy for scalar reference execution. The caller owns the returned array and later mutation cannot alter the source object.
SegmentedModelFileOptionsUAIX.LmRuntime.Gguf
1 member
Configures bounded segmented reads from a model file whose logical offsets remain unsigned 64-bit values.
MaximumSegmentByteCount
Gets the maximum bytes returned by one owned segment.
ModelFileSegmentUAIX.LmRuntime.Gguf
5 members
Owns one pooled, bounded model-file segment returned by .
The segment owns an lease. Consumers may retain only while this instance is alive and must dispose the segment exactly once when the bytes are no longer needed.
Offset
Gets the unsigned logical file offset represented by this segment.
Length
Gets the number of valid bytes in the segment.
IsDisposed
Gets whether the pooled segment has been released.
Memory
Gets the read-only segment bytes while this owner remains alive.
Dispose
Returns the rented byte array to the shared pool and invalidates Memory.
SegmentedModelFileReaderUAIX.LmRuntime.Gguf
7 members
Reads bounded windows from a local model file without representing the complete file as one managed span.
Logical positions remain unsigned 64-bit values until the final checked conversion required by the operating-system random-access API. Returned owned segments are copies in pooled memory; caller-provided spans remain caller owned. This class performs no network access and never follows URLs.
SegmentedModelFileReader(string,UAIX.LmRuntime.Gguf.SegmentedModelFileOptions)
Opens a local model file for deterministic random access.
pathoptionsLength
Gets the file length as an unsigned 64-bit value.
MaximumSegmentByteCount
Gets the maximum owned segment size.
IsDisposed
Gets whether the reader has released its file handle.
ReadExactly(ulong,System.Span<byte>)
Reads exactly into a caller-owned bounded destination.
offsetdestinationReadSegment(ulong,int)
Reads the segment from the current binary source using the component's validated representation.
offsetlengthReturns: The ModelFileSegment result produced by SegmentedModelFileReader.ReadSegment for this contract: Reads the segment from the current binary source using the component's validated representation. It is published only after all documented validation and ownership transitions succeed.
Dispose
Releases resources owned by SegmentedModelFileReader and transitions it to the disposed state.
Read is the direct parse path and can throw for invalid input. TryRead returns a GgufParseResult containing success state, diagnostics, and the parsed model when available.
No. It proves the checked container invariants. Tokenizer compatibility, architecture support, required tensors, storage layouts, and execution still need their own validation gates.
No. Treat every span, memory segment, and mapped tensor view as borrowing the mapping lifetime.
No. The caller supplies local paths and owns model acquisition, licensing review, and trust policy.