Merge main into clef-flash-arch-plugin

This commit is contained in:
Brandon Bertelsen committed 2026-10-28 22:53:52 -04:00
commit d24cf32a13
114 files changed
+26614 -621

No files matched your search

+16 -3
View File
@@ -205,6 +205,10 @@ void usage() {
" --imatrix F llama.cpp imatrix: the expert-popularity profile, the column\n"
" importances handed to each quantiser, and the weighting of the\n"
" error report\n"
" --chat-template F a jinja template baked as the container's chat template,\n"
" overriding the checkpoint's own (or its absence). A release that\n"
" ships none (DeepSeek's) needs one, or /v1/chat/completions answers\n"
" 501. Trailing newlines are stripped\n"
" --set K=V a metadata key, seen by declare AND written into the container,\n"
" so a convert-time choice that must also hold at serve time is\n"
" stated once. Repeatable\n"
@@ -274,7 +278,7 @@ int for_row_pieces(int64_t n, bool parallel, std::string* why, F fn) {
} /* namespace */
int main(int argc, char** argv) {
std::string in, out, arch_override, home = rad_home(), tokjson, imat_path, draft_dir;
std::string in, out, arch_override, home = rad_home(), tokjson, imat_path, draft_dir, chat_tmpl;
std::string tokjson2, config_dir;
std::vector<std::string> add_files;
std::vector<std::string> hierarchy = rad_hierarchy_from_env();
@@ -318,6 +322,7 @@ int main(int argc, char** argv) {
else if (a == "--add") add_files.push_back(next("--add"));
else if (a == "--config") config_dir = next("--config");
else if (a == "--imatrix") imat_path = next("--imatrix");
else if (a == "--chat-template") chat_tmpl = next("--chat-template");
else if (a == "--set") {
const std::string kv = next("--set");
const size_t eq = kv.find('=');
@@ -665,8 +670,10 @@ int main(int argc, char** argv) {
const RadQuantWeight qw = quant_weight(L, nullptr);
const int st = L.rule->q->encoding(L.rule->params.data(), (int)L.rule->params.size(),
&qw, &L.enc);
if (st == RAD_E_UNSUPPORTED && (L.src.trivial || L.src.imported)) {
/* declined (e.g. a norm under a matrix pattern): keep as is */
if (st == RAD_E_UNSUPPORTED &&
(L.src.trivial || (L.src.imported && !L.src.ggml_blocks))) {
/* declined (e.g. a norm under a matrix pattern): keep as is. Not a GGUF block
* tensor: keeping its planes would hide that the rule did not apply. */
L.rule = nullptr;
L.enc = L.src.enc;
} else if (st != RAD_OK) {
@@ -1041,6 +1048,12 @@ int main(int argc, char** argv) {
w.abort();
return 1;
}
/* The operator's template replaces whatever the checkpoint carried (or lacked), so a release
* that ships none still bakes a container that serves /v1/chat/completions. */
if (!chat_tmpl.empty() && read_chat_template_path(chat_tmpl.c_str(), vb) < 0) {
w.abort();
return 1;
}
/* Serialised at section offset 0; finish() rebases once the string blob is sized. */
std::vector<uint8_t> vocab_blob;
if (vocab_serialize(vb, sink, 0, vocab_blob) < 0) { w.abort(); return 1; }
+19 -6
View File
@@ -358,12 +358,25 @@ int write_report(const std::string& path, const std::vector<Row>& rows,
std::string s;
s += "# radiance kernel libraries\n\n";
s += "Generated by `rad-kbench`. Every kernel of every loaded library ran on the same "
"inputs" + (benched ? std::string(" and each\ncase that passed was timed in the same "
"run, so correctness, completeness and speed come from "
"one run\n(the Speed section says how the times were "
"taken).\n\n")
: std::string(";\nnothing was timed (`--bench` was not given).\n\n"));
/* The header may claim only what this pass measured. The counts are the same ones the
* Rows nothing ran section prints from this data below; the sentence claiming every
* kernel ran is true only when no declared row was left unreached. */
size_t declared_rows = 0, reached_rows = 0;
for (const LibRow& l : libs) { declared_rows += l.rows.size(); reached_rows += l.ran.size(); }
const bool all_ran = reached_rows == declared_rows;
s += "Generated by `rad-kbench`. " +
(all_ran
? std::string("Every kernel of every loaded library ran on the same inputs")
: fmt("%zu of %zu declared kernel rows ran on the same inputs", reached_rows,
declared_rows)) +
(benched ? std::string(" and each\ncase that passed was timed in the same "
"run, so correctness, completeness and speed come from "
"one run\n(the Speed section says how the times were "
"taken).\n\n")
: std::string(";\nnothing was timed (`--bench` was not given).\n\n"));
if (!all_ran)
s += "Rows no case in this pass reached are listed under *Rows nothing ran*; a row "
"there is a gap in\ncoverage, not a failing kernel.\n\n";
s += "- " + provenance + "\n";
if (!arch_plugin.empty()) s += "- architecture plugin: `" + arch_plugin + "`\n";
s += "- libraries: `" + libraries + "`\n";