[go: nahoru, domu]

Skip to content

Commit

Permalink
Integrate LLVM at llvm/llvm-project@93ffe1792fd9
Browse files Browse the repository at this point in the history
Updates LLVM usage to match
[93ffe1792fd9](llvm/llvm-project@93ffe1792fd9)

PiperOrigin-RevId: 644334496
  • Loading branch information
tensorflower-gardener committed Jun 18, 2024
1 parent aa29a22 commit 19b82d6
Show file tree
Hide file tree
Showing 10 changed files with 509 additions and 131 deletions.
3 changes: 2 additions & 1 deletion tensorflow/core/transforms/functional_to_region/pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ struct FunctionalToRegionPass
// Use top-down traversal for more efficient conversion. Disable region
// simplification as all regions are single block.
config.useTopDownTraversal = true;
config.enableRegionSimplification = false;
config.enableRegionSimplification =
mlir::GreedySimplifyRegionLevel::Disabled;
// If there are deeply nested conditionals, instantiating them too deep will
// cause the verifiers, which are implemented recursively, to stack
// overflow. Set a relatively low iteration limit.
Expand Down
3 changes: 2 additions & 1 deletion tensorflow/core/transforms/region_to_functional/pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ struct RegionToFunctionalPass
// Use top-down traversal for more efficient conversion. Disable region
// simplification as all regions are single block.
config.useTopDownTraversal = true;
config.enableRegionSimplification = false;
config.enableRegionSimplification =
mlir::GreedySimplifyRegionLevel::Disabled;
// Iterate until all regions have been outlined. This is guaranteed to
// terminate because the IR can only hold a finite depth of regions.
config.maxIterations = GreedyRewriteConfig::kNoLimit;
Expand Down
516 changes: 395 additions & 121 deletions third_party/llvm/generated.patch

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions third_party/llvm/workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ load("//third_party:repo.bzl", "tf_http_archive")

def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "e83adfe59632d2e2f8ff26db33087ba7fb754485"
LLVM_SHA256 = "5730ac18a80109d6189a34e212f61f2b0832b91b8cc175c3ebd0aa063db85f59"
LLVM_COMMIT = "93ffe1792fd9a985b96fee1105b399b5196a15bc"
LLVM_SHA256 = "f92f48acaf9a6543097dc50acb761584ca3da3f2a137d7ad32aa92650b9ea932"

tf_http_archive(
name = name,
Expand Down
43 changes: 40 additions & 3 deletions third_party/stablehlo/temporary.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2442,7 +2442,7 @@ diff --ruN a/stablehlo/stablehlo/experimental/transforms/ChloRecomposeOps.cpp b/
+ // Do a single traversal to recompose CustomCallOp to CHLO ops.
+ GreedyRewriteConfig config;
+ config.useTopDownTraversal = true;
+ config.enableRegionSimplification = true;
+ config.enableRegionSimplification = GreedySimplifyRegionLevel::Aggressive;
+ config.maxIterations = 1;
+ config.maxNumRewrites = GreedyRewriteConfig::kNoLimit;
+ config.strictMode = GreedyRewriteStrictness::ExistingOps;
Expand Down Expand Up @@ -2754,7 +2754,7 @@ diff --ruN a/stablehlo/stablehlo/experimental/transforms/StablehloCanonicalizeDy
+ void runOnOperation() override {
+ GreedyRewriteConfig config;
+ config.useTopDownTraversal = true;
+ config.enableRegionSimplification = true;
+ config.enableRegionSimplification = GreedySimplifyRegionLevel::Aggressive;
+ config.maxIterations = 2;
+ config.maxNumRewrites = GreedyRewriteConfig::kNoLimit;
+ config.strictMode = GreedyRewriteStrictness::AnyOp;
Expand Down Expand Up @@ -2930,7 +2930,7 @@ diff --ruN a/stablehlo/stablehlo/experimental/transforms/StablehloRefineShapes.c
+ // upstream, and that might be the reason.
+ GreedyRewriteConfig config;
+ config.useTopDownTraversal = true;
+ config.enableRegionSimplification = true;
+ config.enableRegionSimplification = GreedySimplifyRegionLevel::Aggressive;
+ config.maxIterations = 3;
+ config.maxNumRewrites = GreedyRewriteConfig::kNoLimit;
+ config.strictMode = GreedyRewriteStrictness::AnyOp;
Expand All @@ -2955,4 +2955,41 @@ diff --ruN a/stablehlo/stablehlo/experimental/transforms/StablehloRefineShapes.c
+} // namespace experimental
+} // namespace stablehlo
+} // namespace mlir
diff --ruN a/stablehlo/stablehlo/tests/TestUtils.cpp b/stablehlo/stablehlo/tests/TestUtils.cpp
--- stablehlo/stablehlo/tests/TestUtils.cpp
+++ stablehlo/stablehlo/tests/TestUtils.cpp
@@ -176,7 +176,8 @@
GreedyRewriteConfig config;
config.maxIterations = 1;
config.useTopDownTraversal = true;
- config.enableRegionSimplification = false;
+ config.enableRegionSimplification =
+ mlir::GreedySimplifyRegionLevel::Disabled;
(void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns));
}

diff --ruN a/stablehlo/stablehlo/transforms/StablehloCanonicalizeDynamism.cpp b/stablehlo/stablehlo/transforms/StablehloCanonicalizeDynamism.cpp
--- stablehlo/stablehlo/transforms/StablehloCanonicalizeDynamism.cpp
+++ stablehlo/stablehlo/transforms/StablehloCanonicalizeDynamism.cpp
@@ -300,7 +300,7 @@

LogicalResult initialize(MLIRContext* context) override {
config.useTopDownTraversal = true;
- config.enableRegionSimplification = true;
+ config.enableRegionSimplification = GreedySimplifyRegionLevel::Aggressive;
config.maxIterations = 2;
config.maxNumRewrites = GreedyRewriteConfig::kNoLimit;
config.strictMode = GreedyRewriteStrictness::AnyOp;
diff --ruN a/stablehlo/stablehlo/transforms/StablehloRefineShapes.cpp b/stablehlo/stablehlo/transforms/StablehloRefineShapes.cpp
--- stablehlo/stablehlo/transforms/StablehloRefineShapes.cpp
+++ stablehlo/stablehlo/transforms/StablehloRefineShapes.cpp
@@ -728,7 +728,7 @@
// There have been recent refactors to applyPatternsAndFoldGreedily
// upstream, and that might be the reason.
config.useTopDownTraversal = true;
- config.enableRegionSimplification = true;
+ config.enableRegionSimplification = GreedySimplifyRegionLevel::Aggressive;
config.maxIterations = 2;
config.maxNumRewrites = GreedyRewriteConfig::kNoLimit;
config.strictMode = GreedyRewriteStrictness::AnyOp;

13 changes: 13 additions & 0 deletions third_party/triton/llvm_integration/cl643947742.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
==== triton/test/Triton/reproducer.mlir#3 - triton/test/Triton/reproducer.mlir ====
# action=edit type=text
--- triton/test/Triton/reproducer.mlir 2024-05-14 06:33:36.000000000 -0700
+++ triton/test/Triton/reproducer.mlir 2024-06-17 08:37:24.000000000 -0700
@@ -9,7 +9,7 @@
{-#
external_resources: {
mlir_reproducer: {
- pipeline: "builtin.module(any(convert-scf-to-cf,convert-index-to-llvm{index-bitwidth=0},convert-triton-gpu-to-llvm{compute-capability=90},convert-nv-gpu-to-llvm,convert-arith-to-llvm{index-bitwidth=0},canonicalize{ max-iterations=10 max-num-rewrites=-1 region-simplify=true test-convergence=false top-down=true},cse,symbol-dce,enable-line-info))",
+ pipeline: "builtin.module(any(convert-scf-to-cf,convert-index-to-llvm{index-bitwidth=0},convert-triton-gpu-to-llvm{compute-capability=90},convert-nv-gpu-to-llvm,convert-arith-to-llvm{index-bitwidth=0},canonicalize{ max-iterations=10 max-num-rewrites=-1 region-simplify=aggressive test-convergence=false top-down=true},cse,symbol-dce,enable-line-info))",
disable_threading: false,
verify_each: false
}
1 change: 1 addition & 0 deletions third_party/triton/llvm_integration/series.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ These should be upstreamed to openai/triton as part of the next triton integrati

llvm_patch_list = [
"//third_party/triton/llvm_integration:cl642434908.patch",
"//third_party/triton/llvm_integration:cl643947742.patch",
]
43 changes: 40 additions & 3 deletions third_party/xla/third_party/stablehlo/temporary.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2442,7 +2442,7 @@ diff --ruN a/stablehlo/stablehlo/experimental/transforms/ChloRecomposeOps.cpp b/
+ // Do a single traversal to recompose CustomCallOp to CHLO ops.
+ GreedyRewriteConfig config;
+ config.useTopDownTraversal = true;
+ config.enableRegionSimplification = true;
+ config.enableRegionSimplification = GreedySimplifyRegionLevel::Aggressive;
+ config.maxIterations = 1;
+ config.maxNumRewrites = GreedyRewriteConfig::kNoLimit;
+ config.strictMode = GreedyRewriteStrictness::ExistingOps;
Expand Down Expand Up @@ -2754,7 +2754,7 @@ diff --ruN a/stablehlo/stablehlo/experimental/transforms/StablehloCanonicalizeDy
+ void runOnOperation() override {
+ GreedyRewriteConfig config;
+ config.useTopDownTraversal = true;
+ config.enableRegionSimplification = true;
+ config.enableRegionSimplification = GreedySimplifyRegionLevel::Aggressive;
+ config.maxIterations = 2;
+ config.maxNumRewrites = GreedyRewriteConfig::kNoLimit;
+ config.strictMode = GreedyRewriteStrictness::AnyOp;
Expand Down Expand Up @@ -2930,7 +2930,7 @@ diff --ruN a/stablehlo/stablehlo/experimental/transforms/StablehloRefineShapes.c
+ // upstream, and that might be the reason.
+ GreedyRewriteConfig config;
+ config.useTopDownTraversal = true;
+ config.enableRegionSimplification = true;
+ config.enableRegionSimplification = GreedySimplifyRegionLevel::Aggressive;
+ config.maxIterations = 3;
+ config.maxNumRewrites = GreedyRewriteConfig::kNoLimit;
+ config.strictMode = GreedyRewriteStrictness::AnyOp;
Expand All @@ -2955,4 +2955,41 @@ diff --ruN a/stablehlo/stablehlo/experimental/transforms/StablehloRefineShapes.c
+} // namespace experimental
+} // namespace stablehlo
+} // namespace mlir
diff --ruN a/stablehlo/stablehlo/tests/TestUtils.cpp b/stablehlo/stablehlo/tests/TestUtils.cpp
--- stablehlo/stablehlo/tests/TestUtils.cpp
+++ stablehlo/stablehlo/tests/TestUtils.cpp
@@ -176,7 +176,8 @@
GreedyRewriteConfig config;
config.maxIterations = 1;
config.useTopDownTraversal = true;
- config.enableRegionSimplification = false;
+ config.enableRegionSimplification =
+ mlir::GreedySimplifyRegionLevel::Disabled;
(void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns));
}

diff --ruN a/stablehlo/stablehlo/transforms/StablehloCanonicalizeDynamism.cpp b/stablehlo/stablehlo/transforms/StablehloCanonicalizeDynamism.cpp
--- stablehlo/stablehlo/transforms/StablehloCanonicalizeDynamism.cpp
+++ stablehlo/stablehlo/transforms/StablehloCanonicalizeDynamism.cpp
@@ -300,7 +300,7 @@

LogicalResult initialize(MLIRContext* context) override {
config.useTopDownTraversal = true;
- config.enableRegionSimplification = true;
+ config.enableRegionSimplification = GreedySimplifyRegionLevel::Aggressive;
config.maxIterations = 2;
config.maxNumRewrites = GreedyRewriteConfig::kNoLimit;
config.strictMode = GreedyRewriteStrictness::AnyOp;
diff --ruN a/stablehlo/stablehlo/transforms/StablehloRefineShapes.cpp b/stablehlo/stablehlo/transforms/StablehloRefineShapes.cpp
--- stablehlo/stablehlo/transforms/StablehloRefineShapes.cpp
+++ stablehlo/stablehlo/transforms/StablehloRefineShapes.cpp
@@ -728,7 +728,7 @@
// There have been recent refactors to applyPatternsAndFoldGreedily
// upstream, and that might be the reason.
config.useTopDownTraversal = true;
- config.enableRegionSimplification = true;
+ config.enableRegionSimplification = GreedySimplifyRegionLevel::Aggressive;
config.maxIterations = 2;
config.maxNumRewrites = GreedyRewriteConfig::kNoLimit;
config.strictMode = GreedyRewriteStrictness::AnyOp;

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
==== triton/test/Triton/reproducer.mlir#3 - triton/test/Triton/reproducer.mlir ====
# action=edit type=text
--- triton/test/Triton/reproducer.mlir 2024-05-14 06:33:36.000000000 -0700
+++ triton/test/Triton/reproducer.mlir 2024-06-17 08:37:24.000000000 -0700
@@ -9,7 +9,7 @@
{-#
external_resources: {
mlir_reproducer: {
- pipeline: "builtin.module(any(convert-scf-to-cf,convert-index-to-llvm{index-bitwidth=0},convert-triton-gpu-to-llvm{compute-capability=90},convert-nv-gpu-to-llvm,convert-arith-to-llvm{index-bitwidth=0},canonicalize{ max-iterations=10 max-num-rewrites=-1 region-simplify=true test-convergence=false top-down=true},cse,symbol-dce,enable-line-info))",
+ pipeline: "builtin.module(any(convert-scf-to-cf,convert-index-to-llvm{index-bitwidth=0},convert-triton-gpu-to-llvm{compute-capability=90},convert-nv-gpu-to-llvm,convert-arith-to-llvm{index-bitwidth=0},canonicalize{ max-iterations=10 max-num-rewrites=-1 region-simplify=aggressive test-convergence=false top-down=true},cse,symbol-dce,enable-line-info))",
disable_threading: false,
verify_each: false
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ These should be upstreamed to openai/triton as part of the next triton integrati

llvm_patch_list = [
"//third_party/triton/llvm_integration:cl642434908.patch",
"//third_party/triton/llvm_integration:cl643947742.patch",
]

0 comments on commit 19b82d6

Please sign in to comment.