HIP: Heterogenous-computing Interface for Portability
Macros | Functions | Variables
hip_hcc.cpp File Reference
#include <assert.h>
#include <stdint.h>
#include <iostream>
#include <sstream>
#include <list>
#include <sys/types.h>
#include <unistd.h>
#include <deque>
#include <vector>
#include <algorithm>
#include <atomic>
#include <hc.hpp>
#include <hc_am.hpp>
#include "hsa/hsa_ext_amd.h"
#include "hip/hip_runtime.h"
#include "hip_hcc_internal.h"
#include "trace_helper.h"
#include "env.h"

Macros

#define ErrorCheck(x)   error_check(x, __LINE__, __FILE__)
 
#define DeviceErrorCheck(x)   if (x != HSA_STATUS_SUCCESS) { return hipErrorInvalidDevice; }
 
#define CASE_STRING(X)   case X: return #X ;break;
 

Functions

std::string HIP_TRACE_API_COLOR ("green")
 
std::atomic< int > g_lastShortTid (1)
 
void recordApiTrace (std::string *fullStr, const std::string &apiStr)
 
ihipDevice_tihipGetDevice (int deviceIndex)
 
ihipCtx_tihipGetPrimaryCtx (unsigned deviceIndex)
 
void ihipSetTlsDefaultCtx (ihipCtx_t *ctx)
 
ihipCtx_tihipGetTlsDefaultCtx ()
 
hipError_t ihipSynchronize (void)
 
void error_check (hsa_status_t hsa_error_code, int line_num, std::string str)
 
hsa_status_t FindGpuDevice (hsa_agent_t agent, void *data)
 
hsa_status_t GetDevicePool (hsa_amd_memory_pool_t pool, void *data)
 
int checkAccess (hsa_agent_t agent, hsa_amd_memory_pool_t pool)
 
hsa_status_t get_region_info (hsa_region_t region, void *data)
 
std::string HIP_DB_string (unsigned db)
 
std::string HIP_DB_callback (void *var_ptr, const char *envVarString)
 
std::string HIP_VISIBLE_DEVICES_callback (void *var_ptr, const char *envVarString)
 
void parseTrigger (std::string triggerString, std::vector< ProfTrigger > &profTriggers)
 
void HipReadEnv ()
 
void ihipInit ()
 
hipStream_t ihipSyncAndResolveStream (hipStream_t stream)
 
void ihipPrintKernelLaunch (const char *kernelName, const grid_launch_parm *lp, const hipStream_t stream)
 
hipStream_t ihipPreLaunchKernel (hipStream_t stream, dim3 grid, dim3 block, grid_launch_parm *lp, const char *kernelNameStr)
 
hipStream_t ihipPreLaunchKernel (hipStream_t stream, size_t grid, dim3 block, grid_launch_parm *lp, const char *kernelNameStr)
 
hipStream_t ihipPreLaunchKernel (hipStream_t stream, dim3 grid, size_t block, grid_launch_parm *lp, const char *kernelNameStr)
 
hipStream_t ihipPreLaunchKernel (hipStream_t stream, size_t grid, size_t block, grid_launch_parm *lp, const char *kernelNameStr)
 
void ihipPostLaunchKernel (const char *kernelName, hipStream_t stream, grid_launch_parm &lp)
 
const char * ihipErrorString (hipError_t hip_error)
 
const char * hipMemcpyStr (unsigned memKind)
 
const char * hcMemcpyStr (hc::hcCommandKind memKind)
 
void printPointerInfo (unsigned dbFlag, const char *tag, const void *ptr, const hc::AmPointerInfo &ptrInfo)
 
void tailorPtrInfo (hc::AmPointerInfo *ptrInfo, const void *ptr, size_t sizeBytes)
 
bool getTailoredPtrInfo (hc::AmPointerInfo *ptrInfo, const void *ptr, size_t sizeBytes)
 
hipError_t hipProfilerStart ()
 Start recording of profiling information When using this API, start the profiler with profiling disabled. (–startdisabled) More...
 
hipError_t hipProfilerStop ()
 Stop recording of profiling information. When using this API, start the profiler with profiling disabled. (–startdisabled) More...
 
hipError_t hipHccGetAccelerator (int deviceId, hc::accelerator *acc)
 
hipError_t hipHccGetAcceleratorView (hipStream_t stream, hc::accelerator_view **av)
 

Variables

const int release = 1
 
const char * API_COLOR = KGRN
 
const char * API_COLOR_END = KNRM
 
int HIP_LAUNCH_BLOCKING = 0
 
std::string HIP_LAUNCH_BLOCKING_KERNELS
 
std::vector< std::string > g_hipLaunchBlockingKernels
 
int HIP_API_BLOCKING = 0
 
int HIP_PRINT_ENV = 0
 
int HIP_TRACE_API = 0
 
int HIP_PROFILE_API = 0
 
std::string HIP_DB_START_API
 
std::string HIP_DB_STOP_API
 
int HIP_DB = 0
 
int HIP_VISIBLE_DEVICES = 0
 
int HIP_WAIT_MODE = 0
 
int HIP_FORCE_P2P_HOST = 0
 
int HIP_FAIL_SOC = 0
 
int HIP_DENY_PEER_ACCESS = 0
 
int HIP_HIDDEN_FREE_MEM = 256
 
int HIP_FORCE_SYNC_COPY = 0
 
int HIP_EVENT_SYS_RELEASE =1
 
int HIP_COHERENT_HOST_ALLOC = 0
 
int HIP_SYNC_HOST_ALLOC = 1
 
int HIP_SYNC_NULL_STREAM = 0
 
int HCC_OPT_FLUSH = 1
 
std::once_flag hip_initialized
 
ihipDevice_t ** g_deviceArray
 
bool g_visible_device = false
 
unsigned g_deviceCnt
 
std::vector< int > g_hip_visible_devices
 
hsa_agent_t g_cpu_agent
 
hsa_agent_t * g_allAgents
 
unsigned g_numLogicalThreads
 
std::vector< ProfTriggerg_dbStartTriggers
 
std::vector< ProfTriggerg_dbStopTriggers
 
thread_local hipError_t tls_lastHipError = hipSuccess
 
thread_local TidInfo tls_tidInfo
 

Detailed Description

Contains definitions for functions that are large enough that we don't want to inline them everywhere. This file is compiled and linked into apps running HIP / HCC path.