Open
Description
🚀 Feature
Support building PyTorch/XLA with clang as the C/C++ compiler.
Motivation
Currently the PyTorch/XLA build uses gcc as the C/C++ compiler. Switching to clang gives us several benefits:
- Consistency with PyTorch, which uses clang.
- Faster build - experience shows that clang often is 2-3x faster than gcc.
- Smaller memory usage by the compiler - clang typically uses ~1/3 of the RAM as gcc when compiling.
- Consistency with other tooling we use, like clang-format.
Pitch
- Add a configuration for building with clang, so that we can add
--config=clang
to thebazel
commandline to select clang. - Fix incompatibilities with clang.
- Measure the compilation performance of clang vs gcc.
- If the result of 3 is favorable, switch the build to use clang by default.
Alternatives
Do nothing - support gcc only.