diff --git a/projects/roctracer/cmake_modules/env.cmake b/projects/roctracer/cmake_modules/env.cmake index def9e3d184..87cead11fb 100644 --- a/projects/roctracer/cmake_modules/env.cmake +++ b/projects/roctracer/cmake_modules/env.cmake @@ -36,7 +36,6 @@ add_definitions ( -DLITTLEENDIAN_CPU=1 ) add_definitions ( -DHSA_LARGE_MODEL= ) add_definitions ( -DHSA_DEPRECATED= ) add_definitions ( -D__HIP_PLATFORM_HCC__ ) -add_definitions ( -DHIP_PROF_HIP_API_STRING=1 ) ## Linux Compiler options set ( CMAKE_CXX_FLAGS "-std=c++11") @@ -66,12 +65,21 @@ if ( DEFINED ENV{CMAKE_DEBUG_TRACE} ) add_definitions ( -DDEBUG_TRACE=1 ) endif() +if ( NOT DEFINED HIP_API_STRING ) + set ( HIP_API_STRING 0 ) +endif() +add_definitions ( -DHIP_PROF_HIP_API_STRING=${HIP_API_STRING} ) + ## Enable HIP_VDI mode -if ( DEFINED HIP_VDI ) - add_definitions ( -DHIP_VDI=${HIP_VDI} ) -else() +if ( NOT DEFINED HIP_VDI ) set ( HIP_VDI 0 ) endif() +add_definitions ( -DHIP_VDI=${HIP_VDI} ) +if ( "${HIP_VDI}" STREQUAL "1" ) + set ( HIP_DEFINES "-D__HIP_ROCclr__=1" ) +else() + set ( HIP_DEFINES "-D__HIP_PLATFORM_HCC__=1") +endif() ## Enable HIP/HCC local build if ( DEFINED LOCAL_BUILD ) diff --git a/projects/roctracer/src/CMakeLists.txt b/projects/roctracer/src/CMakeLists.txt index efbed37c8f..4de5e5b333 100644 --- a/projects/roctracer/src/CMakeLists.txt +++ b/projects/roctracer/src/CMakeLists.txt @@ -23,7 +23,7 @@ set ( KFD_LIB_SRC ) execute_process ( COMMAND sh -xc "${CMAKE_CXX_COMPILER} -E ${HSA_KMT_INC_PATH}/hsakmttypes.h > ${PROJECT_BINARY_DIR}/hsakmttypes_pp.h" ) execute_process ( COMMAND sh -xc "${ROOT_DIR}/script/gen_ostream_ops.py -in ${PROJECT_BINARY_DIR}/hsakmttypes_pp.h -out ${ROOT_DIR}/inc/kfd_ostream_ops.h" ) -execute_process ( COMMAND sh -xc "${CMAKE_C_COMPILER} -D__HIP_PLATFORM_HCC__ -I${HIP_PATH}/include -I${CMAKE_PREFIX_PATH}/hsa/include -E ${HIP_PATH}/include/hip/hip_runtime_api.h > ${PROJECT_BINARY_DIR}/hip_runtime_api_pp.h" ) +execute_process ( COMMAND sh -xc "${CMAKE_C_COMPILER} ${HIP_DEFINES} -I${HIP_PATH}/include -I${CMAKE_PREFIX_PATH}/hsa/include -E ${HIP_PATH}/include/hip/hip_runtime_api.h > ${PROJECT_BINARY_DIR}/hip_runtime_api_pp.h" ) execute_process ( COMMAND sh -xc "${ROOT_DIR}/script/gen_ostream_ops.py -in ${PROJECT_BINARY_DIR}/hip_runtime_api_pp.h -out ${ROOT_DIR}/inc/hip_ostream_ops.h" ) add_library ( ${KFD_LIB} SHARED ${KFD_LIB_SRC} ) target_include_directories ( ${KFD_LIB} PRIVATE ${LIB_DIR} ${ROOT_DIR} ${ROOT_DIR}/inc ${HSA_RUNTIME_INC_PATH} ${HSA_RUNTIME_HSA_INC_PATH} ${HSA_KMT_INC_PATH} ) diff --git a/projects/roctracer/test/tool/tracer_tool.cpp b/projects/roctracer/test/tool/tracer_tool.cpp index 65ff06ebfd..b4a0064a72 100644 --- a/projects/roctracer/test/tool/tracer_tool.cpp +++ b/projects/roctracer/test/tool/tracer_tool.cpp @@ -450,6 +450,15 @@ void hip_api_flush_cb(hip_api_trace_entry_t* entry) { (uint32_t)(data->args.hipMemcpy.sizeBytes), (uint32_t)(data->args.hipMemcpy.kind)); break; + case HIP_API_ID_hipMemcpyAsync: + fprintf(hip_api_file_handle, "%s(dst(%p) src(%p) size(0x%x) kind(%u) stream(%p))\n", + oss.str().c_str(), + data->args.hipMemcpyAsync.dst, + data->args.hipMemcpyAsync.src, + (uint32_t)(data->args.hipMemcpyAsync.sizeBytes), + (uint32_t)(data->args.hipMemcpyAsync.kind), + data->args.hipMemcpyAsync.stream); + break; case HIP_API_ID_hipMalloc: fprintf(hip_api_file_handle, "%s(ptr(%p) size(0x%x))\n", oss.str().c_str(), @@ -462,15 +471,25 @@ void hip_api_flush_cb(hip_api_trace_entry_t* entry) { data->args.hipFree.ptr); break; case HIP_API_ID_hipModuleLaunchKernel: - case HIP_API_ID_hipExtModuleLaunchKernel: -#if !HIP_VDI - case HIP_API_ID_hipHccModuleLaunchKernel: -#endif fprintf(hip_api_file_handle, "%s(kernel(%s) stream(%p))\n", oss.str().c_str(), cxx_demangle(entry->name), data->args.hipModuleLaunchKernel.stream); break; + case HIP_API_ID_hipExtModuleLaunchKernel: + fprintf(hip_api_file_handle, "%s(kernel(%s) stream(%p))\n", + oss.str().c_str(), + cxx_demangle(entry->name), + data->args.hipExtModuleLaunchKernel.hStream); + break; +#if !HIP_VDI + case HIP_API_ID_hipHccModuleLaunchKernel: + fprintf(hip_api_file_handle, "%s(kernel(%s) stream(%p))\n", + oss.str().c_str(), + cxx_demangle(entry->name), + data->args.hipHccModuleLaunchKernel.hStream); + break; +#endif default: fprintf(hip_api_file_handle, "%s()\n", oss.str().c_str()); }