Skip to content

Commit

Permalink
Use clang for PyTorch/XLA only.
Browse files Browse the repository at this point in the history
  • Loading branch information
ysiraichi committed Feb 6, 2025
1 parent d8ab058 commit 5e38816
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
12 changes: 8 additions & 4 deletions infra/ansible/config/env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# They'll be accessible for all processes on the host, also in the development image.
release_env:
common:
CC: "/usr/lib/llvm-{{ clang_version }}/bin/clang"
CXX: "/usr/lib/llvm-{{ clang_version }}/bin/clang"
CC: gcc-10
CXX: g++-10
LD_LIBRARY_PATH: "$LD_LIBRARY_PATH:/usr/local/lib"

tpu:
Expand All @@ -21,8 +21,8 @@ build_env:
# Set explicitly to 0 as setup.py defaults this flag to true if unset.
BUILD_CPP_TESTS: "{{ build_cpp_tests }}"
# Force GCC because clang/bazel has issues.
CC: "/usr/lib/llvm-{{ clang_version }}/bin/clang"
CXX: "/usr/lib/llvm-{{ clang_version }}/bin/clang"
CC: gcc-10
CXX: g++-10
PYTORCH_BUILD_NUMBER: 1
TORCH_XLA_VERSION: "{{ package_version }}"
PYTORCH_BUILD_VERSION: "{{ package_version }}"
Expand All @@ -45,3 +45,7 @@ build_env:
ACCELERATOR: tpu
TPUVM_MODE: 1
BUNDLE_LIBTPU: "{{ bundle_libtpu }}"

clang_compiler:
CC: /usr/lib/{{ clang_version }}/bin/clang
CXX: /usr/lib/{{ clang_version }}/bin/clang++
2 changes: 2 additions & 0 deletions infra/ansible/playbook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
combine(build_env[arch] | default({}, true)) |
combine(build_env[accelerator] | default({}, true))
}}"
clang_compiler: "{{ clang_compiler }}"
when: stage == "build"
tags: build_srcs

Expand All @@ -92,6 +93,7 @@
build_env.common | default({}, true) |
combine(build_env[arch] | default({}, true)) |
combine(build_env[accelerator] | default({}, true))
combine(clang_compiler)
}}"
when: stage == "build_plugin"
tags: build_plugin
Expand Down
2 changes: 1 addition & 1 deletion infra/ansible/roles/build_srcs/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
ansible.builtin.command:
cmd: python setup.py bdist_wheel
chdir: "{{ (src_root, 'pytorch/xla') | path_join }}"
environment: "{{ env_vars }}"
environment: "{{ env_vars | combine(clang_compiler) }}"

- name: Find XLA *.whl files in pytorch/xla/dist
ansible.builtin.find:
Expand Down

0 comments on commit 5e38816

Please sign in to comment.