SWDEV-437702 - implement hipGetProcAddress

This should be used in place of dlsym or GetProcAddress (linux and windows respectively)

Change-Id: I5501b538e03892e8e5a2282678d848fcaf21d911
Este commit está contenido en:
jiabaxie
2023-12-15 18:19:58 -05:00
cometido por Jiabao Xie
padre d6bc40e822
commit 0479cdb3dd
Se han modificado 10 ficheros con 238 adiciones y 18 borrados
+7 -1
Ver fichero
@@ -60,7 +60,7 @@
// - Increment the HIP_COMPILER_API_TABLE_STEP_VERSION when new compiler API functions are added
// - Reset any of the *_STEP_VERSION defines to zero if the corresponding *_MAJOR_VERSION increases
#define HIP_API_TABLE_STEP_VERSION 0
#define HIP_RUNTIME_API_TABLE_STEP_VERSION 0
#define HIP_RUNTIME_API_TABLE_STEP_VERSION 1
#define HIP_COMPILER_API_TABLE_STEP_VERSION 0
// HIP API interface
@@ -938,10 +938,15 @@ typedef hipError_t (*t_hipGraphAddNode)(hipGraphNode_t *pGraphNode, hipGraph_t g
typedef hipError_t (*t_hipGraphInstantiateWithParams)(hipGraphExec_t* pGraphExec, hipGraph_t graph,
hipGraphInstantiateParams* instantiateParams);
typedef hipError_t (*t_hipExtGetLastError)();
typedef hipError_t (*t_hipTexRefGetBorderColor)(float* pBorderColor,
const textureReference* texRef);
typedef hipError_t (*t_hipTexRefGetArray)(hipArray_t* pArray, const textureReference* texRef);
typedef hipError_t (*t_hipTexRefGetBorderColor)(float* pBorderColor,
const textureReference* texRef);
typedef hipError_t (*t_hipTexRefGetArray)(hipArray_t* pArray, const textureReference* texRef);
typedef hipError_t (*t_hipGetProcAddress)(const char* symbol, void** pfn, int hipVersion, uint64_t flags,
hipDriverProcAddressQueryResult* symbolStatus);
// HIP Compiler dispatch table
struct HipCompilerDispatchTable {
@@ -1406,4 +1411,5 @@ struct HipDispatchTable {
t_hipExtGetLastError hipExtGetLastError_fn;
t_hipTexRefGetBorderColor hipTexRefGetBorderColor_fn;
t_hipTexRefGetArray hipTexRefGetArray_fn;
t_hipGetProcAddress hipGetProcAddress_fn;
};
+143 -13
Ver fichero
@@ -403,7 +403,12 @@ enum hip_api_id_t {
HIP_API_ID_hipGraphExecNodeSetParams = 383,
HIP_API_ID_hipGraphInstantiateWithParams = 384,
HIP_API_ID_hipGraphNodeSetParams = 385,
HIP_API_ID_LAST = 385,
HIP_API_ID_hipDrvGraphAddMemFreeNode = 386,
HIP_API_ID_hipDrvGraphExecMemcpyNodeSetParams = 387,
HIP_API_ID_hipDrvGraphExecMemsetNodeSetParams = 388,
HIP_API_ID_hipTexRefGetArray = 389,
HIP_API_ID_hipTexRefGetBorderColor = 390,
HIP_API_ID_LAST = 390,
HIP_API_ID_hipChooseDevice = HIP_API_ID_CONCAT(HIP_API_ID_,hipChooseDevice),
HIP_API_ID_hipGetDeviceProperties = HIP_API_ID_CONCAT(HIP_API_ID_,hipGetDeviceProperties),
@@ -433,8 +438,6 @@ enum hip_api_id_t {
HIP_API_ID_hipTexObjectGetResourceViewDesc = HIP_API_ID_NONE,
HIP_API_ID_hipTexObjectGetTextureDesc = HIP_API_ID_NONE,
HIP_API_ID_hipTexRefGetAddressMode = HIP_API_ID_NONE,
HIP_API_ID_hipTexRefGetArray = HIP_API_ID_NONE,
HIP_API_ID_hipTexRefGetBorderColor = HIP_API_ID_NONE,
HIP_API_ID_hipTexRefGetFilterMode = HIP_API_ID_NONE,
HIP_API_ID_hipTexRefGetMipmapFilterMode = HIP_API_ID_NONE,
HIP_API_ID_hipTexRefSetAddressMode = HIP_API_ID_NONE,
@@ -513,8 +516,11 @@ static inline const char* hip_api_name(const uint32_t id) {
case HIP_API_ID_hipDeviceSynchronize: return "hipDeviceSynchronize";
case HIP_API_ID_hipDeviceTotalMem: return "hipDeviceTotalMem";
case HIP_API_ID_hipDriverGetVersion: return "hipDriverGetVersion";
case HIP_API_ID_hipDrvGraphAddMemFreeNode: return "hipDrvGraphAddMemFreeNode";
case HIP_API_ID_hipDrvGraphAddMemcpyNode: return "hipDrvGraphAddMemcpyNode";
case HIP_API_ID_hipDrvGraphAddMemsetNode: return "hipDrvGraphAddMemsetNode";
case HIP_API_ID_hipDrvGraphExecMemcpyNodeSetParams: return "hipDrvGraphExecMemcpyNodeSetParams";
case HIP_API_ID_hipDrvGraphExecMemsetNodeSetParams: return "hipDrvGraphExecMemsetNodeSetParams";
case HIP_API_ID_hipDrvGraphMemcpyNodeGetParams: return "hipDrvGraphMemcpyNodeGetParams";
case HIP_API_ID_hipDrvGraphMemcpyNodeSetParams: return "hipDrvGraphMemcpyNodeSetParams";
case HIP_API_ID_hipDrvMemcpy2DUnaligned: return "hipDrvMemcpy2DUnaligned";
@@ -809,6 +815,8 @@ static inline const char* hip_api_name(const uint32_t id) {
case HIP_API_ID_hipStreamWriteValue32: return "hipStreamWriteValue32";
case HIP_API_ID_hipStreamWriteValue64: return "hipStreamWriteValue64";
case HIP_API_ID_hipTexRefGetAddress: return "hipTexRefGetAddress";
case HIP_API_ID_hipTexRefGetArray: return "hipTexRefGetArray";
case HIP_API_ID_hipTexRefGetBorderColor: return "hipTexRefGetBorderColor";
case HIP_API_ID_hipTexRefGetFlags: return "hipTexRefGetFlags";
case HIP_API_ID_hipTexRefGetFormat: return "hipTexRefGetFormat";
case HIP_API_ID_hipTexRefGetMaxAnisotropy: return "hipTexRefGetMaxAnisotropy";
@@ -901,8 +909,11 @@ static inline uint32_t hipApiIdByName(const char* name) {
if (strcmp("hipDeviceSynchronize", name) == 0) return HIP_API_ID_hipDeviceSynchronize;
if (strcmp("hipDeviceTotalMem", name) == 0) return HIP_API_ID_hipDeviceTotalMem;
if (strcmp("hipDriverGetVersion", name) == 0) return HIP_API_ID_hipDriverGetVersion;
if (strcmp("hipDrvGraphAddMemFreeNode", name) == 0) return HIP_API_ID_hipDrvGraphAddMemFreeNode;
if (strcmp("hipDrvGraphAddMemcpyNode", name) == 0) return HIP_API_ID_hipDrvGraphAddMemcpyNode;
if (strcmp("hipDrvGraphAddMemsetNode", name) == 0) return HIP_API_ID_hipDrvGraphAddMemsetNode;
if (strcmp("hipDrvGraphExecMemcpyNodeSetParams", name) == 0) return HIP_API_ID_hipDrvGraphExecMemcpyNodeSetParams;
if (strcmp("hipDrvGraphExecMemsetNodeSetParams", name) == 0) return HIP_API_ID_hipDrvGraphExecMemsetNodeSetParams;
if (strcmp("hipDrvGraphMemcpyNodeGetParams", name) == 0) return HIP_API_ID_hipDrvGraphMemcpyNodeGetParams;
if (strcmp("hipDrvGraphMemcpyNodeSetParams", name) == 0) return HIP_API_ID_hipDrvGraphMemcpyNodeSetParams;
if (strcmp("hipDrvMemcpy2DUnaligned", name) == 0) return HIP_API_ID_hipDrvMemcpy2DUnaligned;
@@ -1197,6 +1208,8 @@ static inline uint32_t hipApiIdByName(const char* name) {
if (strcmp("hipStreamWriteValue32", name) == 0) return HIP_API_ID_hipStreamWriteValue32;
if (strcmp("hipStreamWriteValue64", name) == 0) return HIP_API_ID_hipStreamWriteValue64;
if (strcmp("hipTexRefGetAddress", name) == 0) return HIP_API_ID_hipTexRefGetAddress;
if (strcmp("hipTexRefGetArray", name) == 0) return HIP_API_ID_hipTexRefGetArray;
if (strcmp("hipTexRefGetBorderColor", name) == 0) return HIP_API_ID_hipTexRefGetBorderColor;
if (strcmp("hipTexRefGetFlags", name) == 0) return HIP_API_ID_hipTexRefGetFlags;
if (strcmp("hipTexRefGetFormat", name) == 0) return HIP_API_ID_hipTexRefGetFormat;
if (strcmp("hipTexRefGetMaxAnisotropy", name) == 0) return HIP_API_ID_hipTexRefGetMaxAnisotropy;
@@ -1514,6 +1527,15 @@ typedef struct hip_api_data_s {
int* driverVersion;
int driverVersion__val;
} hipDriverGetVersion;
struct {
hipGraphNode_t* phGraphNode;
hipGraphNode_t phGraphNode__val;
hipGraph_t hGraph;
const hipGraphNode_t* dependencies;
hipGraphNode_t dependencies__val;
size_t numDependencies;
hipDeviceptr_t dptr;
} hipDrvGraphAddMemFreeNode;
struct {
hipGraphNode_t* phGraphNode;
hipGraphNode_t phGraphNode__val;
@@ -1536,6 +1558,20 @@ typedef struct hip_api_data_s {
HIP_MEMSET_NODE_PARAMS memsetParams__val;
hipCtx_t ctx;
} hipDrvGraphAddMemsetNode;
struct {
hipGraphExec_t hGraphExec;
hipGraphNode_t hNode;
const HIP_MEMCPY3D* copyParams;
HIP_MEMCPY3D copyParams__val;
hipCtx_t ctx;
} hipDrvGraphExecMemcpyNodeSetParams;
struct {
hipGraphExec_t hGraphExec;
hipGraphNode_t hNode;
const HIP_MEMSET_NODE_PARAMS* memsetParams;
HIP_MEMSET_NODE_PARAMS memsetParams__val;
hipCtx_t ctx;
} hipDrvGraphExecMemsetNodeSetParams;
struct {
hipGraphNode_t hNode;
HIP_MEMCPY3D* nodeParams;
@@ -3344,6 +3380,18 @@ typedef struct hip_api_data_s {
const textureReference* texRef;
textureReference texRef__val;
} hipTexRefGetAddress;
struct {
hipArray_t* pArray;
hipArray_t pArray__val;
const textureReference* texRef;
textureReference texRef__val;
} hipTexRefGetArray;
struct {
float* pBorderColor;
float pBorderColor__val;
const textureReference* texRef;
textureReference texRef__val;
} hipTexRefGetBorderColor;
struct {
unsigned int* pFlags;
unsigned int pFlags__val;
@@ -3787,6 +3835,9 @@ typedef struct hip_api_data_s {
#define INIT_hipDriverGetVersion_CB_ARGS_DATA(cb_data) { \
cb_data.args.hipDriverGetVersion.driverVersion = (int*)driverVersion; \
};
// hipDrvGraphAddMemFreeNode[('hipGraphNode_t*', 'phGraphNode'), ('hipGraph_t', 'hGraph'), ('const hipGraphNode_t*', 'dependencies'), ('size_t', 'numDependencies'), ('hipDeviceptr_t', 'dptr')]
#define INIT_hipDrvGraphAddMemFreeNode_CB_ARGS_DATA(cb_data) { \
};
// hipDrvGraphAddMemcpyNode[('hipGraphNode_t*', 'phGraphNode'), ('hipGraph_t', 'hGraph'), ('const hipGraphNode_t*', 'dependencies'), ('size_t', 'numDependencies'), ('const HIP_MEMCPY3D*', 'copyParams'), ('hipCtx_t', 'ctx')]
#define INIT_hipDrvGraphAddMemcpyNode_CB_ARGS_DATA(cb_data) { \
cb_data.args.hipDrvGraphAddMemcpyNode.phGraphNode = (hipGraphNode_t*)phGraphNode; \
@@ -3805,6 +3856,12 @@ typedef struct hip_api_data_s {
cb_data.args.hipDrvGraphAddMemsetNode.memsetParams = (const HIP_MEMSET_NODE_PARAMS*)memsetParams; \
cb_data.args.hipDrvGraphAddMemsetNode.ctx = (hipCtx_t)ctx; \
};
// hipDrvGraphExecMemcpyNodeSetParams[('hipGraphExec_t', 'hGraphExec'), ('hipGraphNode_t', 'hNode'), ('const HIP_MEMCPY3D*', 'copyParams'), ('hipCtx_t', 'ctx')]
#define INIT_hipDrvGraphExecMemcpyNodeSetParams_CB_ARGS_DATA(cb_data) { \
};
// hipDrvGraphExecMemsetNodeSetParams[('hipGraphExec_t', 'hGraphExec'), ('hipGraphNode_t', 'hNode'), ('const HIP_MEMSET_NODE_PARAMS*', 'memsetParams'), ('hipCtx_t', 'ctx')]
#define INIT_hipDrvGraphExecMemsetNodeSetParams_CB_ARGS_DATA(cb_data) { \
};
// hipDrvGraphMemcpyNodeGetParams[('hipGraphNode_t', 'hNode'), ('HIP_MEMCPY3D*', 'nodeParams')]
#define INIT_hipDrvGraphMemcpyNodeGetParams_CB_ARGS_DATA(cb_data) { \
};
@@ -4034,6 +4091,11 @@ typedef struct hip_api_data_s {
};
// hipGetProcAddress[('const char*', 'symbol'), ('void**', 'pfn'), ('int', 'hipVersion'), ('uint64_t', 'flags'), ('hipDriverProcAddressQueryResult*', 'symbolStatus')]
#define INIT_hipGetProcAddress_CB_ARGS_DATA(cb_data) { \
cb_data.args.hipGetProcAddress.symbol = (symbol) ? strdup(symbol) : NULL; \
cb_data.args.hipGetProcAddress.pfn = (void**)pfn; \
cb_data.args.hipGetProcAddress.hipVersion = (int)hipVersion; \
cb_data.args.hipGetProcAddress.flags = (uint64_t)flags; \
cb_data.args.hipGetProcAddress.symbolStatus = (hipDriverProcAddressQueryResult*)symbolStatus; \
};
// hipGetSymbolAddress[('void**', 'devPtr'), ('const void*', 'symbol')]
#define INIT_hipGetSymbolAddress_CB_ARGS_DATA(cb_data) { \
@@ -4415,9 +4477,6 @@ typedef struct hip_api_data_s {
};
// hipGraphKernelNodeGetAttribute[('hipGraphNode_t', 'hNode'), ('hipLaunchAttributeID', 'attr'), ('hipLaunchAttributeValue*', 'value')]
#define INIT_hipGraphKernelNodeGetAttribute_CB_ARGS_DATA(cb_data) { \
cb_data.args.hipGraphKernelNodeGetAttribute.hNode = (hipGraphNode_t)hNode; \
cb_data.args.hipGraphKernelNodeGetAttribute.attr = (hipLaunchAttributeID)attr; \
cb_data.args.hipGraphKernelNodeGetAttribute.value = (hipLaunchAttributeValue*)value; \
};
// hipGraphKernelNodeGetParams[('hipGraphNode_t', 'node'), ('hipKernelNodeParams*', 'pNodeParams')]
#define INIT_hipGraphKernelNodeGetParams_CB_ARGS_DATA(cb_data) { \
@@ -4426,9 +4485,6 @@ typedef struct hip_api_data_s {
};
// hipGraphKernelNodeSetAttribute[('hipGraphNode_t', 'hNode'), ('hipLaunchAttributeID', 'attr'), ('const hipLaunchAttributeValue*', 'value')]
#define INIT_hipGraphKernelNodeSetAttribute_CB_ARGS_DATA(cb_data) { \
cb_data.args.hipGraphKernelNodeSetAttribute.hNode = (hipGraphNode_t)hNode; \
cb_data.args.hipGraphKernelNodeSetAttribute.attr = (hipLaunchAttributeID)attr; \
cb_data.args.hipGraphKernelNodeSetAttribute.value = (const hipLaunchAttributeValue*)value; \
};
// hipGraphKernelNodeSetParams[('hipGraphNode_t', 'node'), ('const hipKernelNodeParams*', 'pNodeParams')]
#define INIT_hipGraphKernelNodeSetParams_CB_ARGS_DATA(cb_data) { \
@@ -5635,6 +5691,16 @@ typedef struct hip_api_data_s {
cb_data.args.hipTexRefGetAddress.dev_ptr = (hipDeviceptr_t*)dptr; \
cb_data.args.hipTexRefGetAddress.texRef = (const textureReference*)texRef; \
};
// hipTexRefGetArray[('hipArray_t*', 'pArray'), ('const textureReference*', 'texRef')]
#define INIT_hipTexRefGetArray_CB_ARGS_DATA(cb_data) { \
cb_data.args.hipTexRefGetArray.pArray = (hipArray_t*)pArray; \
cb_data.args.hipTexRefGetArray.texRef = (const textureReference*)texRef; \
};
// hipTexRefGetBorderColor[('float*', 'pBorderColor'), ('const textureReference*', 'texRef')]
#define INIT_hipTexRefGetBorderColor_CB_ARGS_DATA(cb_data) { \
cb_data.args.hipTexRefGetBorderColor.pBorderColor = (float*)pBorderColor; \
cb_data.args.hipTexRefGetBorderColor.texRef = (const textureReference*)texRef; \
};
// hipTexRefGetFlags[('unsigned int*', 'pFlags'), ('const textureReference*', 'texRef')]
#define INIT_hipTexRefGetFlags_CB_ARGS_DATA(cb_data) { \
cb_data.args.hipTexRefGetFlags.pFlags = (unsigned int*)pFlags; \
@@ -5807,10 +5873,6 @@ typedef struct hip_api_data_s {
#define INIT_hipTexObjectGetTextureDesc_CB_ARGS_DATA(cb_data) {};
// hipTexRefGetAddressMode()
#define INIT_hipTexRefGetAddressMode_CB_ARGS_DATA(cb_data) {};
// hipTexRefGetArray()
#define INIT_hipTexRefGetArray_CB_ARGS_DATA(cb_data) {};
// hipTexRefGetBorderColor()
#define INIT_hipTexRefGetBorderColor_CB_ARGS_DATA(cb_data) {};
// hipTexRefGetFilterMode()
#define INIT_hipTexRefGetFilterMode_CB_ARGS_DATA(cb_data) {};
// hipTexRefGetMipmapFilterMode()
@@ -6072,6 +6134,11 @@ static inline void hipApiArgsInit(hip_api_id_t id, hip_api_data_t* data) {
case HIP_API_ID_hipDriverGetVersion:
if (data->args.hipDriverGetVersion.driverVersion) data->args.hipDriverGetVersion.driverVersion__val = *(data->args.hipDriverGetVersion.driverVersion);
break;
// hipDrvGraphAddMemFreeNode[('hipGraphNode_t*', 'phGraphNode'), ('hipGraph_t', 'hGraph'), ('const hipGraphNode_t*', 'dependencies'), ('size_t', 'numDependencies'), ('hipDeviceptr_t', 'dptr')]
case HIP_API_ID_hipDrvGraphAddMemFreeNode:
if (data->args.hipDrvGraphAddMemFreeNode.phGraphNode) data->args.hipDrvGraphAddMemFreeNode.phGraphNode__val = *(data->args.hipDrvGraphAddMemFreeNode.phGraphNode);
if (data->args.hipDrvGraphAddMemFreeNode.dependencies) data->args.hipDrvGraphAddMemFreeNode.dependencies__val = *(data->args.hipDrvGraphAddMemFreeNode.dependencies);
break;
// hipDrvGraphAddMemcpyNode[('hipGraphNode_t*', 'phGraphNode'), ('hipGraph_t', 'hGraph'), ('const hipGraphNode_t*', 'dependencies'), ('size_t', 'numDependencies'), ('const HIP_MEMCPY3D*', 'copyParams'), ('hipCtx_t', 'ctx')]
case HIP_API_ID_hipDrvGraphAddMemcpyNode:
if (data->args.hipDrvGraphAddMemcpyNode.phGraphNode) data->args.hipDrvGraphAddMemcpyNode.phGraphNode__val = *(data->args.hipDrvGraphAddMemcpyNode.phGraphNode);
@@ -6084,6 +6151,14 @@ static inline void hipApiArgsInit(hip_api_id_t id, hip_api_data_t* data) {
if (data->args.hipDrvGraphAddMemsetNode.dependencies) data->args.hipDrvGraphAddMemsetNode.dependencies__val = *(data->args.hipDrvGraphAddMemsetNode.dependencies);
if (data->args.hipDrvGraphAddMemsetNode.memsetParams) data->args.hipDrvGraphAddMemsetNode.memsetParams__val = *(data->args.hipDrvGraphAddMemsetNode.memsetParams);
break;
// hipDrvGraphExecMemcpyNodeSetParams[('hipGraphExec_t', 'hGraphExec'), ('hipGraphNode_t', 'hNode'), ('const HIP_MEMCPY3D*', 'copyParams'), ('hipCtx_t', 'ctx')]
case HIP_API_ID_hipDrvGraphExecMemcpyNodeSetParams:
if (data->args.hipDrvGraphExecMemcpyNodeSetParams.copyParams) data->args.hipDrvGraphExecMemcpyNodeSetParams.copyParams__val = *(data->args.hipDrvGraphExecMemcpyNodeSetParams.copyParams);
break;
// hipDrvGraphExecMemsetNodeSetParams[('hipGraphExec_t', 'hGraphExec'), ('hipGraphNode_t', 'hNode'), ('const HIP_MEMSET_NODE_PARAMS*', 'memsetParams'), ('hipCtx_t', 'ctx')]
case HIP_API_ID_hipDrvGraphExecMemsetNodeSetParams:
if (data->args.hipDrvGraphExecMemsetNodeSetParams.memsetParams) data->args.hipDrvGraphExecMemsetNodeSetParams.memsetParams__val = *(data->args.hipDrvGraphExecMemsetNodeSetParams.memsetParams);
break;
// hipDrvGraphMemcpyNodeGetParams[('hipGraphNode_t', 'hNode'), ('HIP_MEMCPY3D*', 'nodeParams')]
case HIP_API_ID_hipDrvGraphMemcpyNodeGetParams:
if (data->args.hipDrvGraphMemcpyNodeGetParams.nodeParams) data->args.hipDrvGraphMemcpyNodeGetParams.nodeParams__val = *(data->args.hipDrvGraphMemcpyNodeGetParams.nodeParams);
@@ -7228,6 +7303,16 @@ static inline void hipApiArgsInit(hip_api_id_t id, hip_api_data_t* data) {
if (data->args.hipTexRefGetAddress.dev_ptr) data->args.hipTexRefGetAddress.dev_ptr__val = *(data->args.hipTexRefGetAddress.dev_ptr);
if (data->args.hipTexRefGetAddress.texRef) data->args.hipTexRefGetAddress.texRef__val = *(data->args.hipTexRefGetAddress.texRef);
break;
// hipTexRefGetArray[('hipArray_t*', 'pArray'), ('const textureReference*', 'texRef')]
case HIP_API_ID_hipTexRefGetArray:
if (data->args.hipTexRefGetArray.pArray) data->args.hipTexRefGetArray.pArray__val = *(data->args.hipTexRefGetArray.pArray);
if (data->args.hipTexRefGetArray.texRef) data->args.hipTexRefGetArray.texRef__val = *(data->args.hipTexRefGetArray.texRef);
break;
// hipTexRefGetBorderColor[('float*', 'pBorderColor'), ('const textureReference*', 'texRef')]
case HIP_API_ID_hipTexRefGetBorderColor:
if (data->args.hipTexRefGetBorderColor.pBorderColor) data->args.hipTexRefGetBorderColor.pBorderColor__val = *(data->args.hipTexRefGetBorderColor.pBorderColor);
if (data->args.hipTexRefGetBorderColor.texRef) data->args.hipTexRefGetBorderColor.texRef__val = *(data->args.hipTexRefGetBorderColor.texRef);
break;
// hipTexRefGetFlags[('unsigned int*', 'pFlags'), ('const textureReference*', 'texRef')]
case HIP_API_ID_hipTexRefGetFlags:
if (data->args.hipTexRefGetFlags.pFlags) data->args.hipTexRefGetFlags.pFlags__val = *(data->args.hipTexRefGetFlags.pFlags);
@@ -7755,6 +7840,17 @@ static inline const char* hipApiString(hip_api_id_t id, const hip_api_data_t* da
else { oss << "driverVersion="; roctracer::hip_support::detail::operator<<(oss, data->args.hipDriverGetVersion.driverVersion__val); }
oss << ")";
break;
case HIP_API_ID_hipDrvGraphAddMemFreeNode:
oss << "hipDrvGraphAddMemFreeNode(";
if (data->args.hipDrvGraphAddMemFreeNode.phGraphNode == NULL) oss << "phGraphNode=NULL";
else { oss << "phGraphNode="; roctracer::hip_support::detail::operator<<(oss, data->args.hipDrvGraphAddMemFreeNode.phGraphNode__val); }
oss << ", hGraph="; roctracer::hip_support::detail::operator<<(oss, data->args.hipDrvGraphAddMemFreeNode.hGraph);
if (data->args.hipDrvGraphAddMemFreeNode.dependencies == NULL) oss << ", dependencies=NULL";
else { oss << ", dependencies="; roctracer::hip_support::detail::operator<<(oss, data->args.hipDrvGraphAddMemFreeNode.dependencies__val); }
oss << ", numDependencies="; roctracer::hip_support::detail::operator<<(oss, data->args.hipDrvGraphAddMemFreeNode.numDependencies);
oss << ", dptr="; roctracer::hip_support::detail::operator<<(oss, data->args.hipDrvGraphAddMemFreeNode.dptr);
oss << ")";
break;
case HIP_API_ID_hipDrvGraphAddMemcpyNode:
oss << "hipDrvGraphAddMemcpyNode(";
if (data->args.hipDrvGraphAddMemcpyNode.phGraphNode == NULL) oss << "phGraphNode=NULL";
@@ -7781,6 +7877,24 @@ static inline const char* hipApiString(hip_api_id_t id, const hip_api_data_t* da
oss << ", ctx="; roctracer::hip_support::detail::operator<<(oss, data->args.hipDrvGraphAddMemsetNode.ctx);
oss << ")";
break;
case HIP_API_ID_hipDrvGraphExecMemcpyNodeSetParams:
oss << "hipDrvGraphExecMemcpyNodeSetParams(";
oss << "hGraphExec="; roctracer::hip_support::detail::operator<<(oss, data->args.hipDrvGraphExecMemcpyNodeSetParams.hGraphExec);
oss << ", hNode="; roctracer::hip_support::detail::operator<<(oss, data->args.hipDrvGraphExecMemcpyNodeSetParams.hNode);
if (data->args.hipDrvGraphExecMemcpyNodeSetParams.copyParams == NULL) oss << ", copyParams=NULL";
else { oss << ", copyParams="; roctracer::hip_support::detail::operator<<(oss, data->args.hipDrvGraphExecMemcpyNodeSetParams.copyParams__val); }
oss << ", ctx="; roctracer::hip_support::detail::operator<<(oss, data->args.hipDrvGraphExecMemcpyNodeSetParams.ctx);
oss << ")";
break;
case HIP_API_ID_hipDrvGraphExecMemsetNodeSetParams:
oss << "hipDrvGraphExecMemsetNodeSetParams(";
oss << "hGraphExec="; roctracer::hip_support::detail::operator<<(oss, data->args.hipDrvGraphExecMemsetNodeSetParams.hGraphExec);
oss << ", hNode="; roctracer::hip_support::detail::operator<<(oss, data->args.hipDrvGraphExecMemsetNodeSetParams.hNode);
if (data->args.hipDrvGraphExecMemsetNodeSetParams.memsetParams == NULL) oss << ", memsetParams=NULL";
else { oss << ", memsetParams="; roctracer::hip_support::detail::operator<<(oss, data->args.hipDrvGraphExecMemsetNodeSetParams.memsetParams__val); }
oss << ", ctx="; roctracer::hip_support::detail::operator<<(oss, data->args.hipDrvGraphExecMemsetNodeSetParams.ctx);
oss << ")";
break;
case HIP_API_ID_hipDrvGraphMemcpyNodeGetParams:
oss << "hipDrvGraphMemcpyNodeGetParams(";
oss << "hNode="; roctracer::hip_support::detail::operator<<(oss, data->args.hipDrvGraphMemcpyNodeGetParams.hNode);
@@ -10189,6 +10303,22 @@ static inline const char* hipApiString(hip_api_id_t id, const hip_api_data_t* da
else { oss << ", texRef="; roctracer::hip_support::detail::operator<<(oss, data->args.hipTexRefGetAddress.texRef__val); }
oss << ")";
break;
case HIP_API_ID_hipTexRefGetArray:
oss << "hipTexRefGetArray(";
if (data->args.hipTexRefGetArray.pArray == NULL) oss << "pArray=NULL";
else { oss << "pArray="; roctracer::hip_support::detail::operator<<(oss, data->args.hipTexRefGetArray.pArray__val); }
if (data->args.hipTexRefGetArray.texRef == NULL) oss << ", texRef=NULL";
else { oss << ", texRef="; roctracer::hip_support::detail::operator<<(oss, data->args.hipTexRefGetArray.texRef__val); }
oss << ")";
break;
case HIP_API_ID_hipTexRefGetBorderColor:
oss << "hipTexRefGetBorderColor(";
if (data->args.hipTexRefGetBorderColor.pBorderColor == NULL) oss << "pBorderColor=NULL";
else { oss << "pBorderColor="; roctracer::hip_support::detail::operator<<(oss, data->args.hipTexRefGetBorderColor.pBorderColor__val); }
if (data->args.hipTexRefGetBorderColor.texRef == NULL) oss << ", texRef=NULL";
else { oss << ", texRef="; roctracer::hip_support::detail::operator<<(oss, data->args.hipTexRefGetBorderColor.texRef__val); }
oss << ")";
break;
case HIP_API_ID_hipTexRefGetFlags:
oss << "hipTexRefGetFlags(";
if (data->args.hipTexRefGetFlags.pFlags == NULL) oss << "pFlags=NULL";
+1
Ver fichero
@@ -449,6 +449,7 @@ hipGraphAddMemFreeNode
hipGraphMemFreeNodeGetParams
hipDrvGraphAddMemcpyNode
hipDrvGraphAddMemsetNode
hipGetProcAddress
hipExtGetLastError
hipGraphAddExternalSemaphoresSignalNode
hipGraphAddExternalSemaphoresWaitNode
+6 -2
Ver fichero
@@ -761,6 +761,8 @@ hipError_t hipModuleLaunchCooperativeKernelMultiDevice(hipFunctionLaunchParams*
hipError_t hipExtGetLastError();
hipError_t hipTexRefGetBorderColor(float* pBorderColor, const textureReference* texRef);
hipError_t hipTexRefGetArray(hipArray_t* pArray, const textureReference* texRef);
hipError_t hipGetProcAddress(const char* symbol, void** pfn, int hipVersion, uint64_t flags,
hipDriverProcAddressQueryResult* symbolStatus = NULL);
} // namespace hip
namespace hip {
@@ -1234,6 +1236,7 @@ void UpdateDispatchTable(HipDispatchTable* ptrDispatchTable) {
ptrDispatchTable->hipExtGetLastError_fn = hip::hipExtGetLastError;
ptrDispatchTable->hipTexRefGetBorderColor_fn = hip::hipTexRefGetBorderColor;
ptrDispatchTable->hipTexRefGetArray_fn = hip::hipTexRefGetArray;
ptrDispatchTable->hipGetProcAddress_fn = hip::hipGetProcAddress;
}
#if HIP_ROCPROFILER_REGISTER > 0
@@ -1251,7 +1254,7 @@ constexpr auto ComputeTableSize(size_t num_funcs) {
return (num_funcs * sizeof(void*)) + sizeof(uint64_t);
}
HIP_DEFINE_DISPATCH_TABLE_INFO(HipDispatchTable, hip, 429)
HIP_DEFINE_DISPATCH_TABLE_INFO(HipDispatchTable, hip, 440)
HIP_DEFINE_DISPATCH_TABLE_INFO(HipCompilerDispatchTable, hip_compiler, 9)
#endif
@@ -1775,8 +1778,9 @@ HIP_ENFORCE_ABI(HipDispatchTable, hipGraphExecExternalSemaphoresSignalNodeSetPar
HIP_ENFORCE_ABI(HipDispatchTable, hipGraphExecExternalSemaphoresWaitNodeSetParams_fn, 436);
HIP_ENFORCE_ABI(HipDispatchTable, hipGraphAddNode_fn, 437);
HIP_ENFORCE_ABI(HipDispatchTable, hipGraphInstantiateWithParams_fn, 438);
HIP_ENFORCE_ABI(HipDispatchTable, hipGetProcAddress_fn, 442)
static_assert(HIP_RUNTIME_API_TABLE_MAJOR_VERSION == 0 && HIP_RUNTIME_API_TABLE_STEP_VERSION == 0,
static_assert(HIP_RUNTIME_API_TABLE_MAJOR_VERSION == 0 && HIP_RUNTIME_API_TABLE_STEP_VERSION == 1,
"If you get this error, add new HIP_ENFORCE_ABI(...) code for the new function "
"pointers and then update this check so it is true");
#endif
+39
Ver fichero
@@ -23,6 +23,7 @@
#include "hip_internal.hpp"
#include "hip_mempool_impl.hpp"
#include "hip_platform.hpp"
#undef hipGetDeviceProperties
#undef hipDeviceProp_t
@@ -584,6 +585,44 @@ hipError_t hipGetDevicePropertiesR0000(hipDeviceProp_tR0000* prop, int device) {
HIP_RETURN(hipSuccess);
}
hipError_t hipGetProcAddress(const char* symbol, void** pfn, int hipVersion, uint64_t flags,
hipDriverProcAddressQueryResult* symbolStatus = nullptr) {
HIP_INIT_API(hipGetProcAddress, symbol, pfn, hipVersion, flags, symbolStatus);
std::string symbolString = symbol;
if(symbol == nullptr || symbolString == "" || *pfn == nullptr){
HIP_RETURN(hipErrorInvalidValue);
}
if (symbolString == "hipGetDeviceProperties"){
if (hipVersion >= 600){
symbolString = "hipGetDevicePropertiesR0600";
}
} else if (symbolString == "hipChooseDevice") {
if (hipVersion >= 600){
symbolString = "hipChooseDeviceR0600";
}
}
void* handle = hip::PlatformState::instance().getDynamicLibraryHandle();
if (handle == nullptr){
HIP_RETURN(hipErrorInvalidValue);
}
*pfn = amd::Os::getSymbol(handle, symbolString.c_str());
if (!(*pfn)) {
if (symbolStatus != nullptr) {
*symbolStatus = HIP_GET_PROC_ADDRESS_SYMBOL_NOT_FOUND;
}
HIP_RETURN(hipErrorInvalidValue);
}
if (symbolStatus != nullptr) {
*symbolStatus = HIP_GET_PROC_ADDRESS_SUCCESS;
}
HIP_RETURN(hipSuccess);
}
} // namespace hip
extern "C" hipError_t hipGetDeviceProperties(hipDeviceProp_tR0000* props, hipDevice_t device) {
+1
Ver fichero
@@ -551,6 +551,7 @@ local:
hip_6.1 {
global:
hipGraphInstantiateWithParams;
hipGetProcAddress;
local:
*;
} hip_6.0;
+23
Ver fichero
@@ -958,4 +958,27 @@ bool PlatformState::CloseUniqueFileHandle(const std::shared_ptr<UniqueFD>& ufd)
}
return true;
}
void* PlatformState::getDynamicLibraryHandle() {
amd::ScopedLock lock(lock_);
if (dynamicLibraryHandle_ != nullptr) {
return dynamicLibraryHandle_;
}
#ifdef _WIN32
const char* libName = "amdhip64.dll";
#else
const char* libName = "libamdhip64.so";
#endif
dynamicLibraryHandle_ = amd::Os::loadLibrary(libName);
return dynamicLibraryHandle_;
}
void PlatformState::setDynamicLibraryHandle(void* handle){
amd::ScopedLock lock(lock_);
dynamicLibraryHandle_ = handle;
}
} //namespace hip
+6
Ver fichero
@@ -96,6 +96,10 @@ class PlatformState {
hipError_t initStatManagedVarDevicePtr(int deviceId);
// Load hip dynamic library
void* getDynamicLibraryHandle();
void setDynamicLibraryHandle(void* handle);
// Exec Functions
void setupArgument(const void* arg, size_t size, size_t offset);
void configureCall(dim3 gridDim, dim3 blockDim, size_t sharedMem, hipStream_t stream);
@@ -114,5 +118,7 @@ class PlatformState {
std::unordered_map<textureReference*, std::pair<hipModule_t, std::string>> texRef_map_;
std::unordered_map<std::string, std::shared_ptr<UniqueFD>> ufd_map_; //!< Unique File Desc Map
void* dynamicLibraryHandle_{nullptr};
};
} // namespace hip
+6 -2
Ver fichero
@@ -18,10 +18,13 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. */
#include "thread/thread.hpp"
#include <windows.h>
#include <iostream>
#include <hip/hip_runtime.h>
#include "thread/thread.hpp"
#include "hip_platform.hpp"
namespace hip {
void ihipDestroyDevice();
}
@@ -46,6 +49,7 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) {
_set_error_mode(_OUT_TO_STDERR);
}
#endif // DEBUG
hip::PlatformState::instance().setDynamicLibraryHandle(static_cast<void*>(hinst));
break;
case DLL_PROCESS_DETACH: {
amd::Thread* thread = amd::Thread::current();
+6
Ver fichero
@@ -1727,3 +1727,9 @@ hipError_t hipTexRefGetBorderColor(float* pBorderColor, const textureReference*
hipError_t hipTexRefGetArray(hipArray_t* pArray, const textureReference* texRef) {
return hip::GetHipDispatchTable()->hipTexRefGetArray_fn(pArray, texRef);
}
extern "C" hipError_t hipGetProcAddress(const char* symbol, void** pfn, int hipVersion,
uint64_t flags,
hipDriverProcAddressQueryResult* symbolStatus = nullptr) {
return hip::GetHipDispatchTable()->hipGetProcAddress_fn(symbol, pfn, hipVersion, flags,
symbolStatus);
}