PLE: use the model file's hash constants again, and keep the row-range check

The engine reads the PLE hash constants out of the model file when it carries them (ple_consts_run), and refuses to start when a hash would reach past the PLE table's rows. A rebase of the trim change (PR 4522) lost both: the wiring step took the default constants (ple_artifact_consts) and the range check was gone. That change reaches a single card too, so a model whose file has its own constants would have been hashed with the wrong ones.
This puts back the two lines and the check as they were before the merge. No other change.
This commit is contained in:
Niko1221 committed 2026-11-12 22:29:34 +01:00
1 parent 3f64aa6534
commit 7e9bf8c8f8
1 file changed
+8 -1
+8 -1
View File
@@ -5780,7 +5780,14 @@ int main(int argc, char** argv) {
else if (pio.mode == strata::kernels::PleIo::Direct)
std::fprintf(stderr, "strata generate: SSD keep-alive off: the SSD may fall asleep between reads\n");
if (!wire_ple(wt)) return 1;
ss.ple.consts = strata::kernels::ple_artifact_consts();
ss.ple.consts = ple_consts_run;
for (int h = 0; h < strata::kernels::PLE_N_HEADS; ++h) { // the hash may only reach rows the table has
if (ple_consts_run.offset[h] + ple_consts_run.vocab[h] > ple_table.rows()) {
std::fprintf(stderr, "strata generate: PLE head %d reaches row %llu but the table has %llu rows (the model file's hash constants do not fit its PLE table)\n",
h, (unsigned long long) (ple_consts_run.offset[h] + ple_consts_run.vocab[h]), (unsigned long long) ple_table.rows());
return 1;
}
}
if (o.ple_delay_us > 0) ple_table.set_injected_delay_us(o.ple_delay_us);
ss.ple.table = &ple_table;
ss.ple.token = &ss.ple_token;