Skip to content

Commit f07ac8e

Browse files
frgossentensorflower-gardener
authored andcommitted
[XLA:CPU] Include gml-tile-by-one pass in CPU pipeline before scalarization
Remaining tileable ops will be tiled to size 1 and scalarized. PiperOrigin-RevId: 507850026
1 parent b677392 commit f07ac8e

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

tensorflow/compiler/xla/mlir_hlo/gml_st/transforms/cpu_tiling/cpu_tiling_pipeline.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ void addCPUTilingPipeline(OpPassManager& pm,
4343

4444
pm.addNestedPass<FuncOp>(createComposeExtractInsertSlicePass());
4545
pm.addNestedPass<FuncOp>(createVectorizeForCPUPass());
46+
47+
// Tile remaining ops by size one and scalarize what we can.
48+
pm.addNestedPass<FuncOp>(createTileByOnePass());
4649
pm.addNestedPass<FuncOp>(createScalarizationPass());
50+
4751
pm.addNestedPass<FuncOp>(createRewriteVectorContractPass());
4852
}
4953

tensorflow/compiler/xla/mlir_hlo/tests/Dialect/gml_st/cpu_tiling/map_matmul.mlir

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,12 @@ func.func @map_matmul(%arg0: tensor<?x?xf32>,
5454
// CHECK: scf.for
5555
// CHECK: linalg.matmul
5656
// CHECK: scf.yield
57-
// CHECK: linalg.map
58-
// CHECK: linalg.map
57+
// CHECK: scf.for
58+
// CHECK: scf.for
59+
// CHECK: math.absf
60+
// CHECK: scf.for
61+
// CHECK: scf.for
62+
// CHECK: arith.addf
5963
// CHECK: gml_st.set_yield
6064

6165
// CHECK: gml_st.parallel
@@ -65,6 +69,10 @@ func.func @map_matmul(%arg0: tensor<?x?xf32>,
6569
// CHECK: scf.for
6670
// CHECK: linalg.matmul
6771
// CHECK: scf.yield
68-
// CHECK: linalg.map
69-
// CHECK: linalg.map
72+
// CHECK: scf.for
73+
// CHECK: scf.for
74+
// CHECK: math.absf
75+
// CHECK: scf.for
76+
// CHECK: scf.for
77+
// CHECK: arith.addf
7078
// CHECK: gml_st.set_yield

0 commit comments

Comments
 (0)