-
Notifications
You must be signed in to change notification settings - Fork 15
Refactor the code to make it more scalable #21
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 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b262878
refactor the code organization
ShangkunLi 29913fa
remove some redundant code
ShangkunLi 6161464
change the cmakelists
ShangkunLi e144940
add the NeuraDialect folder in lib
ShangkunLi 32b4f48
split transforms and conversions
ShangkunLi 1e1e4a9
change the place of Conversion directory
ShangkunLi 4e995f1
fix the bugs in cmakelists
ShangkunLi 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| add_subdirectory(NeuraDialect) | ||
| add_subdirectory(NeuraDialect) | ||
tancheng marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
|---|---|---|
| @@ -1,9 +1,5 @@ | ||
| include(TableGen) | ||
| include(AddLLVM) | ||
| include(AddMLIR) | ||
|
|
||
| set(MLIR_TBLGEN_INCLUDES | ||
| ${MLIR_SOURCE_DIR}/include # MLIR source include directory | ||
| ${MLIR_BINARY_DIR}/include # MLIR build include directory | ||
| ) | ||
tancheng marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| add_mlir_dialect(Neura neura) | ||
|
|
||
| set(LLVM_TARGET_DEFINITIONS NeuraPasses.td) | ||
| mlir_tablegen(NeuraPasses.h.inc --gen-pass-decls) | ||
| add_public_tablegen_target(MLIRNeuraTransformsIncGen) | ||
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,8 @@ | ||
| #ifndef NEURA_TD | ||
| #define NEURA_TD | ||
|
|
||
| include "NeuraDialect.td" | ||
| include "NeuraOps.td" | ||
| include "NeuraPasses.td" | ||
|
|
||
| #endif // GRAPH_TD |
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 |
|---|---|---|
| @@ -1,8 +1,13 @@ | ||
| // NeuraDialect.td - TableGen description of the dialect. | ||
| include "mlir/IR/BuiltinDialect.td" | ||
| #ifndef NEURADIALECT_TD | ||
| #define NEURADIALECT_TD | ||
|
|
||
| include "mlir/IR/OpBase.td" | ||
| include "mlir/IR/DialectBase.td" | ||
|
|
||
| def NeuraDialect : Dialect { | ||
| let name = "neura"; | ||
| let cppNamespace = "::mlir::neura"; | ||
| } | ||
|
|
||
| #endif // NEURADIALECT_TD |
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,33 @@ | ||
| // NeuraPasses.h - Header file for Neura passes | ||
|
|
||
| #ifndef NEURA_PASSES_H | ||
| #define NEURA_PASSES_H | ||
|
|
||
| #include "NeuraDialect/NeuraDialect.h" | ||
| #include "NeuraDialect/NeuraOps.h" | ||
| #include "mlir/Pass/Pass.h" | ||
| #include "mlir/Pass/PassManager.h" | ||
| #include "mlir/Pass/PassRegistry.h" | ||
| #include <memory> | ||
|
|
||
| namespace mlir { | ||
| namespace neura { | ||
|
|
||
| // Passes defined in GraphPasses.td | ||
| #define GEN_PASS_DECL | ||
| #include "NeuraDialect/NeuraPasses.h.inc" | ||
| std::unique_ptr<mlir::Pass> createInsertMovPass(); | ||
| std::unique_ptr<mlir::Pass> createFusePatternsPass(); | ||
| std::unique_ptr<mlir::Pass> createAssignAcceleratorPass(); | ||
|
|
||
| // Conversion passes | ||
| std::unique_ptr<mlir::Pass> createLowerArithToNeuraPass(); | ||
| std::unique_ptr<mlir::Pass> createLowerLlvmToNeuraPass(); | ||
|
|
||
| #define GEN_PASS_REGISTRATION | ||
| #include "NeuraDialect/NeuraPasses.h.inc" | ||
|
|
||
| } // namespace neura | ||
| } // namespace mlir | ||
|
|
||
| #endif // NEURA_PASSES_H |
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,45 @@ | ||
| // NeuraPasses.td - Passes for the Neura dialect | ||
|
|
||
| #ifndef NEURA_PASSES_TD | ||
| #define NEURA_PASSES_TD | ||
|
|
||
| include "mlir/Pass/PassBase.td" | ||
|
|
||
| //=========================================================// | ||
| // Passes for the Neura dialect | ||
| //=========================================================// | ||
| def AssignAccelerator : Pass<"assign-accelerator", "ModuleOp"> { | ||
| let summary = "Assigns accelerators to operations in the Neura dialect"; | ||
| let description = [{Tags non - main functions as neura.kernel.}]; | ||
| let constructor = "neura::createAssignAcceleratorPass()"; | ||
| } | ||
|
|
||
| def FusePatterns : Pass<"fuse-patterns", "ModuleOp"> { | ||
| let summary = "Fuses patterns in the Neura dialect"; | ||
| let description = [{Apply Neura fusion patterns.}]; | ||
| let constructor = "neura::createFusePatternsPass()"; | ||
| } | ||
|
|
||
| def InsertMov : Pass<"insert-mov", "ModuleOp"> { | ||
| let summary = "Inserts move operations in the Neura dialect"; | ||
| let description = | ||
| [{Insert neura.mov before and after all neura dialect operations.}]; | ||
| let constructor = "neura::createInsertMovPass()"; | ||
| } | ||
|
|
||
| //=========================================================// | ||
| // Conversion passes | ||
| //=========================================================// | ||
| def LowerArithToNeura : Pass<"lower-arith-to-neura", "FuncOp">{ | ||
| let summary = "Lower arith to Neura dialect"; | ||
| let description = [{Lower arith dialect operations to Neura dialect operations.}]; | ||
| let constructor = "neura::createLowerArithToNeuraPass()"; | ||
| } | ||
|
|
||
| def LowerLlvmToNeura : Pass<"lower-llvm-to-neura", "ModuleOp">{ | ||
| let summary = "Lower LLVM to Neura dialect"; | ||
| let description = [{Lower LLVM operations to Neura dialect operations.}]; | ||
| let constructor = "neura::createLowerLlvmToNeuraPass()"; | ||
| } | ||
|
|
||
| #endif // NEURA_PASSES_TD |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
|---|---|---|
| @@ -1,3 +1,12 @@ | ||
| add_subdirectory(NeuraDialect) | ||
| add_subdirectory(Conversion) | ||
| add_subdirectory(Transforms) | ||
| add_mlir_dialect_library(MLIRNeura | ||
| Neura.cpp | ||
|
|
||
| DEPENDS | ||
| MLIRNeuraIncGen | ||
|
|
||
| LINK_LIBS PUBLIC | ||
| MLIRIR | ||
| MLIRSupport | ||
| ) | ||
|
|
||
| add_subdirectory(Transforms) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
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.