Manipulate triton_hash_with_backend so that it doesn't contain any keywords (#128159)

Summary: See https://github.com/pytorch/pytorch/issues/127637 where "def" appears in the backend_hash and causes a problem.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/128159
Approved by: https://github.com/jansel
This commit is contained in:
Sam Larsen 2024-06-06 13:55:05 -07:00 committed by PyTorch MergeBot
parent 852b7b4c99
commit 8d16a73f0f

View File

@ -61,7 +61,9 @@ def triton_hash_with_backend():
backend = triton_backend()
key = f"{triton_key()}-{backend.hash()}"
return hashlib.sha256(key.encode("utf-8")).hexdigest()
# Hash is upper case so that it can't contain any Python keywords.
return hashlib.sha256(key.encode("utf-8")).hexdigest().upper()
def dtype_to_string(dtype):