forked from tensorflow/mlir
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This chapter adds a partial lowering of toy operations, all but PrintOp, to a combination of the Affine and Std dialects. This chapter focuses on introducing the conversion framework, the benefits of partial lowering, and how easily dialects may co-exist in the IR. PiperOrigin-RevId: 275150649
- Loading branch information
1 parent
48f7ec8
commit 288ac1b
Showing
36 changed files
with
1,956 additions
and
2,681 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,42 @@ | ||
add_subdirectory(include) | ||
|
||
set(LLVM_LINK_COMPONENTS | ||
Support | ||
) | ||
|
||
set(LLVM_TARGET_DEFINITIONS mlir/ToyCombine.td) | ||
mlir_tablegen(ToyCombine.inc -gen-rewriters "-I${CMAKE_CURRENT_SOURCE_DIR}/include") | ||
add_public_tablegen_target(ToyCh5CombineIncGen) | ||
|
||
add_toy_chapter(toyc-ch5 | ||
toyc.cpp | ||
parser/AST.cpp | ||
mlir/EarlyLowering.cpp | ||
mlir/LateLowering.cpp | ||
mlir/MLIRGen.cpp | ||
mlir/Dialect.cpp | ||
mlir/DeadFunctionEliminationPass.cpp | ||
mlir/LowerToAffineLoops.cpp | ||
mlir/ShapeInferencePass.cpp | ||
mlir/ToyDialect.cpp | ||
mlir/ToyCombine.cpp | ||
) | ||
|
||
add_dependencies(toyc-ch5 ToyCh5ShapeInferenceInterfaceIncGen) | ||
add_dependencies(toyc-ch5 ToyCh5OpsIncGen) | ||
add_dependencies(toyc-ch5 ToyCh5CombineIncGen) | ||
add_dependencies(toyc-ch5 MLIRCallOpInterfacesIncGen) | ||
include_directories(include/) | ||
include_directories(../../Linalg/Linalg1/include/) | ||
include_directories(../../Linalg/Linalg2/include/) | ||
include_directories(../../Linalg/Linalg3/include/) | ||
include_directories(${CMAKE_CURRENT_BINARY_DIR}) | ||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/) | ||
target_link_libraries(toyc-ch5 | ||
PRIVATE | ||
Linalg3DialectConstruction | ||
Linalg3 | ||
Linalg2 | ||
Linalg1 | ||
MLIRAffineOps | ||
MLIRAnalysis | ||
MLIREDSC | ||
MLIRExecutionEngine | ||
MLIRIR | ||
MLIRLLVMIR | ||
MLIRParser | ||
MLIRPass | ||
MLIRTargetLLVMIR | ||
MLIRTransforms | ||
MLIRSupport | ||
) | ||
MLIRStandardOps | ||
MLIRTransforms) | ||
|
||
whole_archive_link(toyc-ch5 | ||
MLIRAffineOps | ||
MLIRStandardOps | ||
) | ||
|
||
) |
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 @@ | ||
add_subdirectory(toy) |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
set(LLVM_TARGET_DEFINITIONS Ops.td) | ||
mlir_tablegen(Ops.h.inc -gen-op-decls "-I${CMAKE_CURRENT_SOURCE_DIR}/..") | ||
mlir_tablegen(Ops.cpp.inc -gen-op-defs "-I${CMAKE_CURRENT_SOURCE_DIR}/..") | ||
add_public_tablegen_target(ToyCh5OpsIncGen) | ||
|
||
set(LLVM_TARGET_DEFINITIONS ShapeInferenceInterface.td) | ||
mlir_tablegen(ShapeInferenceOpInterfaces.h.inc -gen-op-interface-decls) | ||
mlir_tablegen(ShapeInferenceOpInterfaces.cpp.inc -gen-op-interface-defs) | ||
add_public_tablegen_target(ToyCh5ShapeInferenceInterfaceIncGen) |
Oops, something went wrong.