-
Notifications
You must be signed in to change notification settings - Fork 176
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
Change the paths for generated model MLIR files and data files to the build path. #441
Changes from 7 commits
dd595fa
385cef5
de446d3
58f2b54
1f5ea93
c93e481
fe701ef
4605457
b8e3011
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,38 @@ | ||
add_custom_command( | ||
OUTPUT ${BUDDY_EXAMPLES_DIR}/BuddyBert/forward.mlir ${BUDDY_EXAMPLES_DIR}/BuddyBert/subgraph0.mlir ${BUDDY_EXAMPLES_DIR}/BuddyBert/arg0.data ${BUDDY_EXAMPLES_DIR}/BuddyBert/arg1.data | ||
COMMAND python3 ${BUDDY_EXAMPLES_DIR}/BuddyBert/import-bert.py | ||
OUTPUT ${BUDDY_BINARY_DIR}/../examples/BuddyBert/forward.mlir | ||
${BUDDY_BINARY_DIR}/../examples/BuddyBert/subgraph0.mlir | ||
${BUDDY_BINARY_DIR}/../examples/BuddyBert/arg0.data | ||
${BUDDY_BINARY_DIR}/../examples/BuddyBert/arg1.data | ||
COMMAND python3 ${BUDDY_EXAMPLES_DIR}/BuddyBert/import-bert.py | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
--output-dir ${BUDDY_BINARY_DIR}/../examples/BuddyBert | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
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}/BuddyBert/forward.mlir | ||
COMMAND ${LLVM_TOOLS_BINARY_DIR}/mlir-opt ${BUDDY_BINARY_DIR}/../examples/BuddyBert/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 -O0 -o ${BUDDY_BINARY_DIR}/../examples/BuddyBert/forward.o | ||
DEPENDS ${BUDDY_EXAMPLES_DIR}/BuddyBert/forward.mlir | ||
DEPENDS ${BUDDY_BINARY_DIR}/../examples/BuddyBert/forward.mlir | ||
COMMENT "Building forward.o" | ||
VERBATIM) | ||
|
||
add_custom_command( | ||
OUTPUT subgraph0.o | ||
COMMAND ${BUDDY_BINARY_DIR}/buddy-opt ${BUDDY_EXAMPLES_DIR}/BuddyBert/subgraph0.mlir | ||
COMMAND ${BUDDY_BINARY_DIR}/buddy-opt ${BUDDY_BINARY_DIR}/../examples/BuddyBert/subgraph0.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, func-bufferize-dynamic-offset, arith-bufferize, func.func(linalg-bufferize, tensor-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 -O0 -o ${BUDDY_BINARY_DIR}/../examples/BuddyBert/subgraph0.o | ||
DEPENDS ${BUDDY_EXAMPLES_DIR}/BuddyBert/subgraph0.mlir | ||
DEPENDS ${BUDDY_BINARY_DIR}/../examples/BuddyBert/subgraph0.mlir | ||
COMMENT "Building subgraph0.o" | ||
VERBATIM) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,8 +70,8 @@ int main() { | |
/// Load weights to MemRef container. | ||
MemRef<float, 1> arg0({109486854}); | ||
MemRef<long long, 1> arg1({512}); | ||
loadParameters("../../examples/BuddyBert/arg0.data", | ||
"../../examples/BuddyBert/arg1.data", arg0, arg1); | ||
loadParameters("../../build/examples/BuddyBert/arg0.data", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use environment variable. |
||
"../../build/examples/BuddyBert/arg1.data", arg0, arg1); | ||
|
||
/// Get user message and build Text container. | ||
std::cout << "What sentence do you want to say to BERT?" << std::endl; | ||
|
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.
${CMAKE_CURRENT_BINARY_DIR}/forward.mlir