forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 4
[FXML-5890] Order tiling worklist #532
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
Merged
Merged
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
1c64247
WIP: worklist traversal
cferry-AMD 7dcfd68
Merge remote-tracking branch 'origin/feature/fused-ops' into corentin…
cferry-AMD d20bb09
Add a test
cferry-AMD 998575f
Make insert_worklist function generic
cferry-AMD 5bf0b8b
Change wording: tiling -> fusion
cferry-AMD a6fd34e
Remove remark, replace by attribute -> more compact test
cferry-AMD 9af785f
Use llvm::dbgs() + FileCheck
cferry-AMD 5402418
Apply suggestions from code review
cferry-AMD 9a5f9c6
Merge remote-tracking branch 'origin/feature/fused-ops' into corentin…
cferry-AMD f1b7413
Remove reverse worklist test
cferry-AMD 37a8962
Apply suggestions from code review
cferry-AMD efe04e4
Add op with tiling_priority
cferry-AMD 01b0345
Add test swapping powf operands
cferry-AMD fd7c6b9
Description did not save
cferry-AMD e064275
revise test comments
cferry-AMD 0ccb35d
Typo in test
cferry-AMD File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,83 @@ | ||
| // RUN: mlir-opt %s -transform-interpreter -split-input-file -debug-only=tile-using-interface 2>&1 | FileCheck %s | ||
|
|
||
| func.func @tile_order_ceil_then_negf(%arg: tensor<256xf32>) -> tensor<256xf32> { | ||
| // Ops are tiled by lower priority: linalg.powf, linalg.ceil (1st operand of powf, priority = 0), | ||
| // linalg.negf (2nd oprand of powf, priority = 1), linalg.ceil (operand of negf, priority = 0) | ||
| %empty = tensor.empty() : tensor<256xf32> | ||
| %0 = linalg.ceil {tiling_priority = 0 : i64} ins(%arg: tensor<256xf32>) outs(%empty: tensor<256xf32>) -> tensor<256xf32> | ||
| %empty1 = tensor.empty() : tensor<256xf32> | ||
| %1 = linalg.negf {tiling_priority = 1 : i64} ins(%0 : tensor<256xf32>) outs(%empty1: tensor<256xf32>) -> tensor<256xf32> | ||
| %empty2 = tensor.empty() : tensor<256xf32> | ||
| %2 = linalg.powf {tile} ins(%0, %1: tensor<256xf32>, tensor<256xf32>) outs(%empty2: tensor<256xf32>) -> tensor<256xf32> | ||
|
|
||
| // The order of these checks is the order in which the ops are actually tiled. | ||
| // CHECK: worklist: producer is %{{.*}} = linalg.ceil | ||
| // CHECK: worklist: producer is %{{.*}} = linalg.negf | ||
| // CHECK: worklist: producer is %{{.*}} = linalg.ceil | ||
|
|
||
| return %2 : tensor<256xf32> | ||
| } | ||
|
|
||
| module attributes {transform.with_named_sequence} { | ||
| transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) { | ||
| %0 = transform.structured.match ops{["linalg.powf"]} attributes {"tile"} in %arg1 : (!transform.any_op) -> !transform.any_op | ||
| %1, %loops = transform.test.tile_fuse_ordered %0 [32] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) | ||
| transform.yield | ||
| } | ||
| } | ||
|
|
||
| // ----- | ||
|
|
||
| func.func @tile_negf_then_ceil(%arg: tensor<256xf32>) -> tensor<256xf32> { | ||
| // Ops are tiled by lower priority: linalg.powf, linalg.negf (2nd operand of powf, priority = 0), | ||
| // linalg.ceil (1st oprand of powf, priority = 1), linalg.ceil (operand of negf, priority = 1) | ||
| %empty = tensor.empty() : tensor<256xf32> | ||
| %0 = linalg.ceil {tiling_priority = 1 : i64} ins(%arg: tensor<256xf32>) outs(%empty: tensor<256xf32>) -> tensor<256xf32> | ||
| %empty1 = tensor.empty() : tensor<256xf32> | ||
| %1 = linalg.negf {tiling_priority = 0 : i64} ins(%0 : tensor<256xf32>) outs(%empty1: tensor<256xf32>) -> tensor<256xf32> | ||
| %empty2 = tensor.empty() : tensor<256xf32> | ||
| %2 = linalg.powf {tile} ins(%0, %1: tensor<256xf32>, tensor<256xf32>) outs(%empty2: tensor<256xf32>) -> tensor<256xf32> | ||
|
|
||
| // CHECK: worklist: producer is %{{.*}} = linalg.negf | ||
| // CHECK: worklist: producer is %{{.*}} = linalg.ceil | ||
| // CHECK: worklist: producer is %{{.*}} = linalg.ceil | ||
|
|
||
| return %2 : tensor<256xf32> | ||
| } | ||
|
|
||
| module attributes {transform.with_named_sequence} { | ||
| transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) { | ||
| %0 = transform.structured.match ops{["linalg.powf"]} attributes {"tile"} in %arg1 : (!transform.any_op) -> !transform.any_op | ||
| %1, %loops = transform.test.tile_fuse_ordered %0 [32] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) | ||
| transform.yield | ||
| } | ||
| } | ||
|
|
||
| // ----- | ||
|
|
||
| func.func @tile_negf_then_ceil_swap_in_powf(%arg: tensor<256xf32>) -> tensor<256xf32> { | ||
| // This gives the same tiling order as above regardless of the operand order in the powf | ||
| // linalg.powf, linalg.negf (1st operand of powf, priority = 0), | ||
| // linalg.ceil (2nd oprand of powf, priority = 1), linalg.ceil (operand of negf, priority = 1) | ||
| %empty = tensor.empty() : tensor<256xf32> | ||
| %0 = linalg.ceil {tiling_priority = 1 : i64} ins(%arg: tensor<256xf32>) outs(%empty: tensor<256xf32>) -> tensor<256xf32> | ||
| %empty1 = tensor.empty() : tensor<256xf32> | ||
| %1 = linalg.negf {tiling_priority = 0 : i64} ins(%0 : tensor<256xf32>) outs(%empty1: tensor<256xf32>) -> tensor<256xf32> | ||
| %empty2 = tensor.empty() : tensor<256xf32> | ||
| %2 = linalg.powf {tile} ins(%1, %0: tensor<256xf32>, tensor<256xf32>) outs(%empty2: tensor<256xf32>) -> tensor<256xf32> | ||
|
|
||
| // CHECK: worklist: producer is %{{.*}} = linalg.negf | ||
| // CHECK: worklist: producer is %{{.*}} = linalg.ceil | ||
| // CHECK: worklist: producer is %{{.*}} = linalg.ceil | ||
|
|
||
| return %2 : tensor<256xf32> | ||
| } | ||
|
|
||
| module attributes {transform.with_named_sequence} { | ||
| transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) { | ||
| %0 = transform.structured.match ops{["linalg.powf"]} attributes {"tile"} in %arg1 : (!transform.any_op) -> !transform.any_op | ||
| %1, %loops = transform.test.tile_fuse_ordered %0 [32] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) | ||
| transform.yield | ||
| } | ||
| } | ||
|
|
||
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.