MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / get_mapping_range

Method get_mapping_range

smallthinker/src/llama-model-loader.cpp:858–873  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

856}
857
858void llama_model_loader::get_mapping_range(size_t * first, size_t * last, void ** addr, int idx, ggml_context * ctx) const {
859 GGML_ASSERT(!mappings.empty());
860 const auto & mapping = mappings.at(idx);
861
862 *first = mapping->size();
863 *last = 0;
864 *addr = mapping->addr();
865 for (ggml_tensor * tensor = ggml_get_first_tensor(ctx); tensor; tensor = ggml_get_next_tensor(ctx, tensor)) {
866 const auto * weight = get_weight(ggml_get_name(tensor));
867 if (!weight || weight->idx != idx) {
868 continue;
869 }
870 *first = std::min(*first, weight->offs);
871 *last = std::max(*last, weight->offs + ggml_nbytes(tensor));
872 }
873}
874
875void llama_model_loader::load_data_for(struct ggml_tensor * cur) const {
876 const auto & w = require_weight(ggml_get_name(cur));

Callers 1

load_tensorsMethod · 0.80

Calls 9

minFunction · 0.85
maxFunction · 0.85
addrMethod · 0.80
ggml_get_first_tensorFunction · 0.50
ggml_get_next_tensorFunction · 0.50
ggml_get_nameFunction · 0.50
ggml_nbytesFunction · 0.50
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected