Skip to content
Open
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
7 changes: 7 additions & 0 deletions tflite/delegates/xnnpack/weight_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,13 @@ enum xnn_status MMapWeightCacheProvider::delete_cache(void* context) {
return xnn_status_success;
}

enum xnn_status MMapWeightCacheProvider::alias_data(void* context, void* alias,
void* original) {
reinterpret_cast<MMapWeightCacheProvider*>(context)->RemapDataBuffer(
alias, original);
return xnn_status_success;
}

PackIdentifier MMapWeightCacheProvider::BuildPackIdentifier(
const xnn_weights_cache_look_up_key& key) {
const auto get_buffer_id = [&](const void* buffer) -> size_t {
Expand Down
7 changes: 6 additions & 1 deletion tflite/delegates/xnnpack/weight_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,9 @@ class MMapWeightCacheProvider {
// C interface: `xnn_weights_cache_provider` callback.
static enum xnn_status delete_cache(void* context);

// C interface: `xnn_weights_cache_provider` callback.
static enum xnn_status alias_data(void* context, void* alias, void* original);

// Checks if caches misses have happened and updates the cache file stale
// flag.
bool WriteCacheMissFlag();
Expand All @@ -453,7 +456,9 @@ class MMapWeightCacheProvider {
/*look_up_or_insert=*/MMapWeightCacheProvider::look_up_or_insert,
/*is_finalized=*/MMapWeightCacheProvider::is_finalized,
/*offset_to_addr=*/MMapWeightCacheProvider::offset_to_addr,
/*delete_cache=*/MMapWeightCacheProvider::delete_cache};
/*delete_cache=*/MMapWeightCacheProvider::delete_cache,
/*alias_data=*/MMapWeightCacheProvider::alias_data,
};

// Path to the cache file.
std::string file_path_;
Expand Down
Loading