Skip to content

Commit

Permalink
Add abi flags to cpp_extension cache folder (pytorch#136890)
Browse files Browse the repository at this point in the history
This is to avoid cache confusion between normal vs pydebug vs nogil builds in cpp extensions which can lead to catastrophic ABI issues.
This is rare today for people to run both normal and pydebug on the same machine, but we expect quite a few people will run normal and nogil on the same machine going forward.

This is tested locally by running each version alternatively.
Pull Request resolved: pytorch#136890
Approved by: https://github.com/colesbury
  • Loading branch information
albanD authored and pytorchmergebot committed Sep 28, 2024
1 parent f42e88f commit e4571e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion torch/utils/cpp_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -2075,7 +2075,7 @@ def _get_build_directory(name: str, verbose: bool) -> str:
root_extensions_directory = get_default_build_root()
cu_str = ('cpu' if torch.version.cuda is None else
f'cu{torch.version.cuda.replace(".", "")}') # type: ignore[attr-defined]
python_version = f'py{sys.version_info.major}{sys.version_info.minor}'
python_version = f'py{sys.version_info.major}{sys.version_info.minor}{getattr(sys, "abiflags", "")}'
build_folder = f'{python_version}_{cu_str}'

root_extensions_directory = os.path.join(
Expand Down

0 comments on commit e4571e7

Please sign in to comment.