Skip to content
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

[NNPA] Add numerical test for NNPA #1335

Merged
merged 108 commits into from
May 30, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
2bfeeca
Initial test for numrical and backend tests for nnpa
imaihal Apr 8, 2022
86b0b86
Fix setting for atol and rtol for numerical tests
imaihal Apr 8, 2022
779aaf9
Create directories for backend tests for NNPA
imaihal Apr 11, 2022
73021fa
Remove code for backend test from test/backend
imaihal Apr 11, 2022
84b7ca8
Add numerical tests for NNPA
imaihal Apr 12, 2022
9060ad3
Remove numerical tests from main numerical tests
imaihal Apr 12, 2022
bba79db
Merge branch 'main' into nnpa_tests
imaihal Apr 12, 2022
32b6db2
Fix config for numerical tests of NNPA.
imaihal Apr 12, 2022
3d3abc7
Remove duplicated code for backend tests
imaihal Apr 13, 2022
9a2516e
Remove inference_backend_nnpa.py
imaihal Apr 13, 2022
0c0823d
Remove TestLoop for NNPA
imaihal Apr 13, 2022
ffda9e6
Clean up CMakeLists in backend test
imaihal Apr 13, 2022
4841a11
Remove inference_backend_nnpa in test_nnpa.py
imaihal Apr 13, 2022
1665e06
Clean up makefile
imaihal Apr 14, 2022
70b0db1
Merge branch 'main' into nnpa_tests
imaihal Apr 14, 2022
8fc0bd7
Merge branch 'main' into nnpa_tests
imaihal Apr 15, 2022
ba38b3b
Remove test_nnpa.py
imaihal Apr 15, 2022
0a35b38
Merge branch 'main' into nnpa_tests
imaihal Apr 18, 2022
850f69f
Merge branch 'main' into nnpa_tests
imaihal Apr 19, 2022
ae1799e
Remove LD_PRELOAD
imaihal Apr 19, 2022
eed67bd
Merge branch 'main' into nnpa_tests
imaihal Apr 21, 2022
4ace29d
Merge branch 'main' into nnpa_tests
imaihal Apr 21, 2022
e345c5c
Merge branch 'main' into nnpa_tests
imaihal Apr 22, 2022
37915f9
Added numerical tests of LSTM for NNPA
imaihal Apr 22, 2022
32f7557
Remove backend test for NNPA
imaihal Apr 22, 2022
62edc48
Merge branch 'main' into nnpa_tests
imaihal Apr 25, 2022
5d57a75
Use LD_PRELOAD
imaihal Apr 25, 2022
d477acc
Add comments in TestLSTM-NNPA.cpp
imaihal Apr 28, 2022
2578720
Add numerical test for GRU only including NNPA-supported cases.
imaihal Apr 28, 2022
ef93abd
Disable tests for Conv for now
imaihal Apr 28, 2022
2601fed
Merge branch 'main' into nnpa_tests
imaihal Apr 28, 2022
df54393
Rename ACCELERATORS_TO_BUILD to ONNX_MLIR_ACCELERATORS
imaihal Apr 28, 2022
93c2d2a
Remove TestRNN-NNPA
imaihal Apr 28, 2022
734ee86
Add doc for building and testing for NNPA.
imaihal Apr 28, 2022
1dabdf5
Merge branch 'nnpa_tests' of github.com:imaihal/onnx-mlir into nnpa_t…
imaihal Apr 28, 2022
0d2b1a1
Update doc
imaihal Apr 28, 2022
3e2c4bf
Merge branch 'main' into nnpa_tests
imaihal Apr 28, 2022
d4ee119
Removed update for backend test
imaihal Apr 28, 2022
9b0b22d
Merge branch 'main' into nnpa_tests
imaihal Apr 29, 2022
3a57760
Merge branch 'main' into nnpa_tests
imaihal May 2, 2022
8349419
Merge branch 'main' into nnpa_tests
imaihal May 6, 2022
8e81da4
Merge branch 'main' into nnpa_tests
imaihal May 8, 2022
59db5f7
Reflect the change about optimization level in numerical tests
imaihal May 9, 2022
352deef
Update docs
imaihal May 9, 2022
f1222ea
Add sentences in CONTRIBUTING.md and docs/Testing.md
imaihal May 9, 2022
4944dfb
Added comments in TestLSTM-NNPA.cpp and TestGRU-NNPA.cpp
imaihal May 9, 2022
fa8a02d
Merge branch 'main' into nnpa_tests
imaihal May 9, 2022
e1ec315
Update docs
imaihal May 10, 2022
91af192
Merge branch 'main' into nnpa_tests
imaihal May 10, 2022
ea24d0c
Merge branch 'main' into nnpa_tests
imaihal May 13, 2022
a406b75
Remove LD_PRELOAD and fix to display log output to stdout
imaihal May 13, 2022
51c9a8d
Catch up latest main for TestLSTM
imaihal May 13, 2022
6805d6d
Fix TestGRU
imaihal May 13, 2022
c694bc6
Merge branch 'main' into nnpa_tests
imaihal May 13, 2022
f84bd57
Merge branch 'main' into nnpa_tests
imaihal May 17, 2022
f1bc10f
Print test configrations
imaihal May 17, 2022
648234a
Added testAllOpsToZdnn option to confirm instructions for NNPA is cor…
imaihal May 18, 2022
3fc7fd3
Merge branch 'main' into nnpa_tests
imaihal May 18, 2022
fed1da5
Fix an comment.
imaihal May 18, 2022
fa74305
Revert "Added testAllOpsToZdnn option to confirm instructions for NNP…
imaihal May 19, 2022
a0e9d26
Merge branch 'main' into nnpa_tests
imaihal May 19, 2022
ff362da
Add check for instruction
imaihal May 19, 2022
8d53217
Merge branch 'main' into nnpa_tests
imaihal May 19, 2022
45290a9
clang-format
imaihal May 19, 2022
eedaa36
Skip tests for Gemm
imaihal May 20, 2022
25726b0
Merge branch 'main' into nnpa_tests
imaihal May 20, 2022
d531276
Integrate NNPA ver. with CPU ver. for LSTM.
imaihal May 20, 2022
2ee5bc6
Integrate NNPA ver. with CPU ver. for GRU.
imaihal May 20, 2022
e6acf8f
Enable Gemm tests using the same source with CPU.
imaihal May 20, 2022
015cb36
Update comments
imaihal May 20, 2022
bb0aa22
Clean up
imaihal May 20, 2022
df024eb
Skip ModelLibBuilder::checkSharedLibInstruction() on WIN32 since this…
imaihal May 20, 2022
b7805d0
Merge branch 'main' into nnpa_tests
imaihal May 21, 2022
2a107e3
Use dlsys() to find symbols for zdnn
imaihal May 21, 2022
e3508c9
Add dl in ModelLib
imaihal May 22, 2022
75faeb8
Use CMAKE_DL_LIBS instead of dl
imaihal May 22, 2022
06840e9
Merge branch 'main' into nnpa_tests
imaihal May 22, 2022
0928ddf
Update comments
imaihal May 23, 2022
fde25a7
Remove EXCLUDE_FROM_DEFAULT_BUILD
imaihal May 23, 2022
e20853f
Remove ifdef direcvives for WIN32
imaihal May 23, 2022
32d7d3c
Implement WIN32 vers of checkSharedLibInstruction()
imaihal May 23, 2022
2643b83
Fix checkSharedLibInstruction() for WIN32
imaihal May 23, 2022
b26b6f0
test for win32
imaihal May 23, 2022
680bf52
Add dlclose() before return
imaihal May 23, 2022
bc6149e
Test for WIN32
imaihal May 23, 2022
ecfd30f
Test for WIN32
imaihal May 23, 2022
76588ab
Test for WIN32
imaihal May 23, 2022
fdbc989
Define NOMINMAX
imaihal May 23, 2022
770493e
Enable WIN32
imaihal May 23, 2022
a49cd7b
Add const in arguments of checkSharedLibInstruction()
imaihal May 24, 2022
f54911f
std::string to std::wstring in LoadLibrary()
imaihal May 24, 2022
d18d58b
Change include order
imaihal May 24, 2022
6aa0a1a
Remove NOMINMAX
imaihal May 24, 2022
8146c56
Merge branch 'main' into nnpa_tests
imaihal May 24, 2022
4748544
Use loop in all case in LSTM and GRU
imaihal May 25, 2022
44ad4d8
Refactor a function for checking instruction.
imaihal May 25, 2022
e180925
Merge branch 'main' into nnpa_tests
imaihal May 26, 2022
b76e69f
Get symbol using llvm APIs
imaihal May 26, 2022
626a73e
Use checkInstructionFromEnv() in Conv and RNN
imaihal May 26, 2022
6bb232f
Test for failure: test for checkInstructionFromEnv()
imaihal May 26, 2022
a0ee501
Revert "Test for failure: test for checkInstructionFromEnv()"
imaihal May 26, 2022
86c5cae
Merge branch 'main' into nnpa_tests
imaihal May 27, 2022
adb7122
Merge branch 'main' into nnpa_tests
imaihal May 30, 2022
008167a
Change interface of checkInstructionFromEnv() and env name for instru…
imaihal May 30, 2022
c7c3430
Add getSharedLibraryHandle() in ExecutionSession
imaihal May 30, 2022
d622e5e
Merge branch 'main' into nnpa_tests
imaihal May 30, 2022
353beb7
Add TODO
imaihal May 30, 2022
edc4ce9
Update docs
imaihal May 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Initial test for numrical and backend tests for nnpa
Signed-off-by: Haruki Imai <imaihal@jp.ibm.com>
  • Loading branch information
imaihal committed Apr 8, 2022
commit 2bfeeca826e869c4e182c91e7f52fd7ebac30515
5 changes: 4 additions & 1 deletion test/backend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,17 @@ if (EXISTS ${LIBSTDCXX_LIB})
set(LD_PRELOADS ${LIBSTDCXX_LIB}:${LD_PRELOADS})
endif()

set(ZDNN_LIBRARY_DIR $ENV{ZDNN_LIBRARY_DIR})
set(ZDNN_LIB "${ZDNN_LIBRARY_DIR}/libzdnn.so")

# ${ONNX_HOME} is the directory where onnx downloads real model files.
# Model files are saved under ${ONNX_HOME}/models/model_name/model.onnx.
# C/C++ and JNI tests run in parallel so they must use a different
# ONNX_HOME to avoid conflicts.
add_custom_target(check-onnx-backend
COMMAND
ONNX_HOME=${CMAKE_CURRENT_BINARY_DIR}/cpp
${BACKEND_TEST_COMMAND} ${BACKEND_TEST_ARGS} ${FILE_GENERATE_DIR}/test.py
LD_PRELOAD=${ZDNN_LIB} ${BACKEND_TEST_COMMAND} ${BACKEND_TEST_ARGS} ${FILE_GENERATE_DIR}/test.py
DEPENDS
${FILE_GENERATE_DIR}/test.py
${FILE_GENERATE_DIR}/test_config.py
Expand Down
1 change: 1 addition & 0 deletions test/backend/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def compile_model(model, emit):
command_list.append(target[emit])
command_list.append(model_name)
command_list.append('-O3')
command_list.append('--maccel=NNPA')
command_list.append("-o=" + exec_base)

# Call frontend to process model_name.onnx, bit code will be generated.
Expand Down
9 changes: 8 additions & 1 deletion test/numerical/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
add_custom_target(numerical)
set_target_properties(numerical PROPERTIES FOLDER "Tests")

set(ZDNN_LIBRARY_DIR $ENV{ZDNN_LIBRARY_DIR})
set(ZDNN_LIB "${ZDNN_LIBRARY_DIR}/libzdnn.so")

add_custom_target(check-onnx-numerical
COMMENT "Running the ONNX-MLIR numerical regression tests"
COMMAND "${CMAKE_CTEST_COMMAND}" -L numerical --output-on-failure -C $<CONFIG> --force-new-ctest-process
Expand Down Expand Up @@ -31,8 +34,11 @@ function(add_numerical_unittest test_name)

# Force -O3 when invoking the numerical tests, so that the models in the test
# are compiled with -O3. TODO: make that a runtime env variable.
add_test(NAME ${test_name} COMMAND ${test_name} -O3 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
add_test(NAME ${test_name} COMMAND ${test_name} -O3 --maccel=NNPA WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_tests_properties(${test_name} PROPERTIES LABELS numerical)
set_tests_properties(${test_name} PROPERTIES ENVIRONMENT TEST_ATOL=0.01)
set_tests_properties(${test_name} PROPERTIES ENVIRONMENT TEST_RTOL=0.05)
set_tests_properties(${test_name} PROPERTIES ENVIRONMENT LD_PRELOAD=${ZDNN_LIB})

if (WIN32)
# On Windows, we need a .def file to specify the export functions from a DLL.
Expand All @@ -56,6 +62,7 @@ llvm_update_compile_flags(rapidcheck)
# The CompilerUtils ExecutionSession are also included in ModelLib,
# but it did not compile when I removed these two. TODO, figure out why.
set(TEST_LINK_LIBS rapidcheck ModelLib)
# set(TEST_LINK_LIBS rapidcheck ModelLib ${ZDNN_LIBRARY_DIR}/libzdnn.so)

add_numerical_unittest(TestConv
TestConv.cpp
Expand Down