提交 62bd6c82 编写于 作者: M Megvii Engine Team 提交者: huangxinda

feat(cmake/debug): misc for build

* add asan build option
* fix cpuinfo build opt level
* fix host release build with out debug info
* opt "fix lite bazel/cmake symbols MR"
* other misc build opt

GitOrigin-RevId: 6ca286e195cbe7ecf36e34317a2dab81b7b13a5e
上级 c7a5c21a
......@@ -65,11 +65,12 @@ option(MGE_INFERENCE_ONLY "Build inference only library." OFF)
option(MGE_WITH_MKLDNN "Enable Intel MKL_DNN support," ON)
option(MGE_WITH_ROCM "Enable ROCM support" OFF)
option(MGE_WITH_LARGE_ARCHIVE "Enable big archive link support" OFF)
option(MGE_BUILD_WITH_ASAN "Enable build with ASAN, need compiler support" OFF)
if(MSVC OR WIN32)
message(STATUS "windows force cudnn static link")
set(MGE_WITH_CUDNN_SHARED OFF)
message(STATUS "windows force cudnn static link")
set(MGE_WITH_CUDNN_SHARED OFF)
endif()
if(MGE_WITH_NVRTC_STUB OR MGE_WITH_CUDA_STUB)
......@@ -90,14 +91,15 @@ if(NOT ${MGE_BIN_REDUCE} STREQUAL "")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -include ${MGE_BIN_REDUCE}")
endif()
CHECK_CXX_COMPILER_FLAG("-ffunction-sections -fdata-sections -Wl,--gc-sections" CXX_FUNCTION_DATA_GC_SECTIONS_SUPPORT)
if(CXX_FUNCTION_DATA_GC_SECTIONS_SUPPORT)
#mac or apple not support
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections")
if (NOT APPLE)
# check CXX_FUNCTION_DATA_GC_SECTIONS_SUPPORT on APPLE will leak cmake crash
CHECK_CXX_COMPILER_FLAG("-ffunction-sections -fdata-sections -Wl,--gc-sections" CXX_FUNCTION_DATA_GC_SECTIONS_SUPPORT)
if(CXX_FUNCTION_DATA_GC_SECTIONS_SUPPORT)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections")
endif()
endif()
check_ipo_supported(RESULT IS_LTO_SUPPORT OUTPUT output_info)
......@@ -181,13 +183,14 @@ if(${MGE_ARCH} STREQUAL "AUTO")
endif()
endif()
if((${MGE_ARCH} STREQUAL "x86_64" OR ${MGE_ARCH} STREQUAL "i386" OR ${MGE_ARCH} STREQUAL "armv7" OR ${MGE_ARCH} STREQUAL "aarch64") AND NOT APPLE)
option(MGE_ENABLE_CPUINFO "Build cpuinfo library for check runtime." ON)
if(MGE_ENABLE_CPUINFO)
message(STATUS "Enable cpuinfo runtime check and little kernel optimize.")
add_definitions(-DMGB_ENABLE_CPUINFO_CHECK)
include(cmake/cpuinfo.cmake)
endif()
if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
set(CMAKE_BUILD_TYPE RelWithDebInfo)
endif()
if(${CMAKE_BUILD_TYPE} STREQUAL "Release" AND NOT MGE_WITH_TEST AND NOT ${MGE_ARCH} STREQUAL "x86_64")
set(MGE_ENABLE_RTTI OFF)
message(STATUS "disable MGE_ENABLE_RTTI when Release/NON-x86_64 mode!!")
endif()
if(MSVC OR WIN32)
......@@ -205,8 +208,42 @@ if(MSVC OR WIN32)
if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang" AND NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang-cl")
message(FATAL_ERROR "only support clang-cl for windows build, pls check detail: scripts/cmake-build/BUILD_README.md")
endif()
# on windows need append VS_PATH/VC/Tools/Llvm/x64/lib/clang/${CMAKE_CXX_COMPILER_VERSION}/lib/windows
# and VS_PATH/VC/Tools/Llvm/lib/clang/${CMAKE_CXX_COMPILER_VERSION}/lib/windows to PATH env
if (MGE_BUILD_WITH_ASAN)
if("$ENV{VS_PATH}" STREQUAL "")
message(FATAL_ERROR "can not find VS_PATH, please export Visual Studio root dir to VS_PATH env")
endif()
if(${MGE_ARCH} STREQUAL "x86_64")
set(WINDOWS_ASAN_DLL_NAME "clang_rt.asan_dynamic-x86_64.lib")
set(WINDOWS_ASAN_RUNTIME_THUNK_NAME "clang_rt.asan_dynamic_runtime_thunk-x86_64")
set(WINDOWS_ASAN_PATH_SUFFIXES "VC/Tools/Llvm/x64/lib/clang/${CMAKE_CXX_COMPILER_VERSION}/lib/windows")
elseif(${MGE_ARCH} STREQUAL "i386")
set(WINDOWS_ASAN_DLL_NAME "clang_rt.asan_dynamic-i386.lib")
set(WINDOWS_ASAN_RUNTIME_THUNK_NAME "clang_rt.asan_dynamic_runtime_thunk-i386.lib")
set(WINDOWS_ASAN_PATH_SUFFIXES "VC/Tools/Llvm/lib/clang/${CMAKE_CXX_COMPILER_VERSION}/lib/windows")
else()
message(FATAL_ERROR "unsupport asan ARCH: ${MGE_ARCH} on Windows")
endif()
find_path(ASAN_DLL_PATH
NAMES ${WINDOWS_ASAN_DLL_NAME}
HINTS $ENV{VS_PATH}
PATH_SUFFIXES ${WINDOWS_ASAN_PATH_SUFFIXES}
DOC "Windows asan library path" )
if(ASAN_DLL_PATH STREQUAL "ASAN_DLL_PATH-NOTFOUND")
message(FATAL_ERROR "can not find asan dll, please upgrade you LLVM")
endif()
message(STATUS "Windows asan dll path: ${ASAN_DLL_PATH}")
link_directories(${ASAN_DLL_PATH})
link_libraries(${WINDOWS_ASAN_DLL_NAME})
link_libraries(${WINDOWS_ASAN_RUNTIME_THUNK_NAME})
set(WIN_FLAGS "/Od -DNDEBUG -fsanitize=address")
else()
set(WIN_FLAGS "/O2")
endif()
# add flags for enable sse instruction optimize for X86, enable avx header to compile avx code
set(WIN_FLAGS "-msse4.2 -O2 -D_AVX_ -D_AVX2_ -D__AVX__ -D__AVX2__ -D__FMA__")
set(WIN_FLAGS "${WIN_FLAGS} -msse4.2 -D_AVX_ -D_AVX2_ -D__AVX__ -D__AVX2__ -D__FMA__")
# if u CPU is cascadelake series, u can enable for performance
# set(WIN_FLAGS "{WIN_FLAGS} -march=cascadelake -mtune=cascadelake")
# set(WIN_FLAGS "{WIN_FLAGS} -mavx512cd -mavx512vl -mavx512dq -mavx512bw -mavx512vbmi -mavx512vnni")
......@@ -233,14 +270,35 @@ if(MSVC OR WIN32)
set(MGE_WITH_DISTRIBUTED OFF)
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
if(ANDROID)
set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Ofast -DNDEBUG -g")
# NONE windows DEBUG general flags
if(MGE_BUILD_WITH_ASAN)
set(CMAKE_C_FLAGS_DEBUG "-O0 -g -fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -fsanitize=address -fno-omit-frame-pointer")
else()
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -DNDEBUG -g")
set(CMAKE_C_FLAGS_DEBUG "-O0 -g")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
endif()
# NONE windows opt general flags
if (MGE_BUILD_WITH_ASAN)
set(OPTIMIZE_LEVEL "-g -O0 -DNDEBUG -fsanitize=address -fno-omit-frame-pointer")
elseif(ANDROID)
set(OPTIMIZE_LEVEL "-g -Ofast -DNDEBUG")
else()
set(OPTIMIZE_LEVEL "-g -O3 -DNDEBUG")
endif()
set(CMAKE_C_FLAGS_RELEASE "${OPTIMIZE_LEVEL}")
set(CMAKE_CXX_FLAGS_RELEASE "${OPTIMIZE_LEVEL}")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${OPTIMIZE_LEVEL}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${OPTIMIZE_LEVEL}")
#some gnu(gcc) compiler use -static -libasan have runtime issue
#also, when target is big, clang ld will take a long long long
#time when use -static-libsan, so we use dynamic asan by default
#ANDROID asan.so depends on log, so broadcast log link_libraries
#for megengine depends target, for example flatc target
if (MGE_BUILD_WITH_ASAN AND ANDROID)
link_libraries(log)
endif()
endif()
......@@ -353,11 +411,6 @@ if(NOT CMAKE_CUDA_HOST_COMPILER)
set(CMAKE_CUDA_HOST_COMPILER $(CMAKE_CXX_COMPILER))
endif()
if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
set(CMAKE_BUILD_TYPE RelWithDebInfo)
endif()
if(NOT MGE_ENABLE_RTTI)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
endif()
......@@ -612,6 +665,16 @@ if(MGE_WITH_CUDA)
endif()
###########please add_subdirectory from here###############
if((${MGE_ARCH} STREQUAL "x86_64" OR ${MGE_ARCH} STREQUAL "i386" OR ${MGE_ARCH} STREQUAL "armv7" OR ${MGE_ARCH} STREQUAL "aarch64") AND NOT APPLE)
option(MGE_ENABLE_CPUINFO "Build cpuinfo library for check runtime." ON)
if(MGE_ENABLE_CPUINFO)
message(STATUS "Enable cpuinfo runtime check and little kernel optimize.")
add_definitions(-DMGB_ENABLE_CPUINFO_CHECK)
include(cmake/cpuinfo.cmake)
endif()
endif()
if(MGE_WITH_CAMBRICON)
include_directories("$ENV{NEUWARE_HOME}/include")
link_directories("$ENV{NEUWARE_HOME}/lib64")
......@@ -734,6 +797,11 @@ ENDIF()
set(MGB_JIT ${MGE_WITH_JIT})
set(MGB_JIT_MLIR ${MGE_WITH_JIT_MLIR})
set(MGB_JIT_HALIDE ${MGE_WITH_HALIDE})
# for consumer override MGB_C_OPR_INIT_FUNC symbol interface
if(NOT "${CUSTOM_C_OPR_INIT_FUNC}" STREQUAL "")
add_compile_definitions(MGB_C_OPR_INIT_FUNC=${CUSTOM_C_OPR_INIT_FUNC})
message(STATUS "override MGB_C_OPR_INIT_FUNC to ${CUSTOM_C_OPR_INIT_FUNC}")
endif()
if(MSVC OR WIN32)
set(CMAKE_HAVE_THREADS_LIBRARY 1)
......
......@@ -222,7 +222,8 @@ megcoreDeviceHandle_t megdnn::get_device_handle(Handle* handle) {
megcoreDeviceHandle_t dev_handle;
megcoreComputingHandle_t comp_handle = handle->megcore_computing_handle();
status = megcoreGetDeviceHandle(comp_handle, &dev_handle);
megdnn_assert(status == megcoreSuccess);
megdnn_throw_if(status != megcoreSuccess, megdnn_error,
"get device handle error!");
return dev_handle;
}
......
......@@ -20,14 +20,14 @@
var svgHeight = undefined;
var loadDesc = (svgElem) => {
var mgeType = svgElem.attributes['mge:type'];
var mgeType = svgElem.attributes['tag:type'];
if (mgeType === undefined) {
return;
}
var elemList = [];
for (attrName of svgElem.getAttributeNames()) {
var prefix = 'mge:';
var prefix = 'tag:';
if (!attrName.startsWith(prefix)) {
continue;
}
......@@ -57,7 +57,7 @@
return;
}
svgElem.onmousedown = e => {
var mgeType = svgElem.attributes['mge:type'];
var mgeType = svgElem.attributes['tag:type'];
if (mgeType === undefined) {
return;
}
......@@ -151,4 +151,4 @@
<input type='file' id='fileInput' style="position: fixed; top: 0; background-color: white;"></input>
</body>
</html>
\ No newline at end of file
</html>
......@@ -9,6 +9,7 @@ ARCH=arm64-v8a
REMOVE_OLD_BUILD=false
NINJA_VERBOSE=OFF
NINJA_DRY_RUN=OFF
SPECIFIED_TARGET="install/strip"
echo "EXTRA_CMAKE_ARGS: ${EXTRA_CMAKE_ARGS}"
......@@ -22,13 +23,14 @@ function usage() {
echo "-r : remove old build dir before make, default off"
echo "-v : ninja with verbose and explain, default off"
echo "-n : ninja with -n dry run (don't run commands but act like they succeeded)"
echo "-e : build a specified target (always for debug, NOTICE: do not do strip/install target when use -k)"
echo "-h : show usage"
echo "append other cmake config by export EXTRA_CMAKE_ARGS=..."
echo "example: $0 -d"
exit -1
}
while getopts "nvrkhdfa:" arg
while getopts "nvrkhdfa:e:" arg
do
case $arg in
d)
......@@ -75,6 +77,9 @@ do
echo "config NINJA_DRY_RUN=ON"
NINJA_DRY_RUN=ON
;;
e)
SPECIFIED_TARGET=$OPTARG
;;
?)
echo "unkonw argument"
usage
......@@ -86,6 +91,7 @@ echo "build config summary:"
echo "BUILD_TYPE: $BUILD_TYPE"
echo "MGE_ARMV8_2_FEATURE_FP16: $MGE_ARMV8_2_FEATURE_FP16"
echo "MGE_DISABLE_FLOAT16: $MGE_DISABLE_FLOAT16"
echo "SPECIFIED_TARGET: ${SPECIFIED_TARGET}"
echo "ARCH: $ARCH"
echo "----------------------------------------------------"
......@@ -107,7 +113,11 @@ if [ -z $NDK_ROOT ];then
fi
function cmake_build() {
BUILD_DIR=$SRC_DIR/build_dir/android/$1/$BUILD_TYPE/build
if [ $1 = "armeabi-v7a with NEON" ] ;then
BUILD_DIR=$SRC_DIR/build_dir/android/armeabi-v7a/$BUILD_TYPE/build
else
BUILD_DIR=$SRC_DIR/build_dir/android/$1/$BUILD_TYPE/build
fi
INSTALL_DIR=$BUILD_DIR/../install
BUILD_ABI=$1
BUILD_NATIVE_LEVEL=$2
......@@ -127,7 +137,7 @@ function cmake_build() {
-DCMAKE_TOOLCHAIN_FILE="$NDK_ROOT/build/cmake/android.toolchain.cmake" \
-DANDROID_NDK="$NDK_ROOT" \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DANDROID_ABI=$BUILD_ABI \
-DANDROID_ABI=\"$BUILD_ABI\" \
-DANDROID_NATIVE_API_LEVEL=$BUILD_NATIVE_LEVEL \
-DMGE_INFERENCE_ONLY=ON \
-DMGE_WITH_CUDA=OFF \
......@@ -137,9 +147,8 @@ function cmake_build() {
${EXTRA_CMAKE_ARGS} \
$SRC_DIR "
config_ninja_target_cmd ${NINJA_VERBOSE} "OFF" "" ${NINJA_DRY_RUN}
config_ninja_target_cmd ${NINJA_VERBOSE} "OFF" "${SPECIFIED_TARGET}" ${NINJA_DRY_RUN}
bash -c "${NINJA_CMD}"
${NINJA_BASE} install/strip
}
build_flatc $SRC_DIR $REMOVE_OLD_BUILD
......
......@@ -9,6 +9,7 @@ ARCH=arm64
REMOVE_OLD_BUILD=false
NINJA_VERBOSE=OFF
NINJA_DRY_RUN=OFF
SPECIFIED_TARGET="install"
echo "EXTRA_CMAKE_ARGS: ${EXTRA_CMAKE_ARGS}"
......@@ -22,13 +23,14 @@ function usage() {
echo "-r : remove old build dir before make, default off"
echo "-v : ninja with verbose and explain, default off"
echo "-n : ninja with -n dry run (don't run commands but act like they succeeded)"
echo "-e : build a specified target (always for debug, NOTICE: do not do strip/install target when use -k)"
echo "-h : show usage"
echo "append other cmake config by export EXTRA_CMAKE_ARGS=..."
echo "example: $0 -d"
exit -1
}
while getopts "nvrkhdfa:" arg
while getopts "nvrkhdfa:e:" arg
do
case $arg in
d)
......@@ -75,6 +77,9 @@ do
echo "config NINJA_DRY_RUN=ON"
NINJA_DRY_RUN=ON
;;
e)
SPECIFIED_TARGET=$OPTARG
;;
?)
echo "unkonw argument"
usage
......@@ -86,6 +91,7 @@ echo "build config summary:"
echo "BUILD_TYPE: $BUILD_TYPE"
echo "MGE_ARMV8_2_FEATURE_FP16: $MGE_ARMV8_2_FEATURE_FP16"
echo "MGE_DISABLE_FLOAT16: $MGE_DISABLE_FLOAT16"
echo "SPECIFIED_TARGET: ${SPECIFIED_TARGET}"
echo "ARCH: $ARCH"
echo "----------------------------------------------------"
......@@ -139,7 +145,7 @@ function cmake_build() {
${EXTRA_CMAKE_ARGS} \
$SRC_DIR "
config_ninja_target_cmd ${NINJA_VERBOSE} "OFF" "install" ${NINJA_DRY_RUN}
config_ninja_target_cmd ${NINJA_VERBOSE} "OFF" "${SPECIFIED_TARGET}" ${NINJA_DRY_RUN}
bash -c "${NINJA_CMD}"
}
......
......@@ -10,6 +10,7 @@ ARCH=arm64-v8a
REMOVE_OLD_BUILD=false
NINJA_VERBOSE=OFF
NINJA_DRY_RUN=OFF
SPECIFIED_TARGET="install/strip"
CMAKE_C_FLAGS="-Wno-psabi"
CMAKE_CXX_FLAGS="-Wno-psabi"
......@@ -26,13 +27,14 @@ function usage() {
echo "-r : remove old build dir before make, default off"
echo "-v : ninja with verbose and explain, default off"
echo "-n : ninja with -n dry run (don't run commands but act like they succeeded)"
echo "-e : build a specified target (always for debug, NOTICE: do not do strip/install target when use -k)"
echo "-h : show usage"
echo "append other cmake config by export EXTRA_CMAKE_ARGS=..."
echo "example: $0 -d"
exit -1
}
while getopts "nvrkhdcfa:" arg
while getopts "nvrkhdcfa:e:" arg
do
case $arg in
d)
......@@ -83,6 +85,9 @@ do
echo "config NINJA_DRY_RUN=ON"
NINJA_DRY_RUN=ON
;;
e)
SPECIFIED_TARGET=$OPTARG
;;
?)
echo "unkonw argument"
usage
......@@ -95,6 +100,7 @@ echo "BUILD_TYPE: $BUILD_TYPE"
echo "MGE_WITH_CUDA: $MGE_WITH_CUDA"
echo "MGE_ARMV8_2_FEATURE_FP16: $MGE_ARMV8_2_FEATURE_FP16"
echo "MGE_DISABLE_FLOAT16: $MGE_DISABLE_FLOAT16"
echo "SPECIFIED_TARGET: ${SPECIFIED_TARGET}"
echo "ARCH: $ARCH"
echo "----------------------------------------------------"
......@@ -155,7 +161,7 @@ function cmake_build() {
${EXTRA_CMAKE_ARGS} \
$SRC_DIR "
config_ninja_target_cmd ${NINJA_VERBOSE} "OFF" "install/strip" ${NINJA_DRY_RUN}
config_ninja_target_cmd ${NINJA_VERBOSE} "OFF" "${SPECIFIED_TARGET}" ${NINJA_DRY_RUN}
bash -c "${NINJA_CMD}"
}
......
......@@ -12,12 +12,15 @@ function usage() {
echo "-v : ninja with verbose and explain, default off"
echo "-s : Do not build develop even build with training mode, default on when build with training, always for wheel"
echo "-n : ninja with -n dry run (don't run commands but act like they succeeded)"
echo "-e : build a specified target (always for debug, NOTICE: do not do strip/install target when use -k)"
echo "-h : show usage"
echo "append other cmake config by export EXTRA_CMAKE_ARGS=..."
echo "example: $0 -d"
exit -1
}
READLINK=readlink
OS=$(uname -s)
BUILD_TYPE=Release
MGE_WITH_CUDA=OFF
MGE_INFERENCE_ONLY=ON
......@@ -28,10 +31,15 @@ REMOVE_OLD_BUILD=false
NINJA_VERBOSE=OFF
BUILD_DEVELOP=ON
NINJA_DRY_RUN=OFF
SPECIFIED_TARGET="install/strip"
if [[ $OS =~ "NT" ]]; then
echo "Windows do not support strip/install by defaut"
SPECIFIED_TARGET=""
fi
echo "EXTRA_CMAKE_ARGS: ${EXTRA_CMAKE_ARGS}"
while getopts "nsrhdctmv" arg
while getopts "nsrhdctmve:" arg
do
case $arg in
d)
......@@ -72,6 +80,9 @@ do
MGE_WINDOWS_BUILD_MARCH=m32
MGE_ARCH=i386
;;
e)
SPECIFIED_TARGET=$OPTARG
;;
?)
echo "unkonw argument"
usage
......@@ -83,9 +94,8 @@ echo "build config summary:"
echo "BUILD_TYPE: $BUILD_TYPE"
echo "MGE_WITH_CUDA: $MGE_WITH_CUDA"
echo "MGE_INFERENCE_ONLY: $MGE_INFERENCE_ONLY"
echo "SPECIFIED_TARGET: ${SPECIFIED_TARGET}"
echo "------------------------------------"
READLINK=readlink
OS=$(uname -s)
if [ $OS = "Darwin" ];then
READLINK=greadlink
......@@ -131,7 +141,7 @@ function cmake_build() {
${EXTRA_CMAKE_ARGS} \
${SRC_DIR} "
config_ninja_target_cmd ${NINJA_VERBOSE} ${BUILD_DEVELOP} "install/strip" ${NINJA_DRY_RUN}
config_ninja_target_cmd ${NINJA_VERBOSE} ${BUILD_DEVELOP} "${SPECIFIED_TARGET}" ${NINJA_DRY_RUN}
bash -c "${NINJA_CMD}"
}
......@@ -260,7 +270,7 @@ function cmake_build_windows() {
-DCMAKE_MAKE_PROGRAM=ninja.exe \
${EXTRA_CMAKE_ARGS} ../../.. "
config_ninja_target_cmd ${NINJA_VERBOSE} ${BUILD_DEVELOP} "" ${NINJA_DRY_RUN}
config_ninja_target_cmd ${NINJA_VERBOSE} ${BUILD_DEVELOP} "${SPECIFIED_TARGET}" ${NINJA_DRY_RUN}
cmd.exe /c " vcvarsall.bat $MGE_WINDOWS_BUILD_ARCH && ${NINJA_CMD} "
}
......
......@@ -69,16 +69,22 @@ function try_remove_old_build() {
}
function config_ninja_target_cmd() {
NINJA_CMD="${NINJA_BASE} all"
if [ $# -eq 4 ]; then
_NINJA_VERBOSE=$1
_BUILD_DEVELOP=$2
_INSTALL_ALL_TARGET=$3
_NINJA_TARGET=$3
_NINJA_DRY_RUN=$4
else
echo "err call config_ninja_target_cmd"
exit -1
fi
if [ -z "${_NINJA_TARGET}" ]; then
NINJA_CMD="${NINJA_BASE} all"
elif [[ ${_NINJA_TARGET} =~ "install" ]]; then
NINJA_CMD="${NINJA_BASE} all && ${NINJA_BASE} ${_NINJA_TARGET}"
else
NINJA_CMD="${NINJA_BASE} ${_NINJA_TARGET}"
fi
if [ ${_NINJA_DRY_RUN} = "ON" ]; then
NINJA_CMD="${NINJA_CMD} -d explain -n"
......@@ -90,9 +96,6 @@ function config_ninja_target_cmd() {
echo "add develop target"
NINJA_CMD="${NINJA_CMD} && ${NINJA_BASE} develop"
fi
if [ -n "${_INSTALL_ALL_TARGET}" ]; then
NINJA_CMD="${NINJA_CMD} && ${NINJA_BASE} ${_INSTALL_ALL_TARGET}"
fi
fi
echo "build ${NINJA_BASE} target command: ${NINJA_CMD}"
......
......@@ -223,7 +223,7 @@ enum class LogLevel { kInfo, kWarn, kDebug, kFatal };
void Log(LogLevel level, char const* file, int line, char const* func,
char const *fmt, ...) {
std::string new_fmt("[megwave] ");
std::string new_fmt("[wave] ");
new_fmt.append(fmt);
va_list ap;
va_start(ap, fmt);
......
......@@ -31,10 +31,10 @@ const std::string polyline =
"<polyline points=\"{}\" style=\"fill:none;stroke:{};stroke-width:{}\" "
"/>";
const std::string opr_info =
"mge:type=\"opr\" mge:id=\"{}\" mge:size=\"{}\" mge:name=\"{}\"";
"tag:type=\"opr\" tag:id=\"{}\" tag:size=\"{}\" tag:name=\"{}\"";
const std::string chunk_info =
"mge:type=\"chunk\" mge:id=\"{}\" mge:time=\"{}\" mge:addr=\"{}\" "
"mge:size=\"{}\" mge:owner_var_name=\"{}\"";
"tag:type=\"chunk\" tag:id=\"{}\" tag:time=\"{}\" tag:addr=\"{}\" "
"tag:size=\"{}\" tag:owner_var_name=\"{}\"";
const std::string animate =
"<animate attributeName=\"opacity\" from=\"0\" to=\"1\" "
"begin=\"{}.mouseover\" fill=\"freeze\" dur=\"1s\"/>\n<animate "
......@@ -316,4 +316,4 @@ std::vector<std::vector<size_t>> StaticMemRecorder::get_chunk_construct(
}
}
return chunk_ids;
}
\ No newline at end of file
}
......@@ -729,9 +729,9 @@ void GraphLoaderOSS::OprLoadContextImpl::load_single_opr(
auto registry = OprRegistry::find_by_unversioned_id(fbopr->type_id());
mgb_throw_if(!registry, SerializationError,
"failed to find opr with type %s, use "
"mgb.config.dump_registered_oprs() "
"to get a dict that maps from opr id to opr name",
"failed to find opr with type %s, use python env "
"config.dump_registered_oprs() to get a dict that maps from "
"opr id to opr name",
std::to_string(fbopr->type_id()).c_str());
// load inputs
......@@ -812,7 +812,7 @@ GraphLoader::LoadResult GraphLoaderOSS::load(const LoadConfig& config,
uint32_t magic;
m_file->read(&magic, sizeof(magic));
mgb_throw_if(magic != MGB_MAGIC, SerializationError,
"wrong magic: wanted %#08x, actual %#08x (not a MegBrain fbs "
"wrong magic: wanted %#08x, actual %#08x (not a invalid fbs "
"model?)",
MGB_MAGIC, magic);
m_file->skip(4);
......@@ -833,7 +833,7 @@ GraphLoader::LoadResult GraphLoaderOSS::load(const LoadConfig& config,
m_file->skip(tensor_begin);
mgb_throw_if(!fbs::GraphBufferHasIdentifier(m_graph_buf.data()),
SerializationError, "not a MegBrain fbs model");
SerializationError, "invalid fbs model");
{
flatbuffers::Verifier verifier(
......@@ -847,7 +847,7 @@ GraphLoader::LoadResult GraphLoaderOSS::load(const LoadConfig& config,
m_mgb_version = m_graph->mgb_version();
if (m_graph->mgb_version() > MGB_VERSION) {
mgb_log_warn(
"loading model from future MegBrain: version=%u "
"loading model from future runtime: version=%u "
"model_version=%u",
MGB_VERSION, m_graph->mgb_version());
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册