gguf.h#
See the exact block support matrix for the pinned layouts and the boundary between payload and checkpoint/container support.
-
namespace onnx_light
Alias that makes onnx-light headers compatible with code that references
ONNX_LIGHT_NAMESPACE(the macro used in the standard onnx package).Set to
ONNX_LIGHT_NAMESPACEso both names resolve to the same namespace.Symbol-visibility attribute for the public onnx-light C++ API.
Maps the upstream compatibility macro to onnx-light’s explicit proto ABI annotation. This keeps declarations from vendored ONNX headers visible when
lib_onnx_protouses hidden visibility by default.Namespace alias so that ONNX C++ code (and consumers such as onnxruntime) that refers to the literal
onnxnamespace — rather than theONNX_NAMESPACEmacro — resolves to the onnx-light namespace. The standard onnx package lives innamespace onnx; onnx-light usesonnx_light(via ONNX_LIGHT_NAMESPACE), so this alias keeps onnx-light a true drop-in. It is only introduced when the onnx-light namespace differs fromonnx.-
namespace core
-
namespace runtime
Functions
-
const std::vector<GgufBlockLayout> &GgufBlockLayouts()#
Returns physical block metadata for native GGML formats in QuantizationFormats().
-
const GgufBlockLayout &GgufLayout(std::string_view subtype)#
Returns a canonical layout; rejects aliases and unsupported subtypes.
-
EncodedValueProto ImportGgufTensorPayload(std::string_view data, Shape shape, std::string subtype, std::string layout_version = kGgufLayoutVersion, std::string upstream_revision = kGgufUpstreamRevision, size_t max_bytes = kGgufDefaultMaxBytes)#
Stores exact GGML bytes in EncodedValueProto, without repacking or requantization. Records the logical FLOAT shape and native subtype in the standard structured type. Bounds both packed and FLOAT32 decoded sizes.
-
std::string ExportGgufTensorPayload(const EncodedValueProto &payload, size_t max_bytes = kGgufDefaultMaxBytes, const StructTypeCatalogue &catalogue = {})#
Validates and returns unchanged payload bytes, with the same size limits as import.
-
Tensor DequantizeGgufTensorPayload(const EncodedValueProto &payload, size_t max_bytes = kGgufDefaultMaxBytes, const StructTypeCatalogue &catalogue = {}, RawBufferAllocator *allocator = nullptr)#
Validates and reconstructs an owning FLOAT32 tensor in logical row-major order.
-
GgufBlockParameters ReadGgufBlockParameters(const EncodedValueProto &payload, size_t block_index, size_t max_bytes = kGgufDefaultMaxBytes, const StructTypeCatalogue &catalogue = {})#
Validates payload metadata and the requested block, returning its effective parameters.
-
EncodedValueProto ImportGptqModelGgufWeights(const GptqModelGgufWeights &weights, size_t max_bytes = kGgufDefaultMaxBytes)#
Imports a block-aligned UINT8 checkpoint matrix as a native EncodedValueProto. Preserves qweight bytes and is decoded by the standard DequantizeTensor APIs.
-
void ValidateGptqModelGgufMetadata(const Shape &packed_shape, size_t packed_bytes, const Shape &shape, std::string_view subtype, std::string_view layout_version = kGgufLayoutVersion, std::string_view upstream_revision = kGgufUpstreamRevision, size_t max_bytes = kGgufDefaultMaxBytes)#
Validates checkpoint shapes, layout metadata and both byte budgets without accessing storage. Allows bindings to reject invalid metadata before making a contiguous copy.
-
GptqModelGgufWeights ExportGptqModelGgufWeights(const EncodedValueProto &payload, size_t max_bytes = kGgufDefaultMaxBytes, const StructTypeCatalogue &catalogue = {})#
Validates and exports unchanged blocks as an owning UINT8 checkpoint matrix.
Variables
-
constexpr char kGgufLayoutVersion[] = "ggml-blocks-v1"#
-
constexpr char kGgufUpstreamRevision[] = "c1976918cfe3703fbcf6d1ce2440a82b26394375"#
-
constexpr char kGgufReferenceRevision[] = "0c1e57098bba43ac29e6e3b677cdceebdd22334f"#
-
constexpr char kGgufTypePrefix[] = "onnx_light.gguf.ggml-blocks-v1/"#
-
constexpr size_t kGgufDefaultMaxBytes = size_t{1} << 30#
-
struct GgufBlockLayout#
- #include <gguf.h>
-
struct GgufBlockParameters#
- #include <gguf.h>
Stores effective FLOAT32 subgroup multipliers and subtractive minima in logical order. Q4_0, Q8_0, IQ4_NL and TQ formats have one scale; Q2_K has sixteen scales/minima; Q4_K and Q5_K have eight scales/minima; Q3_K and Q6_K have sixteen signed scales. IQ1_S has eight scales; its dimensionless +/-0.125 offsets remain in its block metadata.
-
struct GptqModelGgufWeights#
- #include <gguf.h>
Stores an extracted GPTQModel GGUF safetensors qweight and explicit layout metadata. Supports only nonempty matrices with block-aligned logical input features. qweight is UINT8 [out_features, in_features / block_size * type_size]. This stage rejects upstream row padding and partial original dimensions; it does not load an entire checkpoint or infer subtype metadata.
-
const std::vector<GgufBlockLayout> &GgufBlockLayouts()#
-
namespace runtime
-
namespace core
The standard-domain DequantizePacked raw-byte decoder is independent of
the structured GGUF import API. It supports all 27 fixed profiles, zero-sized
outputs and nonfinite scale values, with FP32 arithmetic before conversion.
-
namespace onnx_light
Alias that makes onnx-light headers compatible with code that references
ONNX_LIGHT_NAMESPACE(the macro used in the standard onnx package).Set to
ONNX_LIGHT_NAMESPACEso both names resolve to the same namespace.Symbol-visibility attribute for the public onnx-light C++ API.
Maps the upstream compatibility macro to onnx-light’s explicit proto ABI annotation. This keeps declarations from vendored ONNX headers visible when
lib_onnx_protouses hidden visibility by default.Namespace alias so that ONNX C++ code (and consumers such as onnxruntime) that refers to the literal
onnxnamespace — rather than theONNX_NAMESPACEmacro — resolves to the onnx-light namespace. The standard onnx package lives innamespace onnx; onnx-light usesonnx_light(via ONNX_LIGHT_NAMESPACE), so this alias keeps onnx-light a true drop-in. It is only introduced when the onnx-light namespace differs fromonnx.-
namespace core
-
namespace runtime
Functions
-
std::span<const PackedQuantizationProfile> PackedQuantizationProfiles()#
Returns the 27 supported fixed wire profiles.
-
const PackedQuantizationProfile &PackedQuantizationLayout(std::string_view format)#
Resolves a case-sensitive format, rejecting unsupported profiles.
-
size_t ValidatePackedQuantizationShape(const PackedQuantizationProfile &profile, const Shape &shape, int64_t output_dtype)#
Validates dimensions, alignment, dtype and overflow; returns the packed byte count.
-
struct PackedQuantizationProfile#
- #include <dequantize_packed.h>
Describes a fixed, standard-domain DequantizePacked wire profile.
-
std::span<const PackedQuantizationProfile> PackedQuantizationProfiles()#
-
namespace runtime
-
namespace core