ggml
[Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685)
Brought by drakestapleton
ggml / src / ggml-openvino / model-cache.h
| 1 | #pragma once |
| 2 | |
| 3 | // Compiled blobs include weights. Cache-only execution skips weight uploads and graph compilation. |
| 4 | |
| 5 | #include "ggml.h" |
| 6 | |
| 7 | #include <cstdint> |
| 8 | #include <string> |
| 9 | #include <vector> |
| 10 | |
| 11 | bool ggml_openvino_model_cache_only(); |
| 12 | void ggml_openvino_model_cache_init(); |
| 13 | |
| 14 | struct ggml_openvino_source_mapping { |
| 15 | uintptr_t begin; |
| 16 | uintptr_t end; |
| 17 | uint64_t offset; |
| 18 | uint64_t identity; |
| 19 | }; |
| 20 | |
| 21 | // Identify mmap weights without reading their pages. Cache mappings for one buffer lifetime. |
| 22 | uint64_t ggml_openvino_source_fingerprint(const void * data, size_t size, std::vector<ggml_openvino_source_mapping> & mappings); |
| 23 | uint64_t ggml_backend_openvino_weight_fingerprint(const ggml_tensor * tensor); |
| 24 | |
| 25 | // Returns the compiled-model cache directory, or empty if unset. |
| 26 | std::string ggml_openvino_model_cache_dir(); |
| 27 | std::string ggml_openvino_model_cache_temp_path(const std::string & path); |
| 28 | |
| 29 | // Hash graph structure, source weight identities, configuration, and OpenVINO version. |
| 30 | uint64_t ggml_openvino_model_fingerprint(const ggml_cgraph * cgraph, |
| 31 | const std::string & device, |
| 32 | bool fa, |
| 33 | const int32_t * rope_params, |
| 34 | int rope_len, |
| 35 | uint64_t extra_cfg, |
| 36 | const std::string & graph_signature); |
| 37 | |
| 38 | // Path to the compiled-blob file for a fingerprint (<dir>/<hex>.blob). |
| 39 | std::string ggml_openvino_model_cache_blob_path(const std::string & dir, uint64_t fingerprint); |
| 40 | |
| 41 | // Path to the sidecar manifest (<dir>/<hex>.manifest) holding the per-weight |
| 42 | // fingerprints, used to re-verify a hit before trusting the blob. |
| 43 | std::string ggml_openvino_model_cache_manifest_path(const std::string & dir, uint64_t fingerprint); |
| 44 | |
| 45 | // Record weight metadata and source identities. Returns false on I/O error. |
| 46 | bool ggml_openvino_model_cache_write_manifest(const std::string & path, |
| 47 | const ggml_cgraph * cgraph, |
| 48 | uint64_t fingerprint, |
| 49 | const std::vector<std::string> & inputs, |
| 50 | const std::vector<std::string> & outputs); |
| 51 | |
| 52 | // Require all weight metadata and source identities to match the manifest. |
| 53 | bool ggml_openvino_model_cache_verify_manifest(const std::string & path, |
| 54 | const ggml_cgraph * cgraph, |
| 55 | uint64_t fingerprint, |
| 56 | std::vector<std::string> & inputs, |
| 57 | std::vector<std::string> & outputs); |