Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions npu/forward/src/q4nx_forward.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3572,6 +3572,22 @@ std::string Q4nxNpuForward::missing_kernel(const std::string& dir, const char* e
if (plan_.loaded())
return "plan " + plan_path_ + ": this model's plan needs the " + role_tag(role) + " kernel \"" +
elf_name + "\" in " + dir + " (missing)";
// engine#1503: a container imported without `--weight-layout b8` is row-major, so it asks for plain kernel names while
// the only kernels on the box carry the _b8 suffix. Naming the layout instead of only the missing file is the
// difference between "re-fetch the artifact" and "re-import the pack with a flag" - measured on a Ryzen AI 1.9 pack,
// where the same container ran correctly with the b8 set and the flag.
{
const std::string name(elf_name);
if (name.size() > 4 && name.compare(name.size() - 4, 4, ".elf") == 0) {
const std::string b8 = name.substr(0, name.size() - 4) + "_b8.elf";
if (file_exists(dir + "/" + b8))
return "missing full ELF " + dir + "/" + elf_name +
" - but the b8 variant \"" + b8 + "\" is there: this container's weight layout is row-major " +
"(q4nx_weight_layout absent), so it asks for row-major kernels and the directory holds the b8 " +
"family. Re-import the pack with `npu-pack import --weight-layout b8`, or supply row-major ELFs " +
"(engine#1503).";
}
}
return "missing full ELF " + dir + "/" + elf_name;
}

Expand Down
22 changes: 19 additions & 3 deletions npu/target/xdna/xdna_target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,25 @@ bool XdnaTarget::open_prefill(const Q4nxDesignGeom* designs, int n, std::string&
// The same wording the forward used for this case, because a diagnostic that changes shape
// when code moves is a diagnostic someone has to re-learn.
const char* role = q4nx_design_log_tag(g->role);
err = plan_path.empty() ? ("missing full ELF " + elf)
: ("plan " + plan_path + ": this model's plan needs the " + role +
" kernel \"" + g->elf_name + "\" in " + dir + " (missing)");
// engine#1503: when the asked-for name is the plain one and the directory holds only the _b8 family, the missing
// thing is the container's LAYOUT, not the artifact. Measured on a Ryzen AI 1.9 pack: the same container ran
// correctly once it was re-imported with `--weight-layout b8`. Say that here, or the reader goes looking for a
// kernel that was never supposed to exist.
std::string hint;
{
const std::string nm(g->elf_name);
if (nm.size() > 4 && nm.compare(nm.size() - 4, 4, ".elf") == 0) {
const std::string b8 = nm.substr(0, nm.size() - 4) + "_b8.elf";
if (elf_present(dir + "/" + b8))
hint = " - but the b8 variant \"" + b8 + "\" is there: this container's weight layout is "
"row-major (q4nx_weight_layout absent), and a row-major container asks for row-major "
"kernels. Re-import the pack with `npu-pack import --weight-layout b8`, or supply a "
"row-major ELF family (engine#1503).";
}
}
err = (plan_path.empty() ? ("missing full ELF " + elf)
: ("plan " + plan_path + ": this model's plan needs the " + role +
" kernel \"" + g->elf_name + "\" in " + dir + " (missing)")) + hint;
return false;
}
if (!dev_) {
Expand Down
Loading