native packs: a BF16 (--compat-bf16) PLE key stays in the arena and is not replaced by the GGUF key (#326)

Since 0.1.25 NativeDense treats an IQ3_XXS/IQ4_XS/Q8_0 GGUF key as native, so for a native pack the loader
skipped the pack's key row and then refused the BF16 row iq_pack --compat-bf16 writes for OrcaRouter's IQ3_XXS
key ("native dense: incompatible matrix blk.1.ple_key.weight"). NativeDense::keep_unquantized_ple_key reads the
key row's code_bits from index.txt (WeightTable::index_code_bits) and keeps an unquantized row in the arena;
NativeDense::load does not upload the GGUF key over it, and the PLE uses the BF16 key as before 0.1.25. A
quantized key row (Q2_0, UD-Q4_K_XL packs) is unchanged; the GSQ packs' GGUF keys are BF16 (not eligible), so
they never reach this path. The reporter's fallback (Gen4536). Test: native_dense_ple_key_test (synthetic GGUF
+ pack, CUDA).
This commit is contained in:
Niko1221 committed 2026-10-01 08:29:03 +02:00
1 parent 75780af235
commit abfb05cfbe
7 files changed
+224

No files matched your search

+23
View File
@@ -118,6 +118,29 @@ bool WeightTable::pool_bytes(const std::string& pack_dir, uint64_t& out, std::st
return true;
}
bool WeightTable::index_code_bits(const std::string& pack_dir, const std::string& name, int& code_bits,
std::string& err) {
const std::string path = pack_dir + "/index.txt";
std::FILE* f = std::fopen(path.c_str(), "rb");
if (!f) { err = "cannot open " + path; return false; }
char line[1024];
code_bits = -1;
while (std::fgets(line, sizeof line, f)) {
if (line[0] == '#') continue;
char row[256] = {0};
unsigned long long dummy = 0;
long long ne = 0;
int i1 = 0, i2 = 0, bits = 0;
// the first ten fields of the row `load` parses: name file kind src_off src_bytes dst_off dst_bytes ne0 ne1 code_bits
if (std::sscanf(line, "%255s %d %d %llu %llu %llu %llu %lld %lld %d", row, &i1, &i2, &dummy, &dummy, &dummy,
&dummy, &ne, &ne, &bits) != 10)
continue;
if (name == row) { code_bits = bits; break; }
}
std::fclose(f);
return true;
}
bool WeightTable::load(const std::string& pack_dir, void* arena_base, uint64_t arena_bytes, std::string& err,
const std::set<std::string>* skip) {
const std::string path = pack_dir + "/index.txt";