-
Notifications
You must be signed in to change notification settings - Fork 654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds UnitAttribute
to root ops for tuner
#19345
Changes from 4 commits
14e9c96
b1e8726
01ff091
8654394
53c15ff
9d91a9d
721a9e7
2ae4c0a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,12 +117,17 @@ SmallVector<Value> getTileSizes(OpBuilder &b, Operation *op, unsigned level); | |
/// Sets the lowering configuration, overwriting existing attribute values. | ||
void setLoweringConfig(Operation *op, Attribute config); | ||
|
||
/// Sets an attribute to identify the rootOp and adds any information needed for | ||
/// the tuner from compiler. Currently, only sets a `UnitAttr`. | ||
void setRootOpInfo(Operation *op); | ||
|
||
/// Convenience function that sets the lowering configuration on the operation | ||
/// and translation info. | ||
inline LogicalResult setOpConfigAndEntryPointFnTranslation( | ||
mlir::FunctionOpInterface entryPointFn, Operation *op, | ||
IREE::Codegen::LoweringConfigAttrInterface config, | ||
IREE::Codegen::TranslationInfoAttr translationInfo) { | ||
setRootOpInfo(op); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be more specific -- If it were me, I'd add a flag in this file and wrap this statement with the flag. |
||
if (config) { | ||
setLoweringConfig(op, config); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// RUN: iree-opt --split-input-file --iree-gpu-test-target=gfx942 --pass-pipeline='builtin.module(iree-llvmgpu-select-lowering-strategy)' %s | FileCheck %s | ||
nithinsubbiah marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
func.func @matmul(%lhs: tensor<4x4xf32>, %rhs: tensor<4x4xf32>) -> tensor<4x4xf32> { | ||
%c0 = arith.constant 0.0 : f32 | ||
%init = tensor.empty() : tensor<4x4xf32> | ||
%fill = linalg.fill ins(%c0 : f32) outs(%init : tensor<4x4xf32>) -> tensor<4x4xf32> | ||
%result = linalg.matmul ins(%lhs, %rhs: tensor<4x4xf32>, tensor<4x4xf32>) | ||
outs(%fill: tensor<4x4xf32>) -> tensor<4x4xf32> | ||
return %result : tensor<4x4xf32> | ||
} | ||
|
||
// CHECK: %2 = linalg.matmul {lowering_config = #config, root_op} ins(%arg0, %arg1 : tensor<4x4xf32>, tensor<4x4xf32>) outs(%1 : tensor<4x4xf32>) -> tensor<4x4xf32> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1638,7 +1638,7 @@ func.func @pad_only() attributes {hal.executable.target = #executable_target_emb | |
// CHECK-SAME: translation_info = #[[TRANSLATION]] | ||
// CHECK: tensor.pad {{.+}} { | ||
// CHECK: tensor.yield | ||
// CHECK-NEXT: } {lowering_config = #[[CONFIG]]} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or alternatively, only match |
||
// CHECK-NEXT: } {lowering_config = #[[CONFIG]], root_op} | ||
|
||
// ----- | ||
|
||
|
@@ -1665,7 +1665,7 @@ func.func @winograd_output_transform() attributes {hal.executable.target = #exec | |
// CHECK: func.func @winograd_output_transform() | ||
// CHECK-SAME: translation_info = #[[TRANSLATION]] | ||
// CHECK: iree_linalg_ext.winograd.output_transform | ||
// CHECK-SAME: {lowering_config = #[[CONFIG]]} | ||
// CHECK-SAME: {lowering_config = #[[CONFIG]], root_op} | ||
|
||
// ----- | ||
|
||
|
@@ -1692,7 +1692,7 @@ func.func @winograd_input_transform() attributes {hal.executable.target = #execu | |
// CHECK: func.func @winograd_input_transform() | ||
// CHECK-SAME: translation_info = #[[TRANSLATION]] | ||
// CHECK: iree_linalg_ext.winograd.input_transform | ||
// CHECK-SAME: {lowering_config = #[[CONFIG]]} | ||
// CHECK-SAME: {lowering_config = #[[CONFIG]], root_op} | ||
|
||
// ----- | ||
|
||
|
@@ -1719,7 +1719,7 @@ func.func @winograd_filter_transform() attributes {hal.executable.target = #exec | |
// CHECK: func.func @winograd_filter_transform() | ||
// CHECK-SAME: translation_info = #[[TRANSLATION]] | ||
// CHECK: iree_linalg_ext.winograd.filter_transform | ||
// CHECK-SAME: {lowering_config = #[[CONFIG]]} | ||
// CHECK-SAME: {lowering_config = #[[CONFIG]], root_op} | ||
|
||
// ----- | ||
|
||
|
@@ -1762,7 +1762,7 @@ func.func @attention() attributes {hal.executable.target = #executable_target_em | |
// CHECK: func.func @attention() | ||
// CHECK-SAME: translation_info = #[[TRANSLATION]] | ||
// CHECK: iree_linalg_ext.attention | ||
// CHECK-SAME: lowering_config = #[[CONFIG]] | ||
// CHECK-SAME: lowering_config = #[[CONFIG]], root_op | ||
|
||
// ----- | ||
|
||
|
@@ -1801,7 +1801,7 @@ func.func @elementwise_output_transposed() attributes {hal.executable.target = # | |
// CHECK: func.func @elementwise_output_transposed() | ||
// CHECK-SAME: translation_info = #[[TRANSLATION]] | ||
// CHECK: linalg.generic | ||
// CHECK-SAME: {lowering_config = #[[CONFIG]]} | ||
// CHECK-SAME: {lowering_config = #[[CONFIG]], root_op} | ||
|
||
// ----- | ||
|
||
|
@@ -1886,7 +1886,7 @@ func.func @custom_op(%arg0 : tensor<384x512xf32>, %arg1 : tensor<512x128xf32>, | |
// CHECK: func @custom_op( | ||
// CHECK-SAME: translation_info = #translation | ||
// CHECK: iree_linalg_ext.custom_op | ||
// CHECK-SAME: attributes {lowering_config = #[[CONFIG0]]} | ||
// CHECK-SAME: attributes {lowering_config = #[[CONFIG0]], root_op} | ||
// CHECK: ^bb | ||
// CHECK: linalg.fill | ||
// CHECK-SAME: {lowering_config = #[[CONFIG1]]} | ||
|
@@ -1957,7 +1957,7 @@ func.func @test_tiling_cpu_default(%arg0: tensor<256x256xi8>, %arg1: tensor<256x | |
// CHECK-DAG: #[[TRANSLATION_INFO]] = #iree_codegen.translation_info<pipeline = CPUDefault> | ||
// CHECK: func @test_tiling_cpu_default( | ||
// CHECK-SAME: translation_info = #[[TRANSLATION_INFO]] | ||
// CHECK: linalg.quantized_matmul {lowering_config = #[[CONFIG0]]} | ||
// CHECK: linalg.quantized_matmul {lowering_config = #[[CONFIG0]], root_op} | ||
|
||
// ----- | ||
|
||
|
@@ -1982,7 +1982,7 @@ func.func @i1_type() attributes {hal.executable.target = #executable_target_emb | |
// CHECK-DAG: #[[CONFIG:.+]] = #iree_codegen.lowering_config<tile_sizes = {{\[}}[8], [8], [0], [0]]> | ||
// CHECK: func @i1_type() | ||
// CHECK: linalg.generic { | ||
// CHECK-SAME: {lowering_config = #[[CONFIG]]} | ||
// CHECK-SAME: {lowering_config = #[[CONFIG]], root_op} | ||
|
||
// ----- | ||
#pipeline_layout = #hal.pipeline.layout<bindings = [ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no
iree_codegen.root_op
attribute. What you're doing is adding a unit attribute to the op. Perhaps rephrase it like "Helpers for setting attributes for tuner".