HIP: Heterogenous-computing Interface for Portability
Macros | Functions | Variables
hip_hcc.cpp File Reference
#include <assert.h>
#include <exception>
#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 <mutex>
#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 DB_PEER_CTX   0
 
#define ErrorCheck(x)   error_check(x, __LINE__, __FILE__)
 
#define DeviceErrorCheck(x)
 
#define CASE_STRING(X)
 

Functions

std::string HIP_TRACE_API_COLOR ("green")
 
std::atomic< int > g_lastShortTid (1)
 
uint64_t 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_pool_info (hsa_amd_memory_pool_t pool, 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 ()
 
hipError_t hip_impl::hip_init ()
 
hipError_t ihipStreamSynchronize (hipStream_t stream)
 
void ihipStreamCallbackHandler (ihipStreamCallback_t *cb)
 
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 (const char *tag, 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)
 Return hc::accelerator associated with the specified deviceId. More...
 
hipError_t hipHccGetAcceleratorView (hipStream_t stream, hc::accelerator_view **av)
 Return hc::accelerator_view associated with the specified stream. More...
 
std::vector< hsa_agent_t > hip_impl::all_hsa_agents ()
 
void hip_impl::hip_throw (const std::exception &ex)
 

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 = 0
 
int HIP_HOST_COHERENT = 1
 
int HIP_SYNC_HOST_ALLOC = 1
 
int HIP_SYNC_FREE = 0
 
int HIP_INIT_ALLOC = -1
 
int HIP_SYNC_STREAM_WAIT = 0
 
int HIP_FORCE_NULL_STREAM = 0
 
int HIP_DUMP_CODE_OBJECT = 0
 
int HIP_SYNC_NULL_STREAM = 1
 
int HCC_OPT_FLUSH = 0
 
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
 
bool g_initDeviceFound = false
 
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.

Macro Definition Documentation

#define CASE_STRING (   X)
Value:
case X: \
return #X; \
break;
#define DeviceErrorCheck (   x)
Value:
if (x != HSA_STATUS_SUCCESS) { \
return hipErrorInvalidDevice; \
}