Fix using ATP markers

Change-Id: If2d04f80b580237426c569737551e2001a8cd35a
This commit is contained in:
Maneesh Gupta
2016-07-21 16:02:51 +05:30
والد 7d5cffdc17
کامیت dffed956fb
4فایلهای تغییر یافته به همراه32 افزوده شده و 15 حذف شده
+16 -2
مشاهده پرونده
@@ -98,6 +98,15 @@ if(NOT DEFINED BUILD_CLANG_HIPIFY)
endif()
endif()
# Check if we need to enable ATP marker
if(NOT DEFINED COMPILE_HIP_ATP_MARKER)
if(NOT DEFINED ENV{COMPILE_HIP_ATP_MARKER})
set(COMPILE_HIP_ATP_MARKER 0)
else()
set(COMPILE_HIP_ATP_MARKER $ENV{COMPILE_HIP_ATP_MARKER})
endif()
endif()
#############################
# Build steps
#############################
@@ -109,13 +118,18 @@ endif()
# Build hip_hcc if platform is hcc
if(HIP_PLATFORM STREQUAL "hcc")
include_directories(${PROJECT_SOURCE_DIR}/include)
if(COMPILE_HIP_ATP_MARKER)
include_directories(/opt/rocm/profiler/CXLActivityLogger/include)
set(CMAKE_CXX_FLAGS " -DCOMPILE_HIP_ATP_MARKER=1 ${CMAKE_CXX_FLAGS}")
set(CMAKE_C_FLAGS " -DCOMPILE_HIP_ATP_MARKER=1 ${CMAKE_C_FLAGS}")
endif()
set(CMAKE_CXX_COMPILER "${HCC_HOME}/bin/hcc")
set(CMAKE_C_COMPILER "${HCC_HOME}/bin/hcc")
# Set HIP_HCC so we know this is HIP compile, some files are shared with HCC (staging_buffer).
set(CMAKE_CXX_FLAGS " -hc -I${HCC_HOME}/include -I${HSA_PATH}/include -I/opt/rocm/libhsakmt/include/libhsakmt -stdlib=libc++ -DHIP_HCC")
set(CMAKE_C_FLAGS " -hc -I${HCC_HOME}/include -I${HSA_PATH}/include -I/opt/rocm/libhsakmt/include/libhsakmt -stdlib=libc++ -DHIP_HCC")
set(CMAKE_CXX_FLAGS " -hc -I${HCC_HOME}/include -I${HSA_PATH}/include -I/opt/rocm/libhsakmt/include/libhsakmt -stdlib=libc++ -DHIP_HCC ${CMAKE_CXX_FLAGS}")
set(CMAKE_C_FLAGS " -hc -I${HCC_HOME}/include -I${HSA_PATH}/include -I/opt/rocm/libhsakmt/include/libhsakmt -stdlib=libc++ -DHIP_HCC ${CMAKE_C_FLAGS}")
set(SOURCE_FILES src/device_util.cpp
src/hip_hcc.cpp
+14 -11
مشاهده پرونده
@@ -31,10 +31,6 @@ $verbose = 0 unless defined $verbose;
$HIP_PATH=$ENV{'HIP_PATH'};
$HIP_PATH=dirname (dirname $0) unless defined $HIP_PATH; # use parent directory of hipcc
$CODEXL_PATH = $ENV{'CODEXL_PATH'};
$CODEXL_PATH = "/opt/AMD/CodeXL" unless defined $CODEXL_PATH;
$marker_path = "$CODEXL_PATH/SDK/AMDTActivityLogger";
#---
#HIP_PLATFORM controls whether to use NVCC or HCC for compilation:
$HIP_PLATFORM= `$HIP_PATH/bin/hipconfig --platform`;
@@ -60,6 +56,11 @@ if ($HIP_PLATFORM eq "hcc") {
$ROCM_PATH=$ENV{'ROCM_PATH'};
$ROCM_PATH="/opt/rocm" unless defined $ROCM_PATH;
$HIP_ATP_MARKER=$ENV{'HIP_ATP_MARKER'};
if ($HIP_ATP_MARKER) {
$marker_path = "$ROCM_PATH/profiler/CXLActivityLogger";
}
$ROCM_TARGET=$ENV{'ROCM_TARGET'};
$ROCM_TARGET="fiji" unless defined $ROCM_TARGET;
@@ -97,14 +98,16 @@ if ($HIP_PLATFORM eq "hcc") {
# Add trace marker library:
# TODO - once we cleanly separate the HIP API headers from HIP library headers this logic should move to CMakebuild option - apps do not need to see the marker library.
$marker_inc_path = "$marker_path/include";
if (-e $marker_inc_path) {
$HIPCXXFLAGS .= " -I$marker_inc_path";
}
if ($HIP_ATP_MARKER) {
$marker_inc_path = "$marker_path/include";
if (-e $marker_inc_path) {
$HIPCXXFLAGS .= " -I$marker_inc_path";
}
$marker_lib_path = "$marker_path/bin/x86_64";
if (-e $marker_lib_path) {
$HIPLDFLAGS .= " -L$marker_lib_path -lAMDTActivityLogger";
$marker_lib_path = "$marker_path/bin/x86_64";
if (-e $marker_lib_path) {
$HIPLDFLAGS .= " -L$marker_lib_path -lCXLActivityLogger -Wl,--rpath=$marker_lib_path";
}
}
# Add C++ libs for GCC.
@@ -130,7 +130,7 @@ class ihipDevice_t;
// TODO - currently we print the trace message at the beginning. if we waited, we could also include return codes, and any values returned
// through ptr-to-args (ie the pointers allocated by hipMalloc).
#if COMPILE_HIP_ATP_MARKER
#include "AMDTActivityLogger.h"
#include "CXLActivityLogger.h"
#define SCOPED_MARKER(markerName,group,userString) amdtScopedMarker(markerName, group, userString)
#else
// Swallow scoped markers:
+1 -1
مشاهده پرونده
@@ -934,7 +934,7 @@ static hsa_status_t findCpuAgent(hsa_agent_t agent, void *data)
void ihipInit()
{
#if COMPILE_TRACE_MARKER
#if COMPILE_HIP_ATP_MARKER
amdtInitializeActivityLogger();
amdtScopedMarker("ihipInit", "HIP", NULL);
#endif