Add a ROCTX test
Change-Id: I90dab2f349ade6cbfc86f0399c8b9ca905de23b3
This commit is contained in:
کامیت شده توسط
Laurent Morichetti
والد
7ebae10571
کامیت
1e7783af58
@@ -105,6 +105,12 @@ target_link_libraries(copy hsa-runtime64::hsa-runtime64 Threads::Threads dl)
|
||||
add_dependencies(copy hsaco_targets)
|
||||
add_dependencies(mytest copy)
|
||||
|
||||
## Build the ROCTX test
|
||||
set_source_files_properties(app/roctx_test.cpp PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1)
|
||||
hip_add_executable(roctx_test EXCLUDE_FROM_ALL app/roctx_test.cpp)
|
||||
target_link_libraries(roctx_test Threads::Threads roctx)
|
||||
add_dependencies(mytest roctx_test)
|
||||
|
||||
## Copy the golden traces and test scripts
|
||||
configure_file(run.sh ${PROJECT_BINARY_DIR} COPYONLY)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink run.sh ${PROJECT_BINARY_DIR}/run_ci.sh)
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/* Copyright (c) 2022 Advanced Micro Devices, Inc.
|
||||
|
||||
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. */
|
||||
|
||||
#include <hip/hip_runtime.h>
|
||||
|
||||
#include "roctx.h"
|
||||
|
||||
__global__ void kernel() {}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
hipSetDevice(0);
|
||||
|
||||
// Not in a roctx range.
|
||||
kernel<<<1, 1>>>();
|
||||
|
||||
int ret = roctxRangePush("NestedRangeA");
|
||||
|
||||
// In a simple first level roctx range.
|
||||
kernel<<<1, 1>>>();
|
||||
|
||||
if (roctxRangePop() != ret) return -1;
|
||||
|
||||
roctxRangePush("NestedRangeB");
|
||||
roctxRangePush("NestedRangeC");
|
||||
roctx_range_id_t id = roctxRangeStart("StartStopRangeA");
|
||||
|
||||
// In a nested roctx range.
|
||||
kernel<<<1, 1>>>();
|
||||
|
||||
roctxRangePop();
|
||||
roctxRangePop();
|
||||
|
||||
std::thread thread([id]() { roctxRangeStop(id); });
|
||||
thread.join();
|
||||
|
||||
roctxRangePush("NestedRangeD");
|
||||
roctxRangePush("NestedRangeE");
|
||||
roctxRangePop();
|
||||
|
||||
// In a first level roctx range, but after a nested range.
|
||||
kernel<<<1, 1>>>();
|
||||
|
||||
if (roctxRangePop() != 0) return -1;
|
||||
|
||||
hipDeviceSynchronize();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
ROCTracer (pid=993231):
|
||||
rocTX-trace()
|
||||
0xce5450 agent cpu
|
||||
0xd1d520 agent gpu
|
||||
0xd1fe80 agent gpu
|
||||
628584618590744
|
||||
628584859661999 993231:993231 1:0:"NestedRangeA"
|
||||
628584859674021 993231:993231 2:0:""
|
||||
628584859674693 993231:993231 1:0:"NestedRangeB"
|
||||
628584859675344 993231:993231 1:0:"NestedRangeC"
|
||||
628584859676115 993231:993231 3:1:"StartStopRangeA"
|
||||
628584859678390 993231:993231 2:0:""
|
||||
628584859678921 993231:993231 2:0:""
|
||||
628584859755545 993231:993233 4:1:""
|
||||
628584859819756 993231:993231 1:0:"NestedRangeD"
|
||||
628584859820708 993231:993231 1:0:"NestedRangeE"
|
||||
628584859821219 993231:993231 2:0:""
|
||||
628584859824095 993231:993231 2:0:""
|
||||
@@ -16,3 +16,4 @@ copy_hsa_input_trace --check-events .*
|
||||
hsa_co_trace --check-none
|
||||
code_obj_trace --check-none
|
||||
trace_buffer_trace --check-none
|
||||
roctx_test_trace --check-count .*
|
||||
|
||||
+12
-2
@@ -68,6 +68,12 @@ xeval_test() {
|
||||
}
|
||||
|
||||
eval_test() {
|
||||
bright=$(tput bold)
|
||||
red=$(tput setaf 1)
|
||||
green=$(tput setaf 2)
|
||||
blue=$(tput setaf 4)
|
||||
normal=$(tput sgr0)
|
||||
|
||||
label=$1
|
||||
cmdline=$2
|
||||
test_name=$3
|
||||
@@ -98,9 +104,9 @@ eval_test() {
|
||||
fi
|
||||
fi
|
||||
if [ $is_failed = 0 ] ; then
|
||||
echo "$test_name: PASSED"
|
||||
echo "${bright}${blue}$test_name: ${green}PASSED${normal}"
|
||||
else
|
||||
echo "$test_name: FAILED"
|
||||
echo "${bright}${blue}$test_name: ${red}FAILED${normal}"
|
||||
failed_tests="$failed_tests\n $test_number: $test_name - \"$label\""
|
||||
test_status=$(($test_status + 1))
|
||||
fi
|
||||
@@ -124,6 +130,10 @@ eval_test "standalone HIP MGPU test" "./test/MatrixTranspose_mgpu" MatrixTranspo
|
||||
# rocTracer/tool is loaded by HSA runtime
|
||||
export HSA_TOOLS_LIB="$ROCTRACER_LIB_PATH/libroctracer64.so $ROCTRACER_TOOL_PATH/libroctracer_tool.so"
|
||||
|
||||
# ROCTX test
|
||||
export ROCTRACER_DOMAIN="roctx"
|
||||
eval_test "roctx test" ./test/roctx_test roctx_test_trace
|
||||
|
||||
# SYS test
|
||||
export ROCTRACER_DOMAIN="sys:roctx"
|
||||
eval_test "tool SYS test" ./test/MatrixTranspose MatrixTranspose_sys_trace
|
||||
|
||||
مرجع در شماره جدید
Block a user