-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AMD] Attach variant to the scheduling hint op (#5808)
This PR refactors the implementation of instruction scheduling infrastructure. A particular "sched" variant becomes a part of the instruction and gets added during the insertion pass. The instruction carries this meta-information over many passes allowing to re-use the same mechanism in some other places.
- Loading branch information
1 parent
87187d1
commit 94643b2
Showing
13 changed files
with
105 additions
and
79 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
11 changes: 11 additions & 0 deletions
11
third_party/amd/include/Dialect/TritonAMDGPU/Utility/CommonUtils.h
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,11 @@ | ||
#ifndef TRITON_THIRD_PARTY_AMD_INCLUDE_DIALECT_TRITONAMDGPU_UTILITY_COMMONUTILS_H_ | ||
#define TRITON_THIRD_PARTY_AMD_INCLUDE_DIALECT_TRITONAMDGPU_UTILITY_COMMONUTILS_H_ | ||
|
||
#include "mlir/Dialect/SCF/IR/SCF.h" | ||
#include "triton/Dialect/Triton/IR/Dialect.h" | ||
|
||
namespace mlir::triton::AMD { | ||
SmallVector<scf::ForOp> getLeafForOps(triton::FuncOp funcOp); | ||
} // namespace mlir::triton::AMD | ||
|
||
#endif // TRITON_THIRD_PARTY_AMD_INCLUDE_DIALECT_TRITONAMDGPU_UTILITY_COMMONUTILS_H_ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
add_subdirectory(IR) | ||
add_subdirectory(Utility) |
8 changes: 8 additions & 0 deletions
8
third_party/amd/lib/Dialect/TritonAMDGPU/Utility/CMakeLists.txt
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,8 @@ | ||
add_triton_library(TritonAMDUtils | ||
CommonUtils.cpp | ||
|
||
LINK_LIBS PUBLIC | ||
MLIRLLVMDialect | ||
TritonIR | ||
TritonGPUIR | ||
) |
17 changes: 17 additions & 0 deletions
17
third_party/amd/lib/Dialect/TritonAMDGPU/Utility/CommonUtils.cpp
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,17 @@ | ||
#include "third_party/amd/include/Dialect/TritonAMDGPU/Utility/CommonUtils.h" | ||
|
||
namespace mlir::triton::AMD { | ||
SmallVector<scf::ForOp> getLeafForOps(triton::FuncOp funcOp) { | ||
SmallVector<scf::ForOp> allOps; | ||
funcOp->walk([&](scf::ForOp forOp) { allOps.push_back(forOp); }); | ||
|
||
SmallVector<scf::ForOp> leafOps; | ||
for (scf::ForOp forOp : allOps) { | ||
auto searchResult = forOp.getBody()->walk( | ||
[](scf::ForOp) { return WalkResult::interrupt(); }); | ||
if (!searchResult.wasInterrupted()) | ||
leafOps.push_back(forOp); | ||
} | ||
return leafOps; | ||
} | ||
} // namespace mlir::triton::AMD |
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
Oops, something went wrong.