Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into fuse-broadcast
Browse files Browse the repository at this point in the history
  • Loading branch information
chentong319 committed Oct 26, 2023
2 parents d87e976 + 3699003 commit c53ea0e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/Accelerators/NNPA/NNPAAccelerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@
#include "llvm/Support/Debug.h"

#include "src/Accelerators/NNPA/Compiler/NNPACompilerUtils.hpp"
#include "src/Accelerators/NNPA/Conversion/ONNXToZHigh/ONNXLegalityCheck.hpp"
#include "src/Accelerators/NNPA/Conversion/ZHighToZLow/ZHighToZLow.hpp"
#include "src/Accelerators/NNPA/Conversion/ZLowToLLVM/ZLowToLLVM.hpp"
#include "src/Accelerators/NNPA/Dialect/ZHigh/ZHighOps.hpp"
#include "src/Accelerators/NNPA/Dialect/ZLow/ZLowOps.hpp"
#include "src/Accelerators/NNPA/NNPAAccelerator.hpp"
#include "src/Accelerators/NNPA/Pass/NNPAPasses.hpp"
#include "src/Accelerators/NNPA/Support/NNPALimit.h"
#include "src/Compiler/CompilerOptions.hpp"
#include "zdnn.h"

Expand All @@ -48,6 +50,12 @@ NNPAAccelerator *NNPAAccelerator::getInstance() {

NNPAAccelerator::NNPAAccelerator() : Accelerator(Accelerator::Kind::NNPA) {
LLVM_DEBUG(llvm::dbgs() << "Creating an NNPA accelerator\n");

// Print a warning if mcpu is not set or < z16.
if (!isCompatibleWithNNPALevel(NNPA_Z16))
llvm::outs() << "Warning: No NNPA code is generated because --mcpu is not "
"set or < z16.\n";

acceleratorTargets.push_back(this);
// Order is important! libRuntimeNNPA depends on libzdnn
addCompilerConfig(CCM_SHARED_LIB_DEPS, {"RuntimeNNPA", "zdnn"});
Expand Down
2 changes: 1 addition & 1 deletion test/accelerators/NNPA/backend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ foreach(test_name IN LISTS NNPA_TEST_LIST)
set(ENV_TEST_CASE_BY_USER "${ENV_TEST_CASE_BY_USER} ${test_name}")
endforeach()

set(NNPA_TESTS_ENVS TEST_MACCEL=NNPA TEST_CASE_BY_USER=${ENV_TEST_CASE_BY_USER} TEST_ATOL=0.01 TEST_RTOL=0.05)
set(NNPA_TESTS_ENVS TEST_MCPU=z16 TEST_MACCEL=NNPA TEST_CASE_BY_USER=${ENV_TEST_CASE_BY_USER} TEST_ATOL=0.01 TEST_RTOL=0.05)

# ${ONNX_HOME} is the directory where onnx downloads real model files.
# Model files are saved under ${ONNX_HOME}/models/model_name/model.onnx.
Expand Down
2 changes: 1 addition & 1 deletion test/accelerators/NNPA/numerical/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function(add_numerical_test test_name)

# Optimization level set by ONNX_MLIR_TEST_OPTLEVEL, defaults to 3
add_test(NAME ${test_name}
COMMAND ${test_name} -O${ONNX_MLIR_TEST_OPTLEVEL} --maccel=NNPA
COMMAND ${test_name} -O${ONNX_MLIR_TEST_OPTLEVEL} --mcpu=z16 --maccel=NNPA
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
set_tests_properties(${test_name} PROPERTIES LABELS numerical-nnpa)
Expand Down

0 comments on commit c53ea0e

Please sign in to comment.