aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhi An Ng <zhin@google.com>2022-07-25 09:30:52 -0700
committerXNNPACK Team <xnnpack-github-robot@google.com>2022-07-25 09:31:50 -0700
commitc7cb3c177fbcd277c29d0ead9eaf1390255591f0 (patch)
tree3515101f077424469976ac2676aa06a66946c160
parentc4afc8b3d247b875b78950d1af3f4f2bcc2340e6 (diff)
downloadXNNPACK-c7cb3c177fbcd277c29d0ead9eaf1390255591f0.tar.gz
Add debug logging to help debug high memory bandwidth issues
PiperOrigin-RevId: 463103816
-rw-r--r--src/cache.c2
-rw-r--r--src/memory.c3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/cache.c b/src/cache.c
index 8ab931739..e74a93792 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -352,12 +352,14 @@ enum xnn_status xnn_finalize_weights_cache(
enum xnn_cache_state finalized_state;
if (finalization_kind == xnn_weights_cache_finalization_kind_hard) {
+ xnn_log_debug("hard finalizing weights cache");
status = xnn_finalize_weights_memory(&cache->cache.weights);
// Also release the memory used by hash table (but not the weights memory).
xnn_release_memory(cache->cache.buckets);
cache->cache.buckets = NULL;
finalized_state = xnn_cache_state_hard_finalized;
} else {
+ xnn_log_debug("soft finalizing weights cache");
assert(finalization_kind == xnn_weights_cache_finalization_kind_soft);
// Finalize weights cache by reserving sufficient space for the insertion of the largest cached weights. This
// ensures that we have space to write packed weights to check for cache hits without growing and moving the
diff --git a/src/memory.c b/src/memory.c
index b7a428841..caa5bfb2d 100644
--- a/src/memory.c
+++ b/src/memory.c
@@ -268,10 +268,11 @@ enum xnn_status xnn_release_weights_memory(struct xnn_weights_buffer* buf) {
enum xnn_status xnn_reserve_weights_memory(struct xnn_weights_buffer* buf, size_t n) {
if (buf->size + n <= buf->capacity) {
+ xnn_log_debug("reserving weights memory of size %zu without growing buffer", n);
return xnn_status_success;
}
- xnn_log_debug("reserving weights memory of size %zu", n);
+ xnn_log_debug("growing buffer to reserve weights memory of size %zu, previous capacity %zu", n, buf->capacity);
// TODO(zhin): use mremap
size_t size = buf->size;
struct xnn_weights_buffer new_weights_buffer;