upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src/bcpack.cpp
diff options
context:
space:
mode:
authorOreoFR <29048345+OreoFR@users.noreply.github.com>2026-11-29 09:41:10 +0100
committerOreoFR <29048345+OreoFR@users.noreply.github.com>2026-11-29 09:41:10 +0100
commitbe581760b27f260b0026e51d4d7289428ec1873f (patch)
tree5cebafd5f1c8b14dc7eaeb6b17c1873d3efa744e /runtime/src/bcpack.cpp
parentdf7cf56d1f18fa0d64103db6750148711417c7fc (diff)
parent54b2a81e95c470c953ddee6177fd6255cbaf041d (diff)
Merge origin/main into #1726 (carry prep)
scripts/run_gpu_tests.py: PR's module-level tables kept; main's new dumps (cs_w32_cvt_f16_mods, cs_dpp_cmpx, cs_w32_wrxchg2_ext, cs_w32_wrxchg2st64, cs_w64x_partial_swizzle) added to CS_DUMP_WANTS / CS_DUMP_NON_WAVE64 / CS_DUMP_HEXWORDS, and main's partial-wave subgroup size (32 under emulation) kept. Co-authored-by: TanmaySatyam <248538550+TanmaySatyam@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/bcpack.cpp')
-rw-r--r--runtime/src/bcpack.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/runtime/src/bcpack.cpp b/runtime/src/bcpack.cpp
index bb4646787..8a6049d73 100644
--- a/runtime/src/bcpack.cpp
+++ b/runtime/src/bcpack.cpp
@@ -263,7 +263,7 @@ bool bc7(const Symbols &a, const Symbols &b, const BptcState &ep,
263// earlier uses of the slot. 263// earlier uses of the slot.
264struct Coverage { 264struct Coverage {
265 array<bool, 256> missing_ep{}, missing_ix{}; 265 array<bool, 256> missing_ep{}, missing_ix{};
266 size_t lost{}, inconsistent{}, limit{}; 266 size_t lost{}, inconsistent{}, limit{}, lost_limit{};
267 bool lost_endpoints{}, lost_indices{}; 267 bool lost_endpoints{}, lost_indices{};
268 void note_missing(const BptcState &block) { 268 void note_missing(const BptcState &block) {
269 const bool ep = block.ep_root >= 0 && missing_ep[block.ep_root]; 269 const bool ep = block.ep_root >= 0 && missing_ep[block.ep_root];
@@ -382,7 +382,7 @@ bool rebuild_bptc(unsigned codec, size_t i, size_t blocks, const Symbols &a,
382 } else if (i >= 256) 382 } else if (i >= 256)
383 coverage.note_missing(next); 383 coverage.note_missing(next);
384 if (!valid) return false; 384 if (!valid) return false;
385 if (coverage.lost > coverage.limit) { 385 if (coverage.lost > coverage.lost_limit) {
386 reason = coverage.lost_endpoints && coverage.lost_indices ? "missing-endpoint-and-index" : 386 reason = coverage.lost_endpoints && coverage.lost_indices ? "missing-endpoint-and-index" :
387 coverage.lost_endpoints ? "missing-endpoint" : "missing-index"; 387 coverage.lost_endpoints ? "missing-endpoint" : "missing-index";
388 return false; 388 return false;
@@ -394,7 +394,8 @@ bool rebuild_bptc(unsigned codec, size_t i, size_t blocks, const Symbols &a,
394 394
395Quality decode(unsigned codec, std::span<const uint8_t> source, 395Quality decode(unsigned codec, std::span<const uint8_t> source,
396 std::span<uint8_t> output, bool allow_fitted, 396 std::span<uint8_t> output, bool allow_fitted,
397 const Calibration *history, const char** failure, bool fast_entropy) { 397 const Calibration *history, const char** failure, bool fast_entropy, size_t lost_divisor,
398 Report *report) {
398 const char* reason = "bcpack-stream"; 399 const char* reason = "bcpack-stream";
399 if (failure) *failure = reason; 400 if (failure) *failure = reason;
400 Quality quality = Quality::confirmed; 401 Quality quality = Quality::confirmed;
@@ -410,12 +411,17 @@ Quality decode(unsigned codec, std::span<const uint8_t> source,
410 coverage.limit = allow_fitted && history 411 coverage.limit = allow_fitted && history
411 ? max<size_t>(2, output.size() / block_size / 1024) 412 ? max<size_t>(2, output.size() / block_size / 1024)
412 : 0; 413 : 0;
414 coverage.lost_limit = allow_fitted && history
415 ? max<size_t>(2, output.size() / block_size / max<size_t>(1, lost_divisor))
416 : 0;
417 if (report) *report = {output.size() / block_size, 0};
413 const bool valid = visit_blocks(codec, source, output.size(), [&](size_t i, const Symbols &first, const Symbols &tuple) { 418 const bool valid = visit_blocks(codec, source, output.size(), [&](size_t i, const Symbols &first, const Symbols &tuple) {
414 auto *dst = output.data() + i * block_size; 419 auto *dst = output.data() + i * block_size;
415 if (codec >= 6) 420 if (codec >= 6)
416 return rebuild_bptc(codec, i, output.size() / block_size, first, tuple, bptc, dst, history, allow_fitted, quality, coverage, reason); 421 return rebuild_bptc(codec, i, output.size() / block_size, first, tuple, bptc, dst, history, allow_fitted, quality, coverage, reason);
417 return rebuild_classic(codec, i, first, tuple, classic, dst, allow_fitted, quality); 422 return rebuild_classic(codec, i, first, tuple, classic, dst, allow_fitted, quality);
418 }, fast_entropy); 423 }, fast_entropy);
424 if (report) report->lost = coverage.lost;
419 if (valid && (!coverage.inconsistent || quality == Quality::fitted)) return quality; 425 if (valid && (!coverage.inconsistent || quality == Quality::fitted)) return quality;
420 if (failure) *failure = coverage.inconsistent && valid ? "anchor-or-pbit" : reason; 426 if (failure) *failure = coverage.inconsistent && valid ? "anchor-or-pbit" : reason;
421 return Quality::failed; 427 return Quality::failed;