Skip to content

Commit

Permalink
Wrap remote cache creation with a try-catch (#121340)
Browse files Browse the repository at this point in the history
Summary: In production I am seeing errors like "AttributeError: module 'triton.runtime' has no attribute 'fb_memcache'", likely due to some package skew. Until this is resolved, lets wrap this code with try-catch.

Test Plan: CI

Differential Revision: D54604339

Pull Request resolved: #121340
Approved by: https://github.com/aakhundov
  • Loading branch information
oulgen authored and pytorchmergebot committed Mar 7, 2024
1 parent 291ce86 commit 953c6c3
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions torch/_inductor/triton_heuristics.py
Expand Up @@ -845,14 +845,18 @@ def cached_autotune(
key = backend_hash + configs_hash + "autotune-best-config"
key = hashlib.sha256(key.encode("utf-8")).hexdigest()

if config.is_fbcode():
remote_cache = (
triton.runtime.fb_memcache.FbMemcacheRemoteCacheBackend(
key, is_autotune=True
try:
if config.is_fbcode():
remote_cache = (
triton.runtime.fb_memcache.FbMemcacheRemoteCacheBackend(
key, is_autotune=True
)
)
)
else:
remote_cache = triton.runtime.cache.RedisRemoteCacheBackend(key)
else:
remote_cache = triton.runtime.cache.RedisRemoteCacheBackend(key)
except Exception:
remote_cache = None
log.warning("Unable to create a remote cache", exc_info=True)
# we already sha256 hash the source contents
remote_cache_key = os.path.basename(filename)
else:
Expand Down

0 comments on commit 953c6c3

Please sign in to comment.