Skip to content

Commit 409ed6f

Browse files
GleasonKTensorFlow MLIR Team
authored andcommitted
Disable TOSA rescale files and tests while broken
PiperOrigin-RevId: 738816558
1 parent 80d95dc commit 409ed6f

File tree

7 files changed

+53
-61
lines changed

7 files changed

+53
-61
lines changed

stablehlo/BUILD

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,25 +1541,13 @@ glob_lit_tests(
15411541
data = [":test_data"],
15421542
driver = "@llvm-project//mlir:run_lit.sh",
15431543
exclude = [
1544-
# TODO(#268): Fix lit checks with floating-point ops having
1545-
# implementation defined precision.
1546-
"stablehlo/tests/interpret_rsqrt.mlir",
1547-
"stablehlo/tests/interpret_sqrt.mlir",
1548-
"stablehlo/tests/interpret_tanh.mlir",
1549-
1550-
# TODO(b/386761235): Re-enable them.
1551-
"stablehlo/tests/vhlo/stablehlo_legalize_to_vhlo.0_18_0.mlir",
1552-
"stablehlo/tests/vhlo/stablehlo_legalize_to_vhlo.0_19_0.mlir",
1553-
"stablehlo/tests/vhlo/stablehlo_legalize_to_vhlo.0_20_0.mlir",
1554-
"stablehlo/tests/vhlo/stablehlo_legalize_to_vhlo.1_0_0.mlir",
1555-
"stablehlo/tests/vhlo/stablehlo_legalize_to_vhlo.1_1_0.mlir",
1556-
"stablehlo/tests/vhlo/stablehlo_legalize_to_vhlo.1_2_0.mlir",
1557-
"stablehlo/tests/vhlo/stablehlo_legalize_to_vhlo.1_3_0.mlir",
1558-
"stablehlo/tests/vhlo/stablehlo_legalize_to_vhlo.1_4_0.mlir",
1559-
"stablehlo/tests/vhlo/stablehlo_legalize_to_vhlo.1_5_0.mlir",
1560-
"stablehlo/tests/vhlo/stablehlo_legalize_to_vhlo.1_6_0.mlir",
1561-
"stablehlo/tests/vhlo/stablehlo_legalize_to_vhlo.1_7_0.mlir",
1562-
"stablehlo/tests/vhlo/stablehlo_legalize_to_vhlo.1_8_0.mlir",
1544+
# TODO: remove the following excludes once #2751 is fixed.
1545+
"stablehlo/conversions/tosa/tests/legalize_quant_ops_to_tosa_rescale.mlir",
1546+
"stablehlo/conversions/tosa/tests/legalize_tosa_rescale_to_stablehlo.mlir",
1547+
"stablehlo/conversions/tosa/tests/rescale_interpreter.mlir",
1548+
"stablehlo/conversions/tosa/tests/binary.mlir",
1549+
"stablehlo/conversions/tosa/tests/nullary.mlir",
1550+
"stablehlo/conversions/tosa/tests/unary.mlir",
15631551
],
15641552
test_file_exts = ["mlir"],
15651553
)
@@ -1650,8 +1638,9 @@ cc_library(
16501638
srcs = [
16511639
"stablehlo/conversions/tosa/transforms/StablehloLegalizeToTosa.cpp",
16521640
"stablehlo/conversions/tosa/transforms/StablehloPrepareForTosa.cpp",
1653-
"stablehlo/conversions/tosa/transforms/StablehloQuantLegalizeToTosaRescale.cpp",
1654-
"stablehlo/conversions/tosa/transforms/TosaRescaleLegalizeToStablehlo.cpp",
1641+
# TODO: un-comment the following once #2751 is fixed
1642+
# "stablehlo/conversions/tosa/transforms/StablehloQuantLegalizeToTosaRescale.cpp",
1643+
# "stablehlo/conversions/tosa/transforms/TosaRescaleLegalizeToStablehlo.cpp",
16551644
],
16561645
hdrs = [
16571646
"stablehlo/conversions/tosa/transforms/Passes.h",

stablehlo/BUILD.bazel

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,8 +1577,9 @@ cc_library(
15771577
srcs = [
15781578
"stablehlo/conversions/tosa/transforms/StablehloLegalizeToTosa.cpp",
15791579
"stablehlo/conversions/tosa/transforms/StablehloPrepareForTosa.cpp",
1580-
"stablehlo/conversions/tosa/transforms/StablehloQuantLegalizeToTosaRescale.cpp",
1581-
"stablehlo/conversions/tosa/transforms/TosaRescaleLegalizeToStablehlo.cpp",
1580+
# TODO: un-comment the following once #2751 is fixed
1581+
# "stablehlo/conversions/tosa/transforms/StablehloQuantLegalizeToTosaRescale.cpp",
1582+
# "stablehlo/conversions/tosa/transforms/TosaRescaleLegalizeToStablehlo.cpp",
15821583
],
15831584
hdrs = [
15841585
"stablehlo/conversions/tosa/transforms/Passes.h",

stablehlo/docs/generated/stablehlo_tosa_passes.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,3 @@ _Prepare StableHLO for legalization to TOSA_
1010

1111
This pass adds rewriters to make StableHLO ops more compatible with TOSA ops.
1212
Currently simplifies stablehlo.dot_general into stablehlo.dot for easier lowering.
13-
14-
### `-stablehlo-quant-legalize-to-tosa-rescale`
15-
16-
_Legalize StableHLO Quantized operations to TOSA rescale operations_
17-
18-
This pass rewrites StableHLO quantized operations to integer operations
19-
by inserting TOSA rescale operations at the inputs and outputs of the
20-
integer operations.
21-
22-
### `-tosa-rescale-legalize-to-stablehlo`
23-
24-
_Legalize TOSA rescales to StableHlo primitive math operations_
25-
26-
This pass rewrites TOSA rescale operations to StableHLO primitive math operations.

stablehlo/stablehlo/conversions/tosa/tests/BUILD.bazel

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,18 @@ RUNFILES_DIR = LITE_CFG_PY.parents[4].absolute().as_posix()''',
5555
tags = ["stablehlo_tosa_tests"],
5656
deps = ["@rules_python//python/runfiles"],
5757
)
58-
for src in glob(["**/*.mlir"])
58+
# TODO: remove the following excludes once #2751 is fixed.
59+
for src in glob(
60+
["**/*.mlir"],
61+
exclude = [
62+
"legalize_quant_ops_to_tosa_rescale.mlir",
63+
"legalize_tosa_rescale_to_stablehlo.mlir",
64+
"rescale_interpreter.mlir",
65+
"binary.mlir",
66+
"nullary.mlir",
67+
"unary.mlir",
68+
],
69+
)
5970
]
6071

6172
test_suite(

stablehlo/stablehlo/conversions/tosa/tests/lit.cfg.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
2626
config.suffixes = ['.mlir']
2727
config.test_source_root = os.path.dirname(__file__)
28+
# TODO: remove the following once #2751 is fixed.
29+
config.excludes = ['legalize_quant_ops_to_tosa_rescale.mlir', 'legalize_tosa_rescale_to_stablehlo.mlir', 'rescale_interpreter.mlir', 'binary.mlir', 'nullary.mlir', 'unary.mlir']
2830

2931
# Disallow reusing variables across CHECK-LABEL matches.
3032
# A variable can eschew this (be made "global") by prefixing its name with $.

stablehlo/stablehlo/conversions/tosa/transforms/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ add_mlir_pdll_library(StablehloTOSAPDLLPatternsIncGen
2525
add_mlir_library(StablehloTOSATransforms
2626
StablehloLegalizeToTosa.cpp
2727
StablehloPrepareForTosa.cpp
28-
StablehloQuantLegalizeToTosaRescale.cpp
29-
TosaRescaleLegalizeToStablehlo.cpp
28+
# TODO: un-comment the following once #2751 is fixed.
29+
# StablehloQuantLegalizeToTosaRescale.cpp
30+
# TosaRescaleLegalizeToStablehlo.cpp
3031

32+
PARTIAL_SOURCES_INTENDED
3133
DEPENDS
3234
StablehloTOSATransformsPassIncGen
3335
StablehloTOSAPDLLPatternsIncGen

stablehlo/stablehlo/conversions/tosa/transforms/Passes.td

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,25 @@ def StablehloPrepareForTosaPass : Pass<"stablehlo-prepare-for-tosa", "mlir::func
3333
let dependentDialects = ["::mlir::tosa::TosaDialect"];
3434
}
3535

36-
def StablehloQuantLegalizeToTosaRescalePass : Pass<"stablehlo-quant-legalize-to-tosa-rescale", "mlir::func::FuncOp"> {
37-
let summary = "Legalize StableHLO Quantized operations to TOSA rescale operations";
38-
let description = [{
39-
This pass rewrites StableHLO quantized operations to integer operations
40-
by inserting TOSA rescale operations at the inputs and outputs of the
41-
integer operations.
42-
}];
43-
let dependentDialects = [
44-
"::mlir::tosa::TosaDialect",
45-
];
46-
}
47-
48-
def TosaRescaleLegalizeToStablehloPass : Pass<"tosa-rescale-legalize-to-stablehlo", "mlir::func::FuncOp"> {
49-
let summary = "Legalize TOSA rescales to StableHlo primitive math operations";
50-
let description = [{
51-
This pass rewrites TOSA rescale operations to StableHLO primitive math operations.
52-
}];
53-
let dependentDialects = [
54-
"::mlir::stablehlo::StablehloDialect"
55-
];
56-
}
36+
// TODO: un-comment the following once #2751 is fixed.
37+
// def StablehloQuantLegalizeToTosaRescalePass : Pass<"stablehlo-quant-legalize-to-tosa-rescale", "mlir::func::FuncOp"> {
38+
// let summary = "Legalize StableHLO Quantized operations to TOSA rescale operations";
39+
// let description = [{
40+
// This pass rewrites StableHLO quantized operations to integer operations
41+
// by inserting TOSA rescale operations at the inputs and outputs of the
42+
// integer operations.
43+
// }];
44+
// let dependentDialects = [
45+
// "::mlir::tosa::TosaDialect",
46+
// ];
47+
// }
48+
//
49+
// def TosaRescaleLegalizeToStablehloPass : Pass<"tosa-rescale-legalize-to-stablehlo", "mlir::func::FuncOp"> {
50+
// let summary = "Legalize TOSA rescales to StableHlo primitive math operations";
51+
// let description = [{
52+
// This pass rewrites TOSA rescale operations to StableHLO primitive math operations.
53+
// }];
54+
// let dependentDialects = [
55+
// "::mlir::stablehlo::StablehloDialect"
56+
// ];
57+
// }

0 commit comments

Comments
 (0)