Fix torch.utils.cpp_extension parser for clang version 20.1.7+libcxx#157666
Fix torch.utils.cpp_extension parser for clang version 20.1.7+libcxx#157666AngryLoki wants to merge 1 commit intopytorch:mainfrom
Conversation
When CC and CXX compiler is set to clang, and clang was compiled with libc++, compilation of torchvision fails with:
```
File "/usr/lib/python3.12/site-packages/torch/utils/cpp_extension.py", line 585, in build_extensions
compiler_name, compiler_version = self._check_abi()
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/torch/utils/cpp_extension.py", line 1034, in _check_abi
_, version = get_compiler_abi_compatibility_and_version(compiler)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/torch/utils/cpp_extension.py", line 449, in get_compiler_abi_compatibility_and_version
if tuple(map(int, version)) >= minimum_required_version:
^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: '7+libcxx'
```
Compiler identification is a valid semantic version:
```
$ clang -dumpfullversion -dumpversion
20.1.7+libcxx
```
After adjusting parser of version, clang is able to compile extensions successfully.
Closes pytorch#157665
Signed-off-by: Sv. Lockal <lockalsash@gmail.com>
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/157666
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 6bc290a with merge base 3e56a9c ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@pytorchbot label "topic: not user facing" |
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: 1 jobs have failed, first few of them are: Check Labels / Check labels Details for Dev Infra teamRaised by workflow job |
|
@pytorchbot label "topic: not user facing" |
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
|
@msaroufim In general, when one accepts a PR it's customary to ask for regression test, which can go from an extreme of setting up a new docker to a more docile uinttest in test_utils that just mocks the exec output. Also, please be mindful of release notes and if this is a regression than it might be a good time to cherry-pick the fix into the release branch (but then again, there is a question of testing) |
When CC and CXX compiler is set to clang, and clang was compiled with libc++, compilation of torchvision fails with:
Compiler identification is a valid semantic version:
After adjusting parser of version, clang is able to compile extensions successfully.
Fixes #157665