Skip to content

Commit 56ad81b

Browse files
authored
Log file_bytes in save_packed_index for orphan accumulation visibility (pytorch#20246)
Differential Revision: D108178965 Pull Request resolved: pytorch#20246
1 parent 0632135 commit 56ad81b

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

backends/xnnpack/runtime/XNNWeightsCache.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,11 +574,18 @@ Error XNNWeightsCache::save_packed_index() {
574574
ET_LOG(Error, "fsync of packed cache failed (errno=%d)", errno);
575575
// Continue — data is in page cache; durability is best-effort.
576576
}
577+
// Log the final file size (= index_start + trailer) so production
578+
// logs surface unbounded growth from orphan packs: a same-name
579+
// re-pack leaves the old packed bytes in the file even though the
580+
// trailer drops the old entry. Monitoring file_bytes over time tells
581+
// us when GC or a size cap is needed.
582+
const size_t file_bytes = index_start + buf.size();
577583
ET_LOG(
578584
Info,
579-
"Saved packed weight index: %u entries at offset %zu",
585+
"Saved packed weight index: %u entries at offset %zu, file_bytes=%zu",
580586
entry_count,
581-
index_start);
587+
index_start,
588+
file_bytes);
582589

583590
// Promote freshly-packed entries to from_load now that they're durable
584591
// on disk, so delete_packed_data preserves them across unload/reload.

0 commit comments

Comments
 (0)