Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
rebase onto f-140: leave the PLE Q8_0 reader to the #651 series already in f-140 (drops the duplicate hunks of #860)
Niko1221edc0cb6490e5
diff --git a/CMakeLists.txt b/CMakeLists.txtindex 26e42590d..a8f9285ed 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -1317,7 +1317,6 @@ if(STRATA_NATIVE_EXPERTS)if(STRATA_ENABLE_CUDA AND STRATA_BUILD_TESTS)add_executable(ple_q5_parity src/kernels/ple_q5_parity.cpp)target_link_libraries(ple_q5_parity PRIVATE strata_kernels strata_artifact ggml-base ${_strata_gpu_runtime_target})- # Unsloth's UD-Q6_K_XL ships per_layer_token_embd as Q8_0 (170-B rows) - same check, different typeadd_executable(q5_projection_parity src/kernels/q5_projection_parity.cpp)target_include_directories(q5_projection_parity PRIVATE ${_strata_gpu_include_directories})target_link_libraries(q5_projection_parity PRIVATE strata_kernels strata_artifact ggml-base ${_strata_gpu_runtime_target})diff --git a/docs/UNSLOTH_Q4.md b/docs/UNSLOTH_Q4.mdindex ccb05d95d..5a87468e9 100644--- a/docs/UNSLOTH_Q4.md+++ b/docs/UNSLOTH_Q4.md@@ -289,10 +289,6 @@ whose header shows the same formats.- UD-Q4_K_XL and UD-IQ4_XS at revision `38bb39e` are targeted, and plain Q4_0 files ([above](#q4_0-files)). Otherquantizations use formats this engine may not have kernels for; the engine checks every layer's formats at startand refuses an unsupported one by name.--- UD-Q4_K_XL and UD-IQ4_XS at revision `38bb39e` are targeted. Other Unsloth quantizations use formats this engine may- not have kernels for; the engine checks every layer's formats at start and refuses an unsupported one by name.- (UD-Q6_K_XL of the same revision is documented separately: [UNSLOTH_Q6.md](UNSLOTH_Q6.md).)- Tests: the packer's synthetic 4-shard and conversion tests (`.venv/bin/python -m unittest discover -s tools -ptest_iq_pack.py`); CTests `gguf_split_test`, `expert_layout_test`, `native_expert_parity_*` (the three real expertformat pairs against ggml-cpu, the Q5_1 min term, Q8_0 rows, Q4_0/Q4_0 and Q4_0/Q4_1), `prefill_mmq_kquant_test` (with `-DSTRATA_MMQ_KQUANTS=ON`: thediff --git a/include/strata/kernels/ngram.hpp b/include/strata/kernels/ngram.hppindex 68aa7118b..842914760 100644--- a/include/strata/kernels/ngram.hpp+++ b/include/strata/kernels/ngram.hpp@@ -76,11 +76,6 @@ const PleFormatInfo* ple_format_for_type(const char* gguf_type_name);/// "IQ4_NL, Q5_0 or FP8 (I8)": the formats for an error message, built from the list.std::string ple_format_list();-inline constexpr int PLE_ROW_BYTES_Q8_0 = (PLE_HEAD_DIM / 32) * 34; // 170: a Q8_0 row (Unsloth's UD-Q6_K_XL)-inline constexpr int PLE_ROW_BYTES_MAX = PLE_ROW_BYTES_Q8_0;--inline constexpr int PLE_ROW_BYTES_MAX = PLE_ROW_BYTES_FP8;-/// The artifact's own hash constants, transcribed from `docs/gguf-dump-shard1.txt`:////// layer_multipliers = [23703573157769, 20109073645365, 8052911324071]diff --git a/src/kernels/ngram.cpp b/src/kernels/ngram.cppindex 6b4217269..4667745fb 100644--- a/src/kernels/ngram.cpp+++ b/src/kernels/ngram.cpp@@ -221,18 +221,6 @@ struct PleTable::Impl {float scale = 1.0f; // the FP8 table's one scaleuint32_t rb = PLE_ROW_BYTES; // bytes per rowvoid decode(const uint8_t* row, float* out160) const { fmt->dequant(row, scale, out160); }-- bool q8_0 = false; // Q8_0 rows (170 B): Unsloth's UD-Q6_K_XL ships the table as Q8_0-- bool fp8 = false; // F8_E4M3 rows (tools/ple_fp8_pack.py); else IQ4_NL- float scale = 1.0f; // the FP8 table's one scale- uint32_t rb = PLE_ROW_BYTES; // bytes per row- void decode(const uint8_t* row, float* out160) const {- if (fp8) fp8_e4m3_dequant_row(row, scale, out160);- else if (q5_0)- for (int b = 0; b < PLE_HEAD_DIM / 32; ++b) strata::dequantize_q5_0(row + (size_t) b * 22, out160 + b * 32);- else iq4nl_dequant_row(row, out160);- }};PleTable::PleTable() : impl_(new Impl) {}@@ -272,17 +260,6 @@ bool PleTable::open(const std::string& gguf_path, std::string& err, const PleIoOreturn false;}if (fmt->needs_scale) {-- // IQ4_NL (ISTA-DASLab's shard 2, the original's own GGUF), Q5_0 (#296: OrcaRouter's GGUF), Q8_0 (Unsloth's- // UD-Q6_K_XL), or the FP8 table as shipped: I8 bytes marked strata.ple.format = f8_e4m3 with strata.ple.scale- // (tools/ple_fp8_pack.py)-- // IQ4_NL (ISTA-DASLab's shard 2, the original's own GGUF), Q5_0 (#296: OrcaRouter's GGUF), or the FP8 table as- // shipped: I8 bytes marked strata.ple.format = f8_e4m3 with strata.ple.scale (tools/ple_fp8_pack.py)- impl_->fp8 = false;- impl_->q5_0 = std::strcmp(t->type_name(), "Q5_0") == 0;- impl_->rb = impl_->q5_0 ? (PLE_HEAD_DIM / 32) * 22 : PLE_ROW_BYTES;- if (std::strcmp(t->type_name(), "I8") == 0) {const MetaValue* f = impl_->file->get("strata.ple.format");const MetaValue* s = impl_->file->get("strata.ple.scale");if (f == nullptr || f->s != "f8_e4m3" || s == nullptr || !(s->num() > 0.0)) {@@ -291,12 +268,6 @@ bool PleTable::open(const std::string& gguf_path, std::string& err, const PleIoOreturn false;}impl_->scale = (float) s->num();-- impl_->rb = PLE_ROW_BYTES_FP8;- } else if (!impl_->q5_0 && std::strcmp(t->type_name(), "IQ4_NL") != 0) {- err = std::string("per_layer_token_embd.weight is ") + t->type_name() + ", not IQ4_NL, Q5_0 or FP8 (I8)";- close();- return false;}impl_->fmt = fmt;impl_->rb = fmt->row_bytes;@@ -438,18 +409,11 @@ void PleTable::close() {impl_->fmt = &ple_format_info(PleFormat::IQ4_NL);impl_->scale = 1.0f;impl_->bytes_read = 0;-- impl_->q5_0 = false;- impl_->fp8 = false;}bool PleTable::is_open() const { return impl_->data != nullptr || impl_->reader.is_open(); }bool PleTable::locked() const { return impl_->locked; }const char* PleTable::format() const { return impl_->fmt->name; }--const char* PleTable::format() const { return impl_->fp8 ? "F8_E4M3" : impl_->q5_0 ? "Q5_0" : impl_->q8_0 ? "Q8_0" : "IQ4_NL"; }--const char* PleTable::format() const { return impl_->fp8 ? "F8_E4M3" : impl_->q5_0 ? "Q5_0" : "IQ4_NL"; }PleIo PleTable::mode() const { return impl_->mode; }uint64_t PleTable::rows() const { return impl_->n_rows; }uint64_t PleTable::bytes_read() const { return impl_->bytes_read; }diff --git a/src/ngram/ple_reader_test.cpp b/src/ngram/ple_reader_test.cppindex 66a7c089d..920847083 100644--- a/src/ngram/ple_reader_test.cpp+++ b/src/ngram/ple_reader_test.cpp@@ -239,15 +239,6 @@ void all_formats_round_trip(const std::string& dir) {}}-// row_bytes: ng::ROW_BYTES (90, IQ4_NL) is the production default; 110 (#296, OrcaRouter's Q5_0 PLE rows) is-// run too, through the exact same generic row_bytes path -- nothing here is IQ4_NL-specific, so a second row-// size run here is the correctness evidence for lifting ngram.cpp's "Q5_0 PLE requires --ple-io mmap" refusal.--// row_bytes: ng::ROW_BYTES (90, IQ4_NL) is the production default; 110 (#296, OrcaRouter's Q5_0 PLE rows) and-// 170 (Unsloth's UD-Q6_K_XL Q8_0 PLE rows) are run too, through the exact same generic row_bytes path ---// nothing here is IQ4_NL-specific, so extra row sizes run here are the correctness evidence for lifting-// ngram.cpp's format-specific refusals.-// row_bytes: ng::ROW_BYTES (90, IQ4_NL) is the production default; 110 (#296, OrcaRouter's Q5_0 PLE rows) is// run too, through the exact same generic row_bytes path -- nothing here is IQ4_NL-specific, so a second row// size run here is the correctness evidence for lifting ngram.cpp's "Q5_0 PLE requires --ple-io mmap" refusal.@@ -466,11 +457,6 @@ int main(int argc, char** argv) {// same generic row_bytes path -- see the comment on selftest().all_formats_round_trip(dir); // every format of k::ple_formats(), both readers, vs its dequantizerif (g_fail != 0) return 1;-- // ng::ROW_BYTES (90, IQ4_NL, production default), 110 (#296, OrcaRouter's Q5_0 PLE rows) and 170- // (Unsloth's UD-Q6_K_XL Q8_0 PLE rows) through the same generic row_bytes path -- see the comment on- // selftest().-const int r90 = selftest(dir, ng::ROW_BYTES);const int r110 = selftest(dir, 110);return r90 != 0 ? r90 : r110;