-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5acfb02
commit f7a1909
Showing
24 changed files
with
1,346 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
add_custom_command( | ||
OUTPUT ${BUDDY_EXAMPLES_DIR}/BuddyResNet18/arg0.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 BuddyLibDIP ${PNG_LIBRARIES}) | ||
target_link_libraries(buddy-resnet-run ${BUDDY_RESNET_LIBS}) |
Oops, something went wrong.