From 466178aee4e5f8b63929eadddaaa915375a9b00f Mon Sep 17 00:00:00 2001 From: Jan Pfeifer Date: Tue, 10 Mar 2026 07:16:01 +0100 Subject: [PATCH 01/19] Bumped build version for PJRT 0.98.X --- BUILDER_VERSION.txt | 2 +- XLA_COMMIT_HASH.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BUILDER_VERSION.txt b/BUILDER_VERSION.txt index b8626c4..573541a 100644 --- a/BUILDER_VERSION.txt +++ b/BUILDER_VERSION.txt @@ -1 +1 @@ -4 +0 diff --git a/XLA_COMMIT_HASH.txt b/XLA_COMMIT_HASH.txt index 30c9e7c..f62e5f4 100644 --- a/XLA_COMMIT_HASH.txt +++ b/XLA_COMMIT_HASH.txt @@ -1 +1 @@ -8ef2c8582a08a2b6aa5c74773421501e45e6be1c +bb731838f24ec318ad410a4e5f73b6dcdd095d4c From 2e97a5260e0347b224feb1ee1d2af22d555886c9 Mon Sep 17 00:00:00 2001 From: Jan Pfeifer Date: Tue, 10 Mar 2026 07:18:23 +0100 Subject: [PATCH 02/19] Updated AmazonLinux build instructions. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c50f188..7779fd3 100644 --- a/README.md +++ b/README.md @@ -36,5 +36,5 @@ It is also faster to run locally (if you have a good desktop) than in the GitHub To do that use: ```bash -docker build -f Dockerfile --target export --output type=local,dest=. . +docker build -f internal/al2023_amd64/Dockerfile --target export --output type=local,dest=. . ``` From 2fe10a78b1ebb769e09fb499c362e025d83f034e Mon Sep 17 00:00:00 2001 From: Jan Pfeifer Date: Tue, 10 Mar 2026 08:03:22 +0100 Subject: [PATCH 03/19] Re-enabled required SIMD support. --- .github/workflows/windows_amd64_build.yaml | 23 ---------------------- 1 file changed, 23 deletions(-) diff --git a/.github/workflows/windows_amd64_build.yaml b/.github/workflows/windows_amd64_build.yaml index 94e3ec8..0fdeae5 100644 --- a/.github/workflows/windows_amd64_build.yaml +++ b/.github/workflows/windows_amd64_build.yaml @@ -75,29 +75,6 @@ jobs: --repo_env=BAZEL_COMPILER=C:/PROGRA~1/LLVM/bin/clang.exe \ --repo_env=USE_CLANG_CL=1 \ --copt=-march=native \ - --define xnn_enable_arm_fp16_scalar=false \ - --define xnn_enable_arm_fp16_vector=false \ - --define xnn_enable_arm_bf16=false \ - --define xnn_enable_arm_dotprod=false \ - --define xnn_enable_arm_i8mm=false \ - --define xnn_enable_arm_sme=false \ - --define xnn_enable_arm_sme2=false \ - --define xnn_enable_riscv_vector=false \ - --define xnn_enable_riscv_fp16_vector=false \ - --define xnn_enable_avxvnni=false \ - --define xnn_enable_avxvnniint8=false \ - --define xnn_enable_avx256skx=false \ - --define xnn_enable_avx256vnni=false \ - --define xnn_enable_avx256vnnigfni=false \ - --define xnn_enable_avx512f=false \ - --define xnn_enable_avx512skx=false \ - --define xnn_enable_avx512vbmi=false \ - --define xnn_enable_avx512vnni=false \ - --define xnn_enable_avx512vnnigfni=false \ - --define xnn_enable_avx512amx=false \ - --define xnn_enable_avx512fp16=false \ - --define xnn_enable_avx512bf16=false \ - --define xnn_enable_hvx=false \ //xla/pjrt/c:pjrt_c_api_cpu_plugin.so - name: "Package the binary (zip)" From 629933c0bc47eb3ff0ad514cf506478a27b10cac Mon Sep 17 00:00:00 2001 From: Jan Pfeifer Date: Tue, 10 Mar 2026 08:03:34 +0100 Subject: [PATCH 04/19] Updated .gitignore. --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index de026a5..61799ba 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -pjrt_cpu_amazonlinux_amd64.tar.gz +# Build artefacts. +/pjrt_cpu_amazonlinux_amd64.tar.gz +/pjrt_cpu_linux_amd64.tar.gz From faac2f9504adca62b66455462eb23ae22472b29f Mon Sep 17 00:00:00 2001 From: Jan Pfeifer Date: Tue, 10 Mar 2026 08:26:58 +0100 Subject: [PATCH 05/19] Disable XNNPACK altogether in Windows, since it fails to compile. --- .github/workflows/windows_amd64_build.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/windows_amd64_build.yaml b/.github/workflows/windows_amd64_build.yaml index 0fdeae5..9b50a64 100644 --- a/.github/workflows/windows_amd64_build.yaml +++ b/.github/workflows/windows_amd64_build.yaml @@ -75,6 +75,7 @@ jobs: --repo_env=BAZEL_COMPILER=C:/PROGRA~1/LLVM/bin/clang.exe \ --repo_env=USE_CLANG_CL=1 \ --copt=-march=native \ + --define=tflite_with_xnnpack=false \ //xla/pjrt/c:pjrt_c_api_cpu_plugin.so - name: "Package the binary (zip)" From 1a1cb54a212a645d9dc2c93cee1c5a3ba0ff07f8 Mon Sep 17 00:00:00 2001 From: Jan Pfeifer Date: Tue, 10 Mar 2026 10:10:12 +0100 Subject: [PATCH 06/19] Attempt to fix Windows build. --- .github/workflows/windows_amd64_build.yaml | 32 +++++++++++++--------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/.github/workflows/windows_amd64_build.yaml b/.github/workflows/windows_amd64_build.yaml index 9b50a64..8e452b9 100644 --- a/.github/workflows/windows_amd64_build.yaml +++ b/.github/workflows/windows_amd64_build.yaml @@ -45,37 +45,43 @@ jobs: echo "Building PJRT CPU plugin for version ${MAJOR}.${MINOR} (to be used in go-xla as v${MAJOR}.${MINOR}.${BUILDER_VERSION})" echo "RELEASE_VERSION=v${MAJOR}.${MINOR}.${BUILDER_VERSION}" >> $GITHUB_ENV - - run: | + - name: Configure XLA + run: | cd xla python configure.py --backend=cpu --os=windows --host_compiler=clang --clang_path=C:/PROGRA~1/LLVM/bin/clang.exe cat xla_configure.bazelrc - - name: Fix Windows paths in bazelrc + - name: Fix Windows paths and environment run: | cd xla # Fix Windows paths for Bazel compatibility - # Replace "Program Files" with short name (handles both / and \ separators) sed -i 's|Program Files|PROGRA~1|g' xla_configure.bazelrc - # Convert all backslashes to forward slashes sed -i 's|\\|/|g' xla_configure.bazelrc - cat xla_configure.bazelrc + + # Force Bazel to use the manually installed LLVM for everything + echo "build --action_env=CC=C:/PROGRA~1/LLVM/bin/clang-cl.exe" >> xla_configure.bazelrc + echo "build --action_env=CXX=C:/PROGRA~1/LLVM/bin/clang-cl.exe" >> xla_configure.bazelrc + echo "build --linkopt=/FORCE:MULTIPLE" >> xla_configure.bazelrc echo "Applying dllexport patch ---------------" - # --ignore-whitespace is required because of the CRLF vs LF difference in windows. git apply --ignore-whitespace --3way ../internal/patches/windows/export.patch - - run: | + - name: Build PJRT C API CPU plugin + run: | cd xla printf "\nStarting XLA bazel build:\n" + # 1. We use --config=clang_local to use the LLVM toolchain. + # 2. We add -mavx512f to copt to allow inlining of AVX512 kernels. + # 3. We disable the specific XNNPACK flags that were causing conflicts. bazel build \ --config=clang_local \ - --action_env=CC=C:/PROGRA~1/LLVM/bin/clang.exe \ - --action_env=CXX=C:/PROGRA~1/LLVM/bin/clang++.exe \ - --linkopt="--ld-path=C:/PROGRA~1/LLVM/bin/ld.lld.exe" \ - --repo_env=BAZEL_COMPILER=C:/PROGRA~1/LLVM/bin/clang.exe \ - --repo_env=USE_CLANG_CL=1 \ --copt=-march=native \ + --copt=-mavx512f \ + --copt=-mavx512bw \ + --copt=-mavx512dq \ + --copt=-mavx512vl \ --define=tflite_with_xnnpack=false \ + --build_tag_filters=-no_oss,-gpu,-requires-mem-64g \ //xla/pjrt/c:pjrt_c_api_cpu_plugin.so - name: "Package the binary (zip)" @@ -96,4 +102,4 @@ jobs: tag_name: ${{ env.RELEASE_VERSION }} files: ${{ env.ZIP_NAME }} env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 3eafd46acd05445ef91efb6eb1e1bf0e4bc2b6f3 Mon Sep 17 00:00:00 2001 From: Jan Pfeifer Date: Tue, 10 Mar 2026 10:22:32 +0100 Subject: [PATCH 07/19] Attempt #5 in getting windows to compile. --- .github/workflows/windows_amd64_build.yaml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/windows_amd64_build.yaml b/.github/workflows/windows_amd64_build.yaml index 8e452b9..c56905d 100644 --- a/.github/workflows/windows_amd64_build.yaml +++ b/.github/workflows/windows_amd64_build.yaml @@ -54,14 +54,18 @@ jobs: - name: Fix Windows paths and environment run: | cd xla - # Fix Windows paths for Bazel compatibility + # 1. Fix Windows paths in the generated bazelrc sed -i 's|Program Files|PROGRA~1|g' xla_configure.bazelrc sed -i 's|\\|/|g' xla_configure.bazelrc - - # Force Bazel to use the manually installed LLVM for everything + + # 2. Force Bazel to treat Clang-CL as the primary compiler for all dependencies + # Using --compiler=clang-cl is crucial for external libraries like highwayhash. + echo "build --compiler=clang-cl" >> xla_configure.bazelrc + echo "build --linkopt=/FORCE:MULTIPLE" >> xla_configure.bazelrc + + # 3. Explicitly set the path to the compiler in the rc file echo "build --action_env=CC=C:/PROGRA~1/LLVM/bin/clang-cl.exe" >> xla_configure.bazelrc echo "build --action_env=CXX=C:/PROGRA~1/LLVM/bin/clang-cl.exe" >> xla_configure.bazelrc - echo "build --linkopt=/FORCE:MULTIPLE" >> xla_configure.bazelrc echo "Applying dllexport patch ---------------" git apply --ignore-whitespace --3way ../internal/patches/windows/export.patch @@ -70,17 +74,17 @@ jobs: run: | cd xla printf "\nStarting XLA bazel build:\n" - # 1. We use --config=clang_local to use the LLVM toolchain. - # 2. We add -mavx512f to copt to allow inlining of AVX512 kernels. - # 3. We disable the specific XNNPACK flags that were causing conflicts. + # BAZEL_LLVM_RESPECT_CLANG_ONLY=1 helps prevent falling back to cl.exe + export BAZEL_LLVM_RESPECT_CLANG_ONLY=1 + bazel build \ --config=clang_local \ + --define=tflite_with_xnnpack=false \ --copt=-march=native \ --copt=-mavx512f \ --copt=-mavx512bw \ --copt=-mavx512dq \ --copt=-mavx512vl \ - --define=tflite_with_xnnpack=false \ --build_tag_filters=-no_oss,-gpu,-requires-mem-64g \ //xla/pjrt/c:pjrt_c_api_cpu_plugin.so From 043bbb5d9bb92f666143f0ebcca1f72f86c46709 Mon Sep 17 00:00:00 2001 From: Jan Pfeifer Date: Tue, 10 Mar 2026 18:09:37 +0100 Subject: [PATCH 08/19] Disabling AVX512 for Windows: it doesn't gracefully degrade to AVX2 if AVX512 not available, it was simply crashing. --- .github/workflows/windows_amd64_build.yaml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/windows_amd64_build.yaml b/.github/workflows/windows_amd64_build.yaml index c56905d..8c5891b 100644 --- a/.github/workflows/windows_amd64_build.yaml +++ b/.github/workflows/windows_amd64_build.yaml @@ -45,13 +45,13 @@ jobs: echo "Building PJRT CPU plugin for version ${MAJOR}.${MINOR} (to be used in go-xla as v${MAJOR}.${MINOR}.${BUILDER_VERSION})" echo "RELEASE_VERSION=v${MAJOR}.${MINOR}.${BUILDER_VERSION}" >> $GITHUB_ENV - - name: Configure XLA + - name: "Configure XLA" run: | cd xla python configure.py --backend=cpu --os=windows --host_compiler=clang --clang_path=C:/PROGRA~1/LLVM/bin/clang.exe cat xla_configure.bazelrc - - name: Fix Windows paths and environment + - name: "Fix Windows paths and environment" run: | cd xla # 1. Fix Windows paths in the generated bazelrc @@ -70,24 +70,21 @@ jobs: echo "Applying dllexport patch ---------------" git apply --ignore-whitespace --3way ../internal/patches/windows/export.patch - - name: Build PJRT C API CPU plugin + - name: "Build PJRT C API CPU plugin" run: | cd xla printf "\nStarting XLA bazel build:\n" - # BAZEL_LLVM_RESPECT_CLANG_ONLY=1 helps prevent falling back to cl.exe export BAZEL_LLVM_RESPECT_CLANG_ONLY=1 bazel build \ --config=clang_local \ --define=tflite_with_xnnpack=false \ - --copt=-march=native \ - --copt=-mavx512f \ - --copt=-mavx512bw \ - --copt=-mavx512dq \ - --copt=-mavx512vl \ + --copt=-mavx2 \ + --copt=-mfma \ + --copt=/MT \ --build_tag_filters=-no_oss,-gpu,-requires-mem-64g \ //xla/pjrt/c:pjrt_c_api_cpu_plugin.so - + - name: "Package the binary (zip)" run: | # Create the tarball. @@ -100,7 +97,7 @@ jobs: 7z a "$ZIP_NAME" "${TARGET_NAME}" echo "ZIP_NAME=${ZIP_NAME}" >> $GITHUB_ENV - - name: Upload release asset + - name: "Upload release asset" uses: softprops/action-gh-release@v2 with: tag_name: ${{ env.RELEASE_VERSION }} From e204e59df792e954854d2232443c7a7de97d6c85 Mon Sep 17 00:00:00 2001 From: Jan Pfeifer Date: Tue, 10 Mar 2026 18:12:12 +0100 Subject: [PATCH 09/19] Updated name of a step of windows build. --- .github/workflows/windows_amd64_build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows_amd64_build.yaml b/.github/workflows/windows_amd64_build.yaml index 8c5891b..329cf8f 100644 --- a/.github/workflows/windows_amd64_build.yaml +++ b/.github/workflows/windows_amd64_build.yaml @@ -36,8 +36,8 @@ jobs: echo "Checking out XLA at commit: $HASH" git checkout $HASH - - run: | - # Extract version numbers + - name: "Extract version numbers" + run: | BUILDER_VERSION="$(cat BUILDER_VERSION.txt)" PJRT_C_API_HEADER="./xla/xla/pjrt/c/pjrt_c_api.h" MAJOR=$(grep -E '#define PJRT_API_MAJOR' "${PJRT_C_API_HEADER}" | awk '{print $3}') From 34ee186a53d3826f22f9877b4fc53c3a6cdcc868 Mon Sep 17 00:00:00 2001 From: Jan Pfeifer Date: Tue, 10 Mar 2026 18:27:13 +0100 Subject: [PATCH 10/19] Another attempt at building for windows. --- .github/workflows/windows_amd64_build.yaml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/windows_amd64_build.yaml b/.github/workflows/windows_amd64_build.yaml index 329cf8f..b5cd541 100644 --- a/.github/workflows/windows_amd64_build.yaml +++ b/.github/workflows/windows_amd64_build.yaml @@ -54,16 +54,21 @@ jobs: - name: "Fix Windows paths and environment" run: | cd xla - # 1. Fix Windows paths in the generated bazelrc + # 1. Fix Windows paths for Bazel compatibility sed -i 's|Program Files|PROGRA~1|g' xla_configure.bazelrc sed -i 's|\\|/|g' xla_configure.bazelrc - # 2. Force Bazel to treat Clang-CL as the primary compiler for all dependencies - # Using --compiler=clang-cl is crucial for external libraries like highwayhash. + # 2. Force Clang-CL and fix "multiple source files" error echo "build --compiler=clang-cl" >> xla_configure.bazelrc + + # 3. Use features that force one-file-at-a-time compilation for safety + echo "build --features=-compiler_param_file" >> xla_configure.bazelrc + echo "build --features=-archive_param_file" >> xla_configure.bazelrc + + # 4. Linker safety echo "build --linkopt=/FORCE:MULTIPLE" >> xla_configure.bazelrc - # 3. Explicitly set the path to the compiler in the rc file + # 5. Compiler Paths echo "build --action_env=CC=C:/PROGRA~1/LLVM/bin/clang-cl.exe" >> xla_configure.bazelrc echo "build --action_env=CXX=C:/PROGRA~1/LLVM/bin/clang-cl.exe" >> xla_configure.bazelrc @@ -76,6 +81,8 @@ jobs: printf "\nStarting XLA bazel build:\n" export BAZEL_LLVM_RESPECT_CLANG_ONLY=1 + # AVX-512 is disabled because is doesn't gracefully fallback to AVX2 in runtime, + # instead it was just crashing. So we build only with AVX2. bazel build \ --config=clang_local \ --define=tflite_with_xnnpack=false \ From a69694ba5d555590c3d6161fd54a705a284eff14 Mon Sep 17 00:00:00 2001 From: Jan Pfeifer Date: Tue, 10 Mar 2026 18:28:16 +0100 Subject: [PATCH 11/19] win build update --- .github/workflows/windows_amd64_build.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/windows_amd64_build.yaml b/.github/workflows/windows_amd64_build.yaml index b5cd541..8a3dced 100644 --- a/.github/workflows/windows_amd64_build.yaml +++ b/.github/workflows/windows_amd64_build.yaml @@ -77,21 +77,21 @@ jobs: - name: "Build PJRT C API CPU plugin" run: | - cd xla - printf "\nStarting XLA bazel build:\n" - export BAZEL_LLVM_RESPECT_CLANG_ONLY=1 - # AVX-512 is disabled because is doesn't gracefully fallback to AVX2 in runtime, # instead it was just crashing. So we build only with AVX2. + + cd xla + printf "\nStarting XLA bazel build:\n" + export BAZEL_LLVM_RESPECT_CLANG_ONLY=1 bazel build \ --config=clang_local \ --define=tflite_with_xnnpack=false \ --copt=-mavx2 \ --copt=-mfma \ --copt=/MT \ - --build_tag_filters=-no_oss,-gpu,-requires-mem-64g \ + --copt=-D_CRT_SECURE_NO_WARNINGS \ //xla/pjrt/c:pjrt_c_api_cpu_plugin.so - + - name: "Package the binary (zip)" run: | # Create the tarball. From 9013d6a18e9c4a38d03d29d6d950a327a06dfb32 Mon Sep 17 00:00:00 2001 From: Jan Pfeifer Date: Tue, 10 Mar 2026 18:48:04 +0100 Subject: [PATCH 12/19] win build. --- .github/workflows/windows_amd64_build.yaml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/windows_amd64_build.yaml b/.github/workflows/windows_amd64_build.yaml index 8a3dced..9d94a70 100644 --- a/.github/workflows/windows_amd64_build.yaml +++ b/.github/workflows/windows_amd64_build.yaml @@ -61,14 +61,17 @@ jobs: # 2. Force Clang-CL and fix "multiple source files" error echo "build --compiler=clang-cl" >> xla_configure.bazelrc - # 3. Use features that force one-file-at-a-time compilation for safety + # 3. Prevent Git-Bash from expanding /MT into a path by using the -MT syntax + echo "build --copt=-MT" >> xla_configure.bazelrc + + # 4. Force one-file-at-a-time compilation to fix clang-cl /Fo error echo "build --features=-compiler_param_file" >> xla_configure.bazelrc echo "build --features=-archive_param_file" >> xla_configure.bazelrc - # 4. Linker safety + # 5. Linker safety echo "build --linkopt=/FORCE:MULTIPLE" >> xla_configure.bazelrc - # 5. Compiler Paths + # 6. Compiler Paths echo "build --action_env=CC=C:/PROGRA~1/LLVM/bin/clang-cl.exe" >> xla_configure.bazelrc echo "build --action_env=CXX=C:/PROGRA~1/LLVM/bin/clang-cl.exe" >> xla_configure.bazelrc @@ -79,16 +82,17 @@ jobs: run: | # AVX-512 is disabled because is doesn't gracefully fallback to AVX2 in runtime, # instead it was just crashing. So we build only with AVX2. - cd xla printf "\nStarting XLA bazel build:\n" - export BAZEL_LLVM_RESPECT_CLANG_ONLY=1 + export BAZEL_LLVM_RESPECT_CLANG_ONLY=1 + + # Use -MT instead of /MT to avoid Git-Bash path translation bazel build \ --config=clang_local \ --define=tflite_with_xnnpack=false \ --copt=-mavx2 \ --copt=-mfma \ - --copt=/MT \ + --copt=-MT \ --copt=-D_CRT_SECURE_NO_WARNINGS \ //xla/pjrt/c:pjrt_c_api_cpu_plugin.so From d008769d126e2b699cccbde4f00e4b023c022b3d Mon Sep 17 00:00:00 2001 From: Jan Pfeifer Date: Tue, 10 Mar 2026 19:08:51 +0100 Subject: [PATCH 13/19] win build --- .github/workflows/windows_amd64_build.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/windows_amd64_build.yaml b/.github/workflows/windows_amd64_build.yaml index 9d94a70..e646eba 100644 --- a/.github/workflows/windows_amd64_build.yaml +++ b/.github/workflows/windows_amd64_build.yaml @@ -84,18 +84,18 @@ jobs: # instead it was just crashing. So we build only with AVX2. cd xla printf "\nStarting XLA bazel build:\n" - export BAZEL_LLVM_RESPECT_CLANG_ONLY=1 - - # Use -MT instead of /MT to avoid Git-Bash path translation + export BAZEL_LLVM_RESPECT_CLANG_ONLY=1 bazel build \ --config=clang_local \ --define=tflite_with_xnnpack=false \ --copt=-mavx2 \ --copt=-mfma \ + --copt=-mbmi \ + --copt=-mbmi2 \ --copt=-MT \ --copt=-D_CRT_SECURE_NO_WARNINGS \ //xla/pjrt/c:pjrt_c_api_cpu_plugin.so - + - name: "Package the binary (zip)" run: | # Create the tarball. From a2b7d9760fdff844a3b0ff9a1f4cf7769b117a74 Mon Sep 17 00:00:00 2001 From: Jan Date: Tue, 10 Mar 2026 20:08:18 +0100 Subject: [PATCH 14/19] Add -mlzcnt option from Windows build workflow --- .github/workflows/windows_amd64_build.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows_amd64_build.yaml b/.github/workflows/windows_amd64_build.yaml index e646eba..e43d912 100644 --- a/.github/workflows/windows_amd64_build.yaml +++ b/.github/workflows/windows_amd64_build.yaml @@ -92,6 +92,7 @@ jobs: --copt=-mfma \ --copt=-mbmi \ --copt=-mbmi2 \ + --copt=-mlzcnt \ --copt=-MT \ --copt=-D_CRT_SECURE_NO_WARNINGS \ //xla/pjrt/c:pjrt_c_api_cpu_plugin.so @@ -114,4 +115,4 @@ jobs: tag_name: ${{ env.RELEASE_VERSION }} files: ${{ env.ZIP_NAME }} env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From e4faf2be18d07e1e701c106abbe73aa271eb60b7 Mon Sep 17 00:00:00 2001 From: Jan Pfeifer Date: Wed, 11 Mar 2026 05:56:52 +0100 Subject: [PATCH 15/19] win build --- .github/workflows/windows_amd64_build.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows_amd64_build.yaml b/.github/workflows/windows_amd64_build.yaml index e646eba..fdd6469 100644 --- a/.github/workflows/windows_amd64_build.yaml +++ b/.github/workflows/windows_amd64_build.yaml @@ -55,7 +55,9 @@ jobs: run: | cd xla # 1. Fix Windows paths for Bazel compatibility + # Replace "Program Files" with short name (handles both / and \ separators) sed -i 's|Program Files|PROGRA~1|g' xla_configure.bazelrc + # Convert all backslashes to forward slashes sed -i 's|\\|/|g' xla_configure.bazelrc # 2. Force Clang-CL and fix "multiple source files" error @@ -87,9 +89,14 @@ jobs: export BAZEL_LLVM_RESPECT_CLANG_ONLY=1 bazel build \ --config=clang_local \ + --linkopt="--ld-path=C:/PROGRA~1/LLVM/bin/ld.lld.exe" \ + --repo_env=BAZEL_COMPILER=C:/PROGRA~1/LLVM/bin/clang-cl.exe \ + --repo_env=USE_CLANG_CL=1 \ + --copt=-march=native \ --define=tflite_with_xnnpack=false \ --copt=-mavx2 \ --copt=-mfma \ + --copt=-mf16c \ --copt=-mbmi \ --copt=-mbmi2 \ --copt=-MT \ @@ -114,4 +121,4 @@ jobs: tag_name: ${{ env.RELEASE_VERSION }} files: ${{ env.ZIP_NAME }} env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 708f0cf1945dd41c4647cbafb32053afc61eb649 Mon Sep 17 00:00:00 2001 From: Jan Pfeifer Date: Wed, 11 Mar 2026 06:01:23 +0100 Subject: [PATCH 16/19] win bulid --- .github/workflows/windows_amd64_build.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows_amd64_build.yaml b/.github/workflows/windows_amd64_build.yaml index fdd6469..1075e50 100644 --- a/.github/workflows/windows_amd64_build.yaml +++ b/.github/workflows/windows_amd64_build.yaml @@ -87,8 +87,10 @@ jobs: cd xla printf "\nStarting XLA bazel build:\n" export BAZEL_LLVM_RESPECT_CLANG_ONLY=1 - bazel build \ + bazel --output_user_root="C:/b" + build \ --config=clang_local \ + --features=archive_param_file --features=linker_param_file --features=compiler_param_file \ --linkopt="--ld-path=C:/PROGRA~1/LLVM/bin/ld.lld.exe" \ --repo_env=BAZEL_COMPILER=C:/PROGRA~1/LLVM/bin/clang-cl.exe \ --repo_env=USE_CLANG_CL=1 \ From ab34df339181967e9c2edf715936086b9effc0fc Mon Sep 17 00:00:00 2001 From: Jan Pfeifer Date: Wed, 11 Mar 2026 07:23:17 +0100 Subject: [PATCH 17/19] win build --- .github/workflows/windows_amd64_build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows_amd64_build.yaml b/.github/workflows/windows_amd64_build.yaml index fbe1d34..9dac376 100644 --- a/.github/workflows/windows_amd64_build.yaml +++ b/.github/workflows/windows_amd64_build.yaml @@ -87,7 +87,7 @@ jobs: cd xla printf "\nStarting XLA bazel build:\n" export BAZEL_LLVM_RESPECT_CLANG_ONLY=1 - bazel --output_user_root="C:/b" + bazel --output_user_root="C:/b" \ build \ --config=clang_local \ --features=archive_param_file --features=linker_param_file --features=compiler_param_file \ From 8d65c5ca46f711d33b43ecf30890246c0f9aaa66 Mon Sep 17 00:00:00 2001 From: Jan Pfeifer Date: Wed, 11 Mar 2026 08:39:44 +0100 Subject: [PATCH 18/19] style: Remove trailing whitespace from the Windows AMD64 build workflow file. --- .github/workflows/windows_amd64_build.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/windows_amd64_build.yaml b/.github/workflows/windows_amd64_build.yaml index 9dac376..720f21e 100644 --- a/.github/workflows/windows_amd64_build.yaml +++ b/.github/workflows/windows_amd64_build.yaml @@ -59,20 +59,20 @@ jobs: sed -i 's|Program Files|PROGRA~1|g' xla_configure.bazelrc # Convert all backslashes to forward slashes sed -i 's|\\|/|g' xla_configure.bazelrc - + # 2. Force Clang-CL and fix "multiple source files" error echo "build --compiler=clang-cl" >> xla_configure.bazelrc - + # 3. Prevent Git-Bash from expanding /MT into a path by using the -MT syntax echo "build --copt=-MT" >> xla_configure.bazelrc - + # 4. Force one-file-at-a-time compilation to fix clang-cl /Fo error echo "build --features=-compiler_param_file" >> xla_configure.bazelrc echo "build --features=-archive_param_file" >> xla_configure.bazelrc - + # 5. Linker safety echo "build --linkopt=/FORCE:MULTIPLE" >> xla_configure.bazelrc - + # 6. Compiler Paths echo "build --action_env=CC=C:/PROGRA~1/LLVM/bin/clang-cl.exe" >> xla_configure.bazelrc echo "build --action_env=CXX=C:/PROGRA~1/LLVM/bin/clang-cl.exe" >> xla_configure.bazelrc @@ -86,7 +86,7 @@ jobs: # instead it was just crashing. So we build only with AVX2. cd xla printf "\nStarting XLA bazel build:\n" - export BAZEL_LLVM_RESPECT_CLANG_ONLY=1 + export BAZEL_LLVM_RESPECT_CLANG_ONLY=1 bazel --output_user_root="C:/b" \ build \ --config=clang_local \ @@ -94,7 +94,7 @@ jobs: --linkopt="--ld-path=C:/PROGRA~1/LLVM/bin/ld.lld.exe" \ --repo_env=BAZEL_COMPILER=C:/PROGRA~1/LLVM/bin/clang-cl.exe \ --repo_env=USE_CLANG_CL=1 \ - --copt=-march=native \ + --copt=-march=native \ --define=tflite_with_xnnpack=false \ --copt=-mavx2 \ --copt=-mfma \ @@ -105,7 +105,7 @@ jobs: --copt=-MT \ --copt=-D_CRT_SECURE_NO_WARNINGS \ //xla/pjrt/c:pjrt_c_api_cpu_plugin.so - + - name: "Package the binary (zip)" run: | # Create the tarball. From 54a17ea2c41a41e1ad0e2d0a9a4f8711b49b24f3 Mon Sep 17 00:00:00 2001 From: Jan Pfeifer Date: Wed, 11 Mar 2026 11:02:04 +0100 Subject: [PATCH 19/19] Adjust Bazel feature flags in `windows_amd64_build.yaml` by enabling `archive_param_file` and `linker_param_file` via `xla_configure.bazelrc` and removing explicit feature flags from the build command. --- .github/workflows/windows_amd64_build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows_amd64_build.yaml b/.github/workflows/windows_amd64_build.yaml index 720f21e..cc2f92b 100644 --- a/.github/workflows/windows_amd64_build.yaml +++ b/.github/workflows/windows_amd64_build.yaml @@ -68,7 +68,8 @@ jobs: # 4. Force one-file-at-a-time compilation to fix clang-cl /Fo error echo "build --features=-compiler_param_file" >> xla_configure.bazelrc - echo "build --features=-archive_param_file" >> xla_configure.bazelrc + echo "build --features=archive_param_file" >> xla_configure.bazelrc + echo "build --features=linker_param_file" >> xla_configure.bazelrc # 5. Linker safety echo "build --linkopt=/FORCE:MULTIPLE" >> xla_configure.bazelrc @@ -90,7 +91,6 @@ jobs: bazel --output_user_root="C:/b" \ build \ --config=clang_local \ - --features=archive_param_file --features=linker_param_file --features=compiler_param_file \ --linkopt="--ld-path=C:/PROGRA~1/LLVM/bin/ld.lld.exe" \ --repo_env=BAZEL_COMPILER=C:/PROGRA~1/LLVM/bin/clang-cl.exe \ --repo_env=USE_CLANG_CL=1 \