-
Notifications
You must be signed in to change notification settings - Fork 508
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
hlo-opt
return error status when given an invalid --passes
a…
…rgument. `hlo-opt` previously logged an error in this case but did not indicate an error in its exit status. Note that the program now exits immediately upon encountering an invalid `--passes` argument; it previously logged an error and continued executing. Fixing this bug also revealed that the `algebraic_simplifier.hlo` test file wasn't doing anything because the `AlgebraicSimplifier` pass wasn't registered in `hlo-opt`. This CL therefore also registers that pass and updates its test accordingly. PiperOrigin-RevId: 726576856
- Loading branch information
1 parent
5d0a237
commit ba741cd
Showing
6 changed files
with
39 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
// RUN: hlo-opt %s --passes=algebraic_simplifier | FileCheck %s | ||
// NOTE: Assertions have been autogenerated by hlo/tools/generate_hlo_test_checks.py | ||
// RUN: hlo-opt %s --passes=algsimp | FileCheck %s | ||
|
||
// CHECK-LABEL: HloModule m, entry_computation_layout={(s32[8]{0}, s32[8]{0}, s32[8]{0})->s32[8]{0}} | ||
|
||
// CHECK-LABEL: ENTRY %test | ||
// CHECK-NEXT: %[[p0:[^ ]+]] = s32[8]{0} parameter(0) | ||
// CHECK-NEXT: %[[p1:[^ ]+]] = s32[8]{0} parameter(1) | ||
// CHECK-NEXT: %[[add:[^ ]+]] = s32[8]{0} add(s32[8]{0} %[[p0]], s32[8]{0} %[[p1]]) | ||
// CHECK-NEXT: %[[p2:[^ ]+]] = s32[8]{0} parameter(2) | ||
// CHECK-NEXT: ROOT %[[multiply:[^ ]+]] = s32[8]{0} multiply(s32[8]{0} %[[add]], s32[8]{0} %[[p2]]) | ||
|
||
HloModule m | ||
ENTRY test { | ||
// CHECK: %[[p0:.*]] = s32[8]{0} parameter(0) | ||
// CHECK-NEXT: %[[p2:.*]] = s32[8]{0} parameter(2) | ||
// CHECK-NEXT: %[[x:.*]] = s32[8]{0} multiply(s32[8]{0} %[[p0]], s32[8]{0} %[[p2]]) | ||
// CHECK-NEXT: %[[p1:.*]] = s32[8]{0} parameter(1) | ||
// CHECK-NEXT: %[[y:.*]] = s32[8]{0} multiply(s32[8]{0} %[[p1]], s32[8]{0} %[[p2]]) | ||
// CHECK-NEXT: ROOT %[[sum:.*]] = s32[8]{0} add(s32[8]{0} %[[x]], s32[8]{0} %[[y]]) | ||
p0 = s32[8] parameter(0) | ||
p1 = s32[8] parameter(1) | ||
p2 = s32[8] parameter(2) | ||
x = s32[8] multiply(p0, p2) | ||
y = s32[8] multiply(p1, p2) | ||
ROOT sum = s32[8] add(x, y) | ||
p0 = s32[8] parameter(0) | ||
p1 = s32[8] parameter(1) | ||
p2 = s32[8] parameter(2) | ||
x = s32[8] multiply(p0, p2) | ||
y = s32[8] multiply(p1, p2) | ||
ROOT sum = s32[8] add(x, y) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// RUN: not hlo-opt %s --passes=nonexistent-optimization-pass 2>&1 \ | ||
// RUN: | FileCheck %s | ||
|
||
// CHECK: INVALID_ARGUMENT: Pass nonexistent-optimization-pass not found. | ||
|
||
HloModule NoOpModule | ||
|
||
ENTRY no_op { | ||
ROOT no_op = () tuple() | ||
} |