From 4b44105d00bf8a29545da01b2af3fd03e3b59d60 Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Mon, 24 Jun 2024 17:17:58 +0200 Subject: [PATCH] Add upstream XLA patch --- recipe/meta.yaml | 1 + .../0001-Allow-for-custom-CUDA-build.patch | 4 +- ...pport-third-party-build-of-boringssl.patch | 4 +- .../patches/0003-xla-Fix-abseil-headers.patch | 4 +- recipe/patches/0004-Upstream-xla-Patch.patch | 56 +++++++++++++++++++ 5 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 recipe/patches/0004-Upstream-xla-Patch.patch diff --git a/recipe/meta.yaml b/recipe/meta.yaml index e4372d09..7686ef12 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -18,6 +18,7 @@ source: - patches/0001-Allow-for-custom-CUDA-build.patch - patches/0002-xla-Support-third-party-build-of-boringssl.patch - patches/0003-xla-Fix-abseil-headers.patch + - patches/0004-Upstream-xla-Patch.patch build: number: {{ number }} diff --git a/recipe/patches/0001-Allow-for-custom-CUDA-build.patch b/recipe/patches/0001-Allow-for-custom-CUDA-build.patch index 47df7091..077e2da4 100644 --- a/recipe/patches/0001-Allow-for-custom-CUDA-build.patch +++ b/recipe/patches/0001-Allow-for-custom-CUDA-build.patch @@ -1,7 +1,7 @@ -From fd46cfdb440683ba9a4d3b382d0729c557fb33ab Mon Sep 17 00:00:00 2001 +From 7e9afda0f5ad8a0767f0500eb9933b27dde0414e Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Sun, 8 Oct 2023 19:34:34 +0200 -Subject: [PATCH 1/3] Allow for custom CUDA build +Subject: [PATCH 1/4] Allow for custom CUDA build --- build/build.py | 5 +++++ diff --git a/recipe/patches/0002-xla-Support-third-party-build-of-boringssl.patch b/recipe/patches/0002-xla-Support-third-party-build-of-boringssl.patch index 1f6231be..3cc4cad8 100644 --- a/recipe/patches/0002-xla-Support-third-party-build-of-boringssl.patch +++ b/recipe/patches/0002-xla-Support-third-party-build-of-boringssl.patch @@ -1,7 +1,7 @@ -From c7a275fc1ec8a7a79d4eaa7cad4204b1aedfe37b Mon Sep 17 00:00:00 2001 +From 691dd89b6d14b7c71302a46f54b1564c486ea7ba Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Thu, 14 Dec 2023 17:06:15 +0100 -Subject: [PATCH 2/3] xla: Support third-party build of boringssl +Subject: [PATCH 2/4] xla: Support third-party build of boringssl --- ...pport-third-party-build-of-boringssl.patch | 54 +++++++++++++++++++ diff --git a/recipe/patches/0003-xla-Fix-abseil-headers.patch b/recipe/patches/0003-xla-Fix-abseil-headers.patch index 062b769a..b192592a 100644 --- a/recipe/patches/0003-xla-Fix-abseil-headers.patch +++ b/recipe/patches/0003-xla-Fix-abseil-headers.patch @@ -1,7 +1,7 @@ -From 3c66e397754fd18c003eb047bf48593dd5a4cee5 Mon Sep 17 00:00:00 2001 +From 730f54ecf5bd630de69368e0a1108737289ecb38 Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Sun, 11 Feb 2024 20:18:13 +0100 -Subject: [PATCH 3/3] xla: Fix abseil headers +Subject: [PATCH 3/4] xla: Fix abseil headers --- third_party/xla/0001-Fix-abseil-headers.patch | 47 +++++++++++++++++++ diff --git a/recipe/patches/0004-Upstream-xla-Patch.patch b/recipe/patches/0004-Upstream-xla-Patch.patch new file mode 100644 index 00000000..a5a222a9 --- /dev/null +++ b/recipe/patches/0004-Upstream-xla-Patch.patch @@ -0,0 +1,56 @@ +From 8e28aa73a45c296914c3f4e19c748418303de190 Mon Sep 17 00:00:00 2001 +From: "Uwe L. Korn" +Date: Mon, 24 Jun 2024 16:42:05 +0200 +Subject: [PATCH 4/4] Upstream xla Patch + +--- + ...4cd346594fc7ea2fe75570c9c53a4a444f60.patch | 27 +++++++++++++++++++ + third_party/xla/workspace.bzl | 1 + + 2 files changed, 28 insertions(+) + create mode 100644 third_party/xla/7a614cd346594fc7ea2fe75570c9c53a4a444f60.patch + +diff --git a/third_party/xla/7a614cd346594fc7ea2fe75570c9c53a4a444f60.patch b/third_party/xla/7a614cd346594fc7ea2fe75570c9c53a4a444f60.patch +new file mode 100644 +index 0000000..44abc07 +--- /dev/null ++++ b/third_party/xla/7a614cd346594fc7ea2fe75570c9c53a4a444f60.patch +@@ -0,0 +1,27 @@ ++From 7a614cd346594fc7ea2fe75570c9c53a4a444f60 Mon Sep 17 00:00:00 2001 ++From: David Majnemer ++Date: Mon, 5 Feb 2024 11:12:46 -0800 ++Subject: [PATCH] [XLA:GPU] Fix macOS build ++ ++DelinearizeInBoundsIndex returns a `llvm::SmallVector` but ++`result` has type `llvm::SmallVector` which can cause compilers to ++complain that there is no known conversion available. ++ ++PiperOrigin-RevId: 604374810 ++--- ++ xla/service/gpu/model/indexing_analysis.cc | 2 +- ++ 1 file changed, 1 insertion(+), 1 deletion(-) ++ ++diff --git a/xla/service/gpu/model/indexing_analysis.cc b/xla/service/gpu/model/indexing_analysis.cc ++index 4f9c36faf422d..e859b8c98d02d 100644 ++--- a/xla/service/gpu/model/indexing_analysis.cc +++++ b/xla/service/gpu/model/indexing_analysis.cc ++@@ -687,7 +687,7 @@ std::vector ToTransposeDimensions(const Layout& l) { ++ llvm::SmallVector DelinearizeInBoundsIndex( ++ mlir::AffineExpr linear, absl::Span sizes, ++ absl::Span strides) { ++- llvm::SmallVector result; +++ llvm::SmallVector result; ++ result.reserve(sizes.size()); ++ for (auto [size, stride] : llvm::zip(sizes, strides)) { ++ result.push_back(linear.floorDiv(stride) % size); +diff --git a/third_party/xla/workspace.bzl b/third_party/xla/workspace.bzl +index 9671b9b..76f050d 100644 +--- a/third_party/xla/workspace.bzl ++++ b/third_party/xla/workspace.bzl +@@ -32,6 +32,7 @@ def repo(): + patch_file = [ + "//third_party/xla:0001-Support-third-party-build-of-boringssl.patch", + "//third_party/xla:0001-Fix-abseil-headers.patch", ++ "//third_party/xla:7a614cd346594fc7ea2fe75570c9c53a4a444f60.patch", + ], + ) +