Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a metrics to track persistent cache loading time #7039

Merged
merged 2 commits into from
May 9, 2024
Merged
Changes from 1 commit
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
1 change: 1 addition & 0 deletions torch_xla/csrc/runtime/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class PersistentCache : public AbstractCache<K, T, H, E> {
// if the key is tracked in memory, and if not it will check for a persisted
// version on disk.
TypePtr Get(const K& key) override {
TORCH_LAZY_TIMED("PersistentCacheGet");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will also trigger for binaries that are already loaded and cached in-memory, what do you think of moving it to ~L176 to only capture the load+deserialize logic? Maybe renamed to TORCH_LAZY_TIMED("PersistentCacheLoad")

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sg, let me update

std::lock_guard<std::mutex> slock(lock_);
TypePtr mem = memory_cache_.Get(key);
if (mem) {
Expand Down
Loading