Skip to content

Commit

Permalink
Add upstream XLA patch
Browse files Browse the repository at this point in the history
  • Loading branch information
xhochy committed Jun 24, 2024
1 parent 25da4ff commit 4b44105
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 6 deletions.
1 change: 1 addition & 0 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
4 changes: 2 additions & 2 deletions recipe/patches/0001-Allow-for-custom-CUDA-build.patch
Original file line number Diff line number Diff line change
@@ -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" <[email protected]>
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 +++++
Expand Down
Original file line number Diff line number Diff line change
@@ -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" <[email protected]>
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 +++++++++++++++++++
Expand Down
4 changes: 2 additions & 2 deletions recipe/patches/0003-xla-Fix-abseil-headers.patch
Original file line number Diff line number Diff line change
@@ -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" <[email protected]>
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 +++++++++++++++++++
Expand Down
56 changes: 56 additions & 0 deletions recipe/patches/0004-Upstream-xla-Patch.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
From 8e28aa73a45c296914c3f4e19c748418303de190 Mon Sep 17 00:00:00 2001
From: "Uwe L. Korn" <[email protected]>
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 <[email protected]>
+Date: Mon, 5 Feb 2024 11:12:46 -0800
+Subject: [PATCH] [XLA:GPU] Fix macOS build
+
+DelinearizeInBoundsIndex returns a `llvm::SmallVector<AffineExpr, 4>` but
+`result` has type `llvm::SmallVector<AffineExpr>` 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<int64_t> ToTransposeDimensions(const Layout& l) {
+ llvm::SmallVector<AffineExpr, 4> DelinearizeInBoundsIndex(
+ mlir::AffineExpr linear, absl::Span<const int64_t> sizes,
+ absl::Span<const int64_t> strides) {
+- llvm::SmallVector<AffineExpr> result;
++ llvm::SmallVector<AffineExpr, 4> 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",
],
)

0 comments on commit 4b44105

Please sign in to comment.