-
Notifications
You must be signed in to change notification settings - Fork 608
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Codegen][GPU] Add pass to generalize named convolution ops (#16575)
After tiling the filter dimensions to 1, the simplest way to both handle residual unit dimensions and vectorize the convolution is to generalize it. This adds a pass for generalizing all convolution ops with this intended use.
- Loading branch information
Showing
6 changed files
with
87 additions
and
15 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
22 changes: 22 additions & 0 deletions
22
compiler/src/iree/compiler/Codegen/Common/GPU/test/gpu_generalize_named_convolution_ops.mlir
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,22 @@ | ||
// RUN: iree-opt --split-input-file --pass-pipeline="builtin.module(func.func(iree-codegen-gpu-generalize-named-convolution-ops))" %s | FileCheck %s | ||
|
||
func.func @nhwc_convolution(%arg0: tensor<1x1x32x32xf16>, %arg1: tensor<1x1x32x128xf16>) -> tensor<1x1x32x128xf16> { | ||
%cst = arith.constant 0.000000e+00 : f16 | ||
%0 = tensor.empty() : tensor<1x1x32x128xf16> | ||
%1 = linalg.fill ins(%cst : f16) outs(%0 : tensor<1x1x32x128xf16>) -> tensor<1x1x32x128xf16> | ||
%2 = linalg.conv_2d_nhwc_hwcf { | ||
dilations = dense<1> : vector<2xi64>, | ||
strides = dense<1> : vector<2xi64>, | ||
lowering_config = #iree_codegen.lowering_config<tile_sizes = [[1, 1, 32, 128, 1, 1, 32]]> | ||
} | ||
ins(%arg0, %arg1 : tensor<1x1x32x32xf16>, tensor<1x1x32x128xf16>) | ||
outs(%1 : tensor<1x1x32x128xf16>) -> tensor<1x1x32x128xf16> | ||
return %2 : tensor<1x1x32x128xf16> | ||
} | ||
|
||
// CHECK: #[[$CONFIG:.+]] = #iree_codegen.lowering_config | ||
// CHECK-SAME{LITERAL}: <tile_sizes = [[1, 1, 32, 128, 1, 1, 32]]> | ||
|
||
// CHECK-LABEL: func.func @nhwc_convolution | ||
// CHECK: linalg.generic | ||
// CHECK-SAME: lowering_config = #[[$CONFIG]] |