Skip to content

Commit

Permalink
[Feature](mlu-ops): Add -p(readperf) compile option (#1073)
Browse files Browse the repository at this point in the history
  • Loading branch information
mahxn0 authored Aug 16, 2024
1 parent 31303ea commit 35c0514
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ set(MLUOP_BUILD_SPECIFIC_OP ${MLUOP_BUILD_SPECIFIC_OP})
message("-- MLUOP_BUILD_SPECIFIC_OP=${MLUOP_BUILD_SPECIFIC_OP}")
set(MLUOP_MLU_ARCH_LIST ${MLUOP_MLU_ARCH_LIST})
message("-- MLUOP_MLU_ARCH_LIST=${MLUOP_MLU_ARCH_LIST}")
set(MLUOP_BUILD_PERF ${MLUOP_BUILD_PERF})
message("-- MLUOP_BUILD_PERF=${MLUOP_BUILD_PERF}")

################################################################################
# Environment and BANG Setup
Expand All @@ -32,6 +34,15 @@ if(${MLUOP_BUILD_COVERAGE_TEST} MATCHES "ON")
set(BANG_CNCC_FLAGS "${BANG_CNCC_FLAGS} -fprofile-instr-generate -fcoverage-mapping -D COVERAGE")
endif()

################################################################################
# Add readperf
################################################################################
if(MLUOP_BUILD_PERF)
set(BANG_CNCC_FLAGS "${BANG_CNCC_FLAGS} -fbang-instrument-kernels")
set(BANG_CNCC_FLAGS "${BANG_CNCC_FLAGS} -DMLUOP_BANG_PERF")
add_compile_definitions(MLUOP_BANG_PERF)
endif()

################################################################################
# ASAN Check and memcheck
################################################################################
Expand Down
11 changes: 10 additions & 1 deletion independent_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ PROG_NAME=$(basename $0) # current script filename, DO NOT EDIT
export MLUOP_MLU_ARCH_LIST="${MLUOP_MLU_ARCH_LIST}"
export BUILD_MODE=${BUILD_MODE:-release} # release/debug
export MLUOP_BUILD_COVERAGE_TEST=${MLUOP_BUILD_COVERAGE_TEST:-OFF} # ON/OFF coverage mode
export MLUOP_BUILD_PERF=${MLUOP_BUILD_PERF:-OFF} #ON/OFF perf mode
export MLUOP_BUILD_ASAN_CHECK=${MLUOP_BUILD_ASAN_CHECK:-OFF} # ON/OFF Address Sanitizer (ASan)
export MLUOP_BUILD_BANG_MEMCHECK=${MLUOP_BUILD_BANG_MEMCHECK:-OFF} # ON/OFF bang memcheck
export MLUOP_BUILD_PREPARE=${MLUOP_BUILD_PREPARE:-ON}
Expand All @@ -35,8 +36,9 @@ short_args=(
c # coverage
h # help
d # debug
t: # release
t: # release
j: # jobs
p # perf
)
# setup long options, follow alphabetical order
long_args=(
Expand All @@ -50,6 +52,7 @@ long_args=(
mlu370 # mlu arch
mlu590
no_prepare
perf
prepare
disable-gtest
enable-static
Expand Down Expand Up @@ -123,6 +126,7 @@ usage () {
echo " --filter=* Build specified OP only (string with ';' separated)"
echo " -j N, --jobs=N Build for N parallel jobs."
echo " --no_prepare Skip dependency download."
echo " -p, --perf Build mlu kernel with readperf"
echo " --prepare Dependency download only."
echo " -t Build to release."
echo
Expand Down Expand Up @@ -350,6 +354,10 @@ if [ $# != 0 ]; then
export MLUOP_BUILD_PREPARE="OFF"
prog_log_note "Skip dependency download."
;;
-p | --perf)
shift
export MLUOP_BUILD_PERF="ON"
;;
--prepare)
shift
export MLUOP_BUILD_PREPARE_ONLY="ON"
Expand Down Expand Up @@ -457,6 +465,7 @@ pushd ${BUILD_PATH} > /dev/null
${CMAKE} ../ -DCMAKE_BUILD_TYPE="${BUILD_MODE}" \
-DNEUWARE_HOME="${NEUWARE_HOME}" \
-DMLUOP_BUILD_COVERAGE_TEST="${MLUOP_BUILD_COVERAGE_TEST}" \
-DMLUOP_BUILD_PERF="${MLUOP_BUILD_PERF}" \
-DBUILD_VERSION="${BUILD_VERSION}" \
-DMAJOR_VERSION="${MAJOR_VERSION}" \
-DMLUOP_BUILD_ASAN_CHECK="${MLUOP_BUILD_ASAN_CHECK}" \
Expand Down

0 comments on commit 35c0514

Please sign in to comment.