-
Notifications
You must be signed in to change notification settings - Fork 165
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
[Examples]Add ResNet18 E2E Example #370
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 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,75 @@ | ||
add_custom_command( | ||
OUTPUT ${BUDDY_EXAMPLES_DIR}/BuddyResNet18/arg0.data | ||
${BUDDY_EXAMPLES_DIR}/BuddyResNet18/arg1.data | ||
${BUDDY_EXAMPLES_DIR}/BuddyResNet18/forward.mlir | ||
${BUDDY_EXAMPLES_DIR}/BuddyResNet18/subgraph0.mlir | ||
COMMAND python3 ${BUDDY_EXAMPLES_DIR}/BuddyResNet18/buddy-resnet-import.py | ||
COMMENT "Generating forward.mlir, subgraph0.mlir and parameter files" | ||
) | ||
|
||
|
||
add_custom_command( | ||
OUTPUT forward.o | ||
COMMAND ${LLVM_TOOLS_BINARY_DIR}/mlir-opt ${BUDDY_EXAMPLES_DIR}/BuddyResNet18/forward.mlir | ||
-pass-pipeline | ||
"builtin.module(func.func(tosa-to-linalg-named, tosa-to-linalg, tosa-to-tensor, tosa-to-arith), \ | ||
empty-tensor-to-alloc-tensor, convert-elementwise-to-linalg, arith-bufferize, \ | ||
func.func(linalg-bufferize, tensor-bufferize), func-bufferize)" | | ||
${LLVM_TOOLS_BINARY_DIR}/mlir-opt | ||
-pass-pipeline | ||
"builtin.module(func.func(buffer-deallocation-simplification, convert-linalg-to-loops), \ | ||
eliminate-empty-tensors, func.func(llvm-request-c-wrappers), \ | ||
convert-math-to-llvm, convert-math-to-libm, convert-scf-to-cf, \ | ||
convert-arith-to-llvm, expand-strided-metadata, finalize-memref-to-llvm, \ | ||
convert-func-to-llvm, reconcile-unrealized-casts)" | | ||
${LLVM_TOOLS_BINARY_DIR}/mlir-translate -mlir-to-llvmir | | ||
${LLVM_TOOLS_BINARY_DIR}/llvm-as | | ||
${LLVM_TOOLS_BINARY_DIR}/llc -filetype=obj -relocation-model=pic -O3 | ||
-o ${BUDDY_BINARY_DIR}/../examples/BuddyResNet18/forward.o | ||
DEPENDS ${BUDDY_EXAMPLES_DIR}/BuddyResNet18/forward.mlir | ||
COMMENT "Building forward.o" | ||
VERBATIM) | ||
|
||
|
||
add_custom_command( | ||
OUTPUT subgraph0.o | ||
COMMAND ${BUDDY_BINARY_DIR}/buddy-opt ${BUDDY_EXAMPLES_DIR}/BuddyResNet18/subgraph0.mlir | ||
-pass-pipeline | ||
"builtin.module(func.func(tosa-to-linalg-named, tosa-to-arith, tosa-to-linalg, tosa-to-tensor))" | | ||
${BUDDY_BINARY_DIR}/buddy-opt | ||
-convert-elementwise-to-linalg | ||
-func-bufferize-dynamic-offset | ||
-arith-bufferize | ||
-func-bufferize | ||
-tensor-bufferize | ||
-linalg-bufferize | ||
-finalizing-bufferize | ||
-convert-linalg-to-loops | ||
-lower-affine | ||
-convert-scf-to-cf | ||
-llvm-request-c-wrappers | ||
-convert-math-to-llvm | ||
-convert-math-to-libm | ||
-convert-arith-to-llvm | ||
-convert-func-to-llvm | ||
-expand-strided-metadata | ||
-finalize-memref-to-llvm | ||
-reconcile-unrealized-casts | | ||
${LLVM_TOOLS_BINARY_DIR}/mlir-translate -mlir-to-llvmir | | ||
${LLVM_TOOLS_BINARY_DIR}/llvm-as | | ||
${LLVM_TOOLS_BINARY_DIR}/llc -filetype=obj -relocation-model=pic -O3 | ||
-o ${BUDDY_BINARY_DIR}/../examples/BuddyResNet18/subgraph0.o | ||
DEPENDS ${BUDDY_EXAMPLES_DIR}/BuddyResNet18/subgraph0.mlir | ||
buddy-opt | ||
COMMENT "Building subgraph0.o" | ||
VERBATIM) | ||
|
||
add_library(RESNET STATIC subgraph0.o forward.o) | ||
|
||
SET_TARGET_PROPERTIES(RESNET PROPERTIES LINKER_LANGUAGE C) | ||
|
||
add_executable(buddy-resnet-run buddy-resnet-main.cpp) | ||
target_link_directories(buddy-resnet-run PRIVATE ${LLVM_LIBRARY_DIR}) | ||
|
||
set(BUDDY_RESNET_LIBS RESNET mlir_c_runner_utils ${OpenCV_LIBS}) | ||
target_link_libraries(buddy-resnet-run ${BUDDY_RESNET_LIBS}) |
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.
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.
This line of comment cannot exceed 80 columns. Please remove a few dashes to align with the comment separator below.