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

Fix memory leak in roctxRangePushA #75

Open
wants to merge 49 commits into
base: amd-master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
6fffa50
optimized tool stats;
Aug 11, 2020
db1ccb0
flush-rate option fixed;
Aug 15, 2020
dae98a3
Format ostream ops;
Aug 28, 2020
b730da0
Fix for trace checker
rkebichi Sep 11, 2020
4c2b6cb
codeobj tracing prof protocol
Sep 19, 2020
35bc1e9
gen_ostream_ops.py fix - ostream operators as inline static
Sep 9, 2020
5bf3efa
build normalizing - generating under build directory
Sep 7, 2020
401c48b
testing using v3 object
Sep 17, 2020
96ea2d6
HCC_HOME env cleanup
Sep 11, 2020
28e4b8e
SWDEV-253997 : packaging fix: installing hsa_ostream_ops.h
Sep 25, 2020
367e2c4
SWDEV-251491 : gen_ostream_ops.py porting to python3
Oct 1, 2020
fb0c230
SWDEV-249924 : hip correlation id explicite propogation; tracer debug…
Sep 22, 2020
8bb2d30
SWDEV-258731 : cleanup
Oct 30, 2020
9f02bb9
Add RUNPATH to libtracer_tool.so
pruthvistony-amd Jun 5, 2020
73fb6ea
CMakeList.txt: conformant package names
nelsonc-amd Oct 16, 2020
0876c25
SWDEV-251491 : disabling hipModuleUnload tracing which is called on exit
Oct 1, 2020
18c83ea
hip library loader check
Sep 23, 2020
d8d7137
SWDEV-213367 : codeobj event implementation
Sep 3, 2020
c163244
SWDEV-254329 : extending debug trace with timestamps, cmake option '-…
Oct 13, 2020
2293663
code obj tests: adding load base
Oct 15, 2020
68b1850
SWDEV-255938 NEW - added regex and depth support to ostream ops
rkebichi Nov 18, 2020
ff8ac19
adding tests dry run to check if platform is in working state
Nov 23, 2020
d4cd091
Adding dumping of HSA handles
Nov 3, 2020
bf70a1a
SWDEV-264282 : fixing tracer_tool linking
Dec 10, 2020
bfb9095
calling python3 explictely
Dec 10, 2020
3c1a4b3
SWDEV-259683 HIP API records filtering
rkebichi Nov 18, 2020
36b1b2f
SWDEV-251491 : disabling tracing on exit
Dec 22, 2020
7ea1e9a
SWDEV-251491 : fixing tracing on exit
Dec 25, 2020
2a64bd0
SWDEV-271503 Fixed core dump
rkebichi Mar 25, 2021
89ab109
SWDEV-281008 replace hcc_detail by amd_detail
rkebichi Apr 14, 2021
e723f8c
Add dependency on rocm-core
amd-isparry Jul 7, 2021
f7adedb
SWDEV-281658 - Preserve the callback IDs enum ordering
chrispaquot Jun 21, 2021
c5c5e5d
Merge remote-tracking branch 'remotes/origin/amd-staging' into amd-ma…
Aug 3, 2021
ddb44e4
Merge remote-tracking branch 'remotes/origin/amd-staging' into amd-ma…
Aug 14, 2021
776eac1
Merge remote-tracking branch 'remotes/origin/amd-staging' into amd-ma…
Sep 2, 2021
fba52e8
Merge remote-tracking branch 'remotes/origin/amd-staging' into amd-ma…
Oct 20, 2021
f32619b
updating known issues
ammarwa Oct 28, 2021
bd6d6d3
Merge remote-tracking branch 'remotes/origin/amd-staging' into amd-ma…
Nov 22, 2021
38a1972
SWDEV-318551: Adding License file for tracer
ammarwa Jan 21, 2022
c3cbdea
Merge remote-tracking branch 'remotes/origin/amd-staging' into amd-ma…
Feb 3, 2022
da12ec5
Merge remote-tracking branch 'remotes/origin/amd-staging' into amd-ma…
Feb 7, 2022
1668617
Update README.md
ammarwa Feb 9, 2022
f6db80c
Merge branch 'amd-master' into rocm-5.0.x
ammarwa Feb 9, 2022
a19a826
SWDEV-291455: Prefer rocm include path to hip include path
raramakr Feb 14, 2022
38397cb
Merge remote-tracking branch 'remotes/origin/amd-staging' into amd-ma…
Feb 16, 2022
7f02d6e
Merge tag 'rocm-5.1.0' into amd-master
ammarwa Mar 30, 2022
75f74bb
SWDEV-307394: Fixing Download HSA-Class Issue
ammarwa Mar 29, 2022
f935048
Merge remote-tracking branch 'origin/rocm-5.1.x' into amd-master
ammarwa May 20, 2022
82ceb54
Fix memory leak in roctxRangePushA
MrBurmark Jun 10, 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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
*.swp
*.Po
build
test/hsa
test/MatrixTranspose/MatrixTranspose
test/MatrixTranspose_test/MatrixTranspose
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ else()
endif()
message ( "Using CPACK_DEBIAN_PACKAGE_RELEASE ${CPACK_DEBIAN_PACKAGE_RELEASE}" )
set ( CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT" )
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "rocm-core" )
## Process the Debian install/remove scripts to update the CPACK variables
configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/DEBIAN/postinst.in DEBIAN/postinst @ONLY )
configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/DEBIAN/prerm.in DEBIAN/prerm @ONLY )
Expand All @@ -221,7 +222,14 @@ if ( PROC_RESULT EQUAL "0" AND NOT EVAL_RESULT STREQUAL "" )
string ( APPEND CPACK_RPM_PACKAGE_RELEASE "%{?dist}" )
endif()
set ( CPACK_RPM_FILE_NAME "RPM-DEFAULT" )
set ( CPACK_RPM_PACKAGE_REQUIRES "rocm-core" )
message("CPACK_RPM_PACKAGE_RELEASE: ${CPACK_RPM_PACKAGE_RELEASE}")

if(NOT ROCM_DEP_ROCMCORE)
string(REGEX REPLACE ",? ?rocm-core" "" CPACK_RPM_PACKAGE_REQUIRES ${CPACK_RPM_PACKAGE_REQUIRES})
string(REGEX REPLACE ",? ?rocm-core" "" CPACK_DEBIAN_PACKAGE_DEPENDS ${CPACK_DEBIAN_PACKAGE_DEPENDS})
endif()

## Process the Rpm install/remove scripts to update the CPACK variables
configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/RPM/post.in" RPM/post @ONLY )
configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/RPM/postun.in" RPM/postun @ONLY )
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ rocTX API:

- To build roctracer library:
export CMAKE_BUILD_TYPE=<debug|release> # release by default

cd <your path>/roctracer && mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=/opt/rocm .. && make -j <nproc>
or
./build.sh

- To build and run test:
make mytest
Expand Down
2 changes: 1 addition & 1 deletion src/core/roctracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ static inline uint32_t get_op_end(uint32_t domain) {
case ACTIVITY_DOMAIN_HSA_API: return HSA_API_ID_NUMBER;
case ACTIVITY_DOMAIN_HSA_EVT: return HSA_EVT_ID_NUMBER;
case ACTIVITY_DOMAIN_HCC_OPS: return HIP_OP_ID_NUMBER;
case ACTIVITY_DOMAIN_HIP_API: return HIP_API_ID_LAST + 1;;
case ACTIVITY_DOMAIN_HIP_API: return HIP_API_ID_LAST + 1;
case ACTIVITY_DOMAIN_EXT_API: return 0;
case ACTIVITY_DOMAIN_ROCTX: return ROCTX_API_ID_NUMBER;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/roctx/roctx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ PUBLIC_API int roctxRangePushA(const char* message) {
void* api_callback_arg = NULL;
roctx::cb_table.get(ROCTX_API_ID_roctxRangePushA, &api_callback_fun, &api_callback_arg);
if (api_callback_fun) api_callback_fun(ACTIVITY_DOMAIN_ROCTX, ROCTX_API_ID_roctxRangePushA, &api_data, api_callback_arg);
roctx::message_stack->push(strdup(message));
roctx::message_stack->emplace(message);

return roctx::message_stack->size() - 1;
API_METHOD_CATCH(-1);
Expand Down
3 changes: 0 additions & 3 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ endif ()

## Path to HSA test
set ( HSA_TEST_DIR "${TEST_DIR}/hsa/test" )
set ( HSA_REV "f8b3870" )

## test run script
set ( RUN_SCRIPT "${TEST_DIR}/run.sh" )
Expand All @@ -70,8 +69,6 @@ add_custom_target( mytest
)

## Build HSA test
execute_process ( COMMAND sh -xc "if [ ! -e ${TEST_DIR}/hsa ] ; then git clone https://github.com/ROCmSoftwarePlatform/hsa-class.git ${TEST_DIR}/hsa; fi" )
execute_process ( COMMAND sh -xc "if [ -e ${TEST_DIR}/hsa ] ; then cd ${TEST_DIR}/hsa && git fetch origin && git checkout ${HSA_REV}; fi" )
set ( TMP ${TEST_DIR} )
set ( TEST_DIR ${HSA_TEST_DIR} )
add_subdirectory ( ${HSA_TEST_DIR} ${PROJECT_BINARY_DIR}/test/hsa )
Expand Down
20 changes: 20 additions & 0 deletions test/hsa/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
[MITx11 license]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
4 changes: 4 additions & 0 deletions test/hsa/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# HSA-class
```
HSA high level C++ API
```
80 changes: 80 additions & 0 deletions test/hsa/script/build_kernel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/bin/sh -x
SO_EXT="hsaco"

TEST_NAME=$1
DST_DIR=$2
ROCM_DIR=$3
TGT_LIST=$4

if [ -z "$TEST_NAME" ] ; then
echo "Usage: $0 <test name> <dst dir>"
echo " Will look for <test name>.cl and will build <test name>.$SO_EXT dynamic code object library"
exit 1
fi
OBJ_NAME=$(echo "_$(basename $TEST_NAME)" | sed -e 's/_./\U&\E/g' -e 's/_//g')

if [ -z "$DST_DIR" ] ; then
DST_DIR=$(dirname TEST_NAME)
fi

if [ -z "$ROCM_DIR" ] ; then
ROCM_DIR=/opt/rocm
fi

if [ -z "$TGT_LIST" ] ; then
TGT_LIST=`$ROCM_DIR/bin/rocminfo | grep "amdgcn-amd-amdhsa--" | head -n 1 | sed -n "s/^.*amdgcn-amd-amdhsa--\(\w*\).*$/\1/p"`
fi

if [ -z "$TGT_LIST" ] ; then
echo "Error: GPU targets not found"
exit 1
fi

OCL_VER="2.0"

if [ -e $ROCM_DIR/llvm ] ; then
LLVM_DIR=$ROCM_DIR/llvm
LIB_DIR=$ROCM_DIR/lib
else
LLVM_DIR=$ROCM_DIR/hcc
LIB_DIR=$LLVM_DIR/lib
fi

# Determine whether using new or old device-libs layout
if [ -e $LIB_DIR/bitcode/opencl.amdgcn.bc ]; then
BC_DIR=$LIB_DIR/bitcode
elif [ -e $LIB_DIR/opencl.amdgcn.bc ]; then
BC_DIR=$LIB_DIR
elif [ -e $ROCM_DIR/amdgcn/bitcode/opencl.bc ]; then
BC_DIR=$ROCM_DIR/amdgcn/bitcode
else
echo "Error: Cannot find amdgcn bitcode directory"
exit 1
fi

CLANG_ROOT=$LLVM_DIR/lib/clang
CLANG_DIR=`ls -d $CLANG_ROOT/* | head -n 1`
if [ "$CLANG_DIR" = "" ] ; then
echo "Error: LLVM clang library was not found"
exit 1
fi

BIN_DIR=$LLVM_DIR/bin
INC_DIR=$CLANG_DIR/include
if [ -e $BC_DIR/opencl.amdgcn.bc ]; then
BITCODE_OPTS="-nogpulib \
-Xclang -mlink-bitcode-file -Xclang $BC_DIR/opencl.amdgcn.bc \
-Xclang -mlink-bitcode-file -Xclang $BC_DIR/ockl.amdgcn.bc \
-Xclang -mlink-bitcode-file -Xclang $BC_DIR/ocml.amdgcn.bc"
else
BITCODE_OPTS="--hip-device-lib-path=$BC_DIR"
fi

for GFXIP in $TGT_LIST ; do
OBJ_PREF=$GFXIP
OBJ_FILE="${OBJ_PREF}_${OBJ_NAME}.$SO_EXT"
$BIN_DIR/clang -cl-std=CL$OCL_VER -include $INC_DIR/opencl-c.h $BITCODE_OPTS -target amdgcn-amd-amdhsa -mcpu=$GFXIP $TEST_NAME.cl -o $DST_DIR/$OBJ_FILE
echo "'$OBJ_FILE' generated"
done

exit 0
Loading