Skip to content

Commit

Permalink
work around patch-ception breaking patch
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari committed Feb 22, 2025
1 parent 3100ff7 commit cc8e996
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 139 deletions.
4 changes: 3 additions & 1 deletion recipe/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash

set -euxo pipefail

# see comment in meta.yaml
cp $RECIPE_DIR/patches/0007-xla-cpu-Fix-build-errors-from-ACL.patch $SRC_DIR/third_party/xla/

export JAX_RELEASE=$PKG_VERSION

$RECIPE_DIR/add_py_toolchain.sh
Expand Down
4 changes: 4 additions & 0 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ source:
patches:
- patches/0001-Allow-for-custom-CUDA-build.patch
- patches/0002-Consolidated-build-fixes-for-XLA.patch
# cannot absorb this into the overall jax patch, because patching three vendored projects
# deep breaks the application of the patch using `patch` (presumably due to lines starting
# legitimately with `+++` being misinterpreted as a hunk separator).
# - patches/0007-xla-cpu-Fix-build-errors-from-ACL.patch

build:
number: {{ build }}
Expand Down
140 changes: 2 additions & 138 deletions recipe/patches/0002-Consolidated-build-fixes-for-XLA.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From b1c1955f80774f6590ad72fef42221ff720c8bf5 Mon Sep 17 00:00:00 2001
From a56d0a224f537e13570ddf60bb83300c30ce417b Mon Sep 17 00:00:00 2001
From: "Uwe L. Korn" <[email protected]>
Date: Thu, 14 Dec 2023 17:06:15 +0100
Subject: [PATCH 2/2] Consolidated build fixes for XLA
Expand All @@ -20,16 +20,14 @@ Co-Authored-By: H. Vetinari <[email protected]>
...0004-Add-missing-bits-absl-systemlib.patch | 245 ++++++++++++++++++
...ther-absl-log-is-already-initialized.patch | 58 +++++
.../xla/0006-Add-conda-cuda-path.patch | 31 +++
...07-xla-cpu-Fix-build-errors-from-ACL.patch | 128 +++++++++
third_party/xla/workspace.bzl | 10 +
8 files changed, 621 insertions(+)
7 files changed, 493 insertions(+)
create mode 100644 third_party/xla/0001-Support-third-party-build-of-boringssl.patch
create mode 100644 third_party/xla/0002-Fix-abseil-headers.patch
create mode 100644 third_party/xla/0003-Omit-usage-of-StrFormat.patch
create mode 100644 third_party/xla/0004-Add-missing-bits-absl-systemlib.patch
create mode 100644 third_party/xla/0005-Check-whether-absl-log-is-already-initialized.patch
create mode 100644 third_party/xla/0006-Add-conda-cuda-path.patch
create mode 100644 third_party/xla/0007-xla-cpu-Fix-build-errors-from-ACL.patch

diff --git a/third_party/xla/0001-Support-third-party-build-of-boringssl.patch b/third_party/xla/0001-Support-third-party-build-of-boringssl.patch
new file mode 100644
Expand Down Expand Up @@ -550,140 +548,6 @@ index 000000000..93999484f
+ }
+ #endif // defined(PLATFORM_POSIX) && !defined(__APPLE__)
+
diff --git a/third_party/xla/0007-xla-cpu-Fix-build-errors-from-ACL.patch b/third_party/xla/0007-xla-cpu-Fix-build-errors-from-ACL.patch
new file mode 100644
index 000000000..40256f16f
--- /dev/null
+++ b/third_party/xla/0007-xla-cpu-Fix-build-errors-from-ACL.patch
@@ -0,0 +1,128 @@
+From 2b81e35e9e89a13aac3bb08a21b91c76740fd74c Mon Sep 17 00:00:00 2001
+From: Penporn Koanantakool <[email protected]>
+Date: Fri, 24 Jan 2025 13:33:38 -0800
+Subject: [PATCH 7/7] [xla:cpu] Fix build errors from ACL
+
+Reported in:
+https://github.com/jax-ml/jax/issues/26062
+
+PiperOrigin-RevId: 719416696
+---
+ .../exclude_omp_scheduler.patch | 23 +++++++++++++++++++
+ .../compute_library/include_string.patch | 12 ++++++++++
+ .../exclude_omp_scheduler.patch | 23 +++++++++++++++++++
+ .../compute_library/include_string.patch | 12 ++++++++++
+ third_party/tsl/workspace2.bzl | 2 ++
+ 5 files changed, 72 insertions(+)
+ create mode 100644 third_party/compute_library/exclude_omp_scheduler.patch
+ create mode 100644 third_party/compute_library/include_string.patch
+ create mode 100644 third_party/tsl/third_party/compute_library/exclude_omp_scheduler.patch
+ create mode 100644 third_party/tsl/third_party/compute_library/include_string.patch
+
+diff --git a/third_party/compute_library/exclude_omp_scheduler.patch b/third_party/compute_library/exclude_omp_scheduler.patch
+new file mode 100644
+index 0000000000..7ccfebbd36
+--- /dev/null
++++ b/third_party/compute_library/exclude_omp_scheduler.patch
+@@ -0,0 +1,23 @@
++diff --git a/src/BUILD.bazel b/src/BUILD.bazel
++index bf71e534e2..22377f1a32 100644
++--- a/src/BUILD.bazel
+++++ b/src/BUILD.bazel
++@@ -971,7 +971,6 @@ filegroup(
++ "runtime/NEON/functions/NETranspose.cpp",
++ "runtime/NEON/functions/NEUnstack.cpp",
++ "runtime/NEON/functions/NEWinogradConvolutionLayer.cpp",
++- "runtime/OMP/OMPScheduler.cpp",
++ "runtime/OffsetLifetimeManager.cpp",
++ "runtime/OffsetMemoryPool.cpp",
++ "runtime/OperatorTensor.cpp",
++@@ -984,6 +983,10 @@ filegroup(
++ "runtime/Tensor.cpp",
++ "runtime/TensorAllocator.cpp",
++ "runtime/Utils.cpp"] +
+++ select({
+++ "//:openmp_flag": ["runtime/OMP/OMPScheduler.cpp"],
+++ "//conditions:default": [],
+++ }) +
++ glob(["**/*.h",
++ "**/*.hpp",
++ "**/*.inl"]),
+diff --git a/third_party/compute_library/include_string.patch b/third_party/compute_library/include_string.patch
+new file mode 100644
+index 0000000000..709aeea621
+--- /dev/null
++++ b/third_party/compute_library/include_string.patch
+@@ -0,0 +1,12 @@
++diff --git a/arm_compute/core/utils/logging/IPrinter.h b/arm_compute/core/utils/logging/IPrinter.h
++index 42dca58ea1..9c8b1598e8 100644
++--- a/arm_compute/core/utils/logging/IPrinter.h
+++++ b/arm_compute/core/utils/logging/IPrinter.h
++@@ -25,6 +25,7 @@
++ #define ARM_COMPUTE_LOGGING_PRINTER_H
++
++ #include "support/Mutex.h"
+++#include <string>
++
++ namespace arm_compute
++ {
+diff --git a/third_party/tsl/third_party/compute_library/exclude_omp_scheduler.patch b/third_party/tsl/third_party/compute_library/exclude_omp_scheduler.patch
+new file mode 100644
+index 0000000000..7ccfebbd36
+--- /dev/null
++++ b/third_party/tsl/third_party/compute_library/exclude_omp_scheduler.patch
+@@ -0,0 +1,23 @@
++diff --git a/src/BUILD.bazel b/src/BUILD.bazel
++index bf71e534e2..22377f1a32 100644
++--- a/src/BUILD.bazel
+++++ b/src/BUILD.bazel
++@@ -971,7 +971,6 @@ filegroup(
++ "runtime/NEON/functions/NETranspose.cpp",
++ "runtime/NEON/functions/NEUnstack.cpp",
++ "runtime/NEON/functions/NEWinogradConvolutionLayer.cpp",
++- "runtime/OMP/OMPScheduler.cpp",
++ "runtime/OffsetLifetimeManager.cpp",
++ "runtime/OffsetMemoryPool.cpp",
++ "runtime/OperatorTensor.cpp",
++@@ -984,6 +983,10 @@ filegroup(
++ "runtime/Tensor.cpp",
++ "runtime/TensorAllocator.cpp",
++ "runtime/Utils.cpp"] +
+++ select({
+++ "//:openmp_flag": ["runtime/OMP/OMPScheduler.cpp"],
+++ "//conditions:default": [],
+++ }) +
++ glob(["**/*.h",
++ "**/*.hpp",
++ "**/*.inl"]),
+diff --git a/third_party/tsl/third_party/compute_library/include_string.patch b/third_party/tsl/third_party/compute_library/include_string.patch
+new file mode 100644
+index 0000000000..709aeea621
+--- /dev/null
++++ b/third_party/tsl/third_party/compute_library/include_string.patch
+@@ -0,0 +1,12 @@
++diff --git a/arm_compute/core/utils/logging/IPrinter.h b/arm_compute/core/utils/logging/IPrinter.h
++index 42dca58ea1..9c8b1598e8 100644
++--- a/arm_compute/core/utils/logging/IPrinter.h
+++++ b/arm_compute/core/utils/logging/IPrinter.h
++@@ -25,6 +25,7 @@
++ #define ARM_COMPUTE_LOGGING_PRINTER_H
++
++ #include "support/Mutex.h"
+++#include <string>
++
++ namespace arm_compute
++ {
+diff --git a/third_party/tsl/workspace2.bzl b/third_party/tsl/workspace2.bzl
+index 0b1bd5ee69..68d965f560 100644
+--- a/third_party/tsl/workspace2.bzl
++++ b/third_party/tsl/workspace2.bzl
+@@ -179,6 +179,8 @@ def _tf_repositories():
+ patch_file = [
+ "//third_party/compute_library:compute_library.patch",
+ "//third_party/compute_library:acl_thread_local_scheduler.patch",
++ "//third_party/compute_library:exclude_omp_scheduler.patch",
++ "//third_party/compute_library:include_string.patch",
+ ],
+ sha256 = "c4ca329a78da380163b2d86e91ba728349b6f0ee97d66e260a694ef37f0b0d93",
+ strip_prefix = "ComputeLibrary-23.05.1",
diff --git a/third_party/xla/workspace.bzl b/third_party/xla/workspace.bzl
index d08d9bba9..4db026b92 100644
--- a/third_party/xla/workspace.bzl
Expand Down
128 changes: 128 additions & 0 deletions recipe/patches/0007-xla-cpu-Fix-build-errors-from-ACL.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
From 2b81e35e9e89a13aac3bb08a21b91c76740fd74c Mon Sep 17 00:00:00 2001
From: Penporn Koanantakool <[email protected]>
Date: Fri, 24 Jan 2025 13:33:38 -0800
Subject: [PATCH 7/7] [xla:cpu] Fix build errors from ACL

Reported in:
https://github.com/jax-ml/jax/issues/26062

PiperOrigin-RevId: 719416696
---
.../exclude_omp_scheduler.patch | 23 +++++++++++++++++++
.../compute_library/include_string.patch | 12 ++++++++++
.../exclude_omp_scheduler.patch | 23 +++++++++++++++++++
.../compute_library/include_string.patch | 12 ++++++++++
third_party/tsl/workspace2.bzl | 2 ++
5 files changed, 72 insertions(+)
create mode 100644 third_party/compute_library/exclude_omp_scheduler.patch
create mode 100644 third_party/compute_library/include_string.patch
create mode 100644 third_party/tsl/third_party/compute_library/exclude_omp_scheduler.patch
create mode 100644 third_party/tsl/third_party/compute_library/include_string.patch

diff --git a/third_party/compute_library/exclude_omp_scheduler.patch b/third_party/compute_library/exclude_omp_scheduler.patch
new file mode 100644
index 0000000000..7ccfebbd36
--- /dev/null
+++ b/third_party/compute_library/exclude_omp_scheduler.patch
@@ -0,0 +1,23 @@
+diff --git a/src/BUILD.bazel b/src/BUILD.bazel
+index bf71e534e2..22377f1a32 100644
+--- a/src/BUILD.bazel
++++ b/src/BUILD.bazel
+@@ -971,7 +971,6 @@ filegroup(
+ "runtime/NEON/functions/NETranspose.cpp",
+ "runtime/NEON/functions/NEUnstack.cpp",
+ "runtime/NEON/functions/NEWinogradConvolutionLayer.cpp",
+- "runtime/OMP/OMPScheduler.cpp",
+ "runtime/OffsetLifetimeManager.cpp",
+ "runtime/OffsetMemoryPool.cpp",
+ "runtime/OperatorTensor.cpp",
+@@ -984,6 +983,10 @@ filegroup(
+ "runtime/Tensor.cpp",
+ "runtime/TensorAllocator.cpp",
+ "runtime/Utils.cpp"] +
++ select({
++ "//:openmp_flag": ["runtime/OMP/OMPScheduler.cpp"],
++ "//conditions:default": [],
++ }) +
+ glob(["**/*.h",
+ "**/*.hpp",
+ "**/*.inl"]),
diff --git a/third_party/compute_library/include_string.patch b/third_party/compute_library/include_string.patch
new file mode 100644
index 0000000000..709aeea621
--- /dev/null
+++ b/third_party/compute_library/include_string.patch
@@ -0,0 +1,12 @@
+diff --git a/arm_compute/core/utils/logging/IPrinter.h b/arm_compute/core/utils/logging/IPrinter.h
+index 42dca58ea1..9c8b1598e8 100644
+--- a/arm_compute/core/utils/logging/IPrinter.h
++++ b/arm_compute/core/utils/logging/IPrinter.h
+@@ -25,6 +25,7 @@
+ #define ARM_COMPUTE_LOGGING_PRINTER_H
+
+ #include "support/Mutex.h"
++#include <string>
+
+ namespace arm_compute
+ {
diff --git a/third_party/tsl/third_party/compute_library/exclude_omp_scheduler.patch b/third_party/tsl/third_party/compute_library/exclude_omp_scheduler.patch
new file mode 100644
index 0000000000..7ccfebbd36
--- /dev/null
+++ b/third_party/tsl/third_party/compute_library/exclude_omp_scheduler.patch
@@ -0,0 +1,23 @@
+diff --git a/src/BUILD.bazel b/src/BUILD.bazel
+index bf71e534e2..22377f1a32 100644
+--- a/src/BUILD.bazel
++++ b/src/BUILD.bazel
+@@ -971,7 +971,6 @@ filegroup(
+ "runtime/NEON/functions/NETranspose.cpp",
+ "runtime/NEON/functions/NEUnstack.cpp",
+ "runtime/NEON/functions/NEWinogradConvolutionLayer.cpp",
+- "runtime/OMP/OMPScheduler.cpp",
+ "runtime/OffsetLifetimeManager.cpp",
+ "runtime/OffsetMemoryPool.cpp",
+ "runtime/OperatorTensor.cpp",
+@@ -984,6 +983,10 @@ filegroup(
+ "runtime/Tensor.cpp",
+ "runtime/TensorAllocator.cpp",
+ "runtime/Utils.cpp"] +
++ select({
++ "//:openmp_flag": ["runtime/OMP/OMPScheduler.cpp"],
++ "//conditions:default": [],
++ }) +
+ glob(["**/*.h",
+ "**/*.hpp",
+ "**/*.inl"]),
diff --git a/third_party/tsl/third_party/compute_library/include_string.patch b/third_party/tsl/third_party/compute_library/include_string.patch
new file mode 100644
index 0000000000..709aeea621
--- /dev/null
+++ b/third_party/tsl/third_party/compute_library/include_string.patch
@@ -0,0 +1,12 @@
+diff --git a/arm_compute/core/utils/logging/IPrinter.h b/arm_compute/core/utils/logging/IPrinter.h
+index 42dca58ea1..9c8b1598e8 100644
+--- a/arm_compute/core/utils/logging/IPrinter.h
++++ b/arm_compute/core/utils/logging/IPrinter.h
+@@ -25,6 +25,7 @@
+ #define ARM_COMPUTE_LOGGING_PRINTER_H
+
+ #include "support/Mutex.h"
++#include <string>
+
+ namespace arm_compute
+ {
diff --git a/third_party/tsl/workspace2.bzl b/third_party/tsl/workspace2.bzl
index 0b1bd5ee69..68d965f560 100644
--- a/third_party/tsl/workspace2.bzl
+++ b/third_party/tsl/workspace2.bzl
@@ -179,6 +179,8 @@ def _tf_repositories():
patch_file = [
"//third_party/compute_library:compute_library.patch",
"//third_party/compute_library:acl_thread_local_scheduler.patch",
+ "//third_party/compute_library:exclude_omp_scheduler.patch",
+ "//third_party/compute_library:include_string.patch",
],
sha256 = "c4ca329a78da380163b2d86e91ba728349b6f0ee97d66e260a694ef37f0b0d93",
strip_prefix = "ComputeLibrary-23.05.1",

0 comments on commit cc8e996

Please sign in to comment.