SWDEV-477218 - Implement hipDeviceGetTexture1DLinearMaxWidth

Change-Id: I8103f710abeb869f5f84be61c57a30b24356def6
Цей коміт міститься в:
victzhan
2024-08-29 11:03:57 -04:00
зафіксовано Victor Zhang
джерело 7a01db98e9
коміт 8be00b6602
7 змінених файлів з 50 додано та 3 видалено
+4
Переглянути файл
@@ -36,6 +36,10 @@ Full documentation for HIP is available at [rocm.docs.amd.com](https://rocm.docs
* Soft hang when use AMD_SERIALIZE_KERNEL.
* Memory leak in hipIpcCloseMemHandle.
### Added
- Added new HIP APIs
- `hipDeviceGetTexture1DLinearMaxWidth` returns the maximum number of elements allocatable in a 1D linear texture for a given element size.
## HIP 6.2 (For ROCm 6.2)
### Added
+5 -1
Переглянути файл
@@ -61,7 +61,7 @@
// - Reset any of the *_STEP_VERSION defines to zero if the corresponding *_MAJOR_VERSION increases
#define HIP_API_TABLE_STEP_VERSION 0
#define HIP_COMPILER_API_TABLE_STEP_VERSION 0
#define HIP_RUNTIME_API_TABLE_STEP_VERSION 5
#define HIP_RUNTIME_API_TABLE_STEP_VERSION 6
// HIP API interface
typedef hipError_t (*t___hipPopCallConfiguration)(dim3* gridDim, dim3* blockDim, size_t* sharedMem,
@@ -1001,6 +1001,9 @@ typedef hipError_t (*t_hipDrvGraphMemcpyNodeSetParams)(hipGraphNode_t hNode,
typedef hipError_t (*t_hipExtHostAlloc)(void **ptr, size_t size,
unsigned int flags);
typedef hipError_t (*t_hipDeviceGetTexture1DLinearMaxWidth)(size_t *maxWidthInElements,
const hipChannelFormatDesc *fmtDesc,
int device);
// HIP Compiler dispatch table
struct HipCompilerDispatchTable {
size_t size;
@@ -1484,4 +1487,5 @@ struct HipDispatchTable {
t_hipDrvGraphMemcpyNodeGetParams hipDrvGraphMemcpyNodeGetParams_fn;
t_hipDrvGraphMemcpyNodeSetParams hipDrvGraphMemcpyNodeSetParams_fn;
t_hipExtHostAlloc hipExtHostAlloc_fn;
t_hipDeviceGetTexture1DLinearMaxWidth hipDeviceGetTexture1DLinearMaxWidth_fn;
};
+14
Переглянути файл
@@ -437,6 +437,7 @@ enum hip_api_id_t {
HIP_API_ID_hipCreateTextureObject = HIP_API_ID_NONE,
HIP_API_ID_hipDestroyTextureObject = HIP_API_ID_NONE,
HIP_API_ID_hipDeviceGetCount = HIP_API_ID_NONE,
HIP_API_ID_hipDeviceGetTexture1DLinearMaxWidth = HIP_API_ID_NONE,
HIP_API_ID_hipGetTextureAlignmentOffset = HIP_API_ID_NONE,
HIP_API_ID_hipGetTextureObjectResourceDesc = HIP_API_ID_NONE,
HIP_API_ID_hipGetTextureObjectResourceViewDesc = HIP_API_ID_NONE,
@@ -3977,9 +3978,13 @@ typedef struct hip_api_data_s {
};
// hipDrvGraphMemcpyNodeGetParams[('hipGraphNode_t', 'hNode'), ('HIP_MEMCPY3D*', 'nodeParams')]
#define INIT_hipDrvGraphMemcpyNodeGetParams_CB_ARGS_DATA(cb_data) { \
cb_data.args.hipDrvGraphMemcpyNodeGetParams.hNode = (hipGraphNode_t)hNode; \
cb_data.args.hipDrvGraphMemcpyNodeGetParams.nodeParams = (HIP_MEMCPY3D*)nodeParams; \
};
// hipDrvGraphMemcpyNodeSetParams[('hipGraphNode_t', 'hNode'), ('const HIP_MEMCPY3D*', 'nodeParams')]
#define INIT_hipDrvGraphMemcpyNodeSetParams_CB_ARGS_DATA(cb_data) { \
cb_data.args.hipDrvGraphMemcpyNodeSetParams.hNode = (hipGraphNode_t)hNode; \
cb_data.args.hipDrvGraphMemcpyNodeSetParams.nodeParams = (const HIP_MEMCPY3D*)nodeParams; \
};
// hipDrvMemcpy2DUnaligned[('const hip_Memcpy2D*', 'pCopy')]
#define INIT_hipDrvMemcpy2DUnaligned_CB_ARGS_DATA(cb_data) { \
@@ -4455,6 +4460,8 @@ typedef struct hip_api_data_s {
};
// hipGraphExecGetFlags[('hipGraphExec_t', 'graphExec'), ('unsigned long long*', 'flags')]
#define INIT_hipGraphExecGetFlags_CB_ARGS_DATA(cb_data) { \
cb_data.args.hipGraphExecGetFlags.graphExec = (hipGraphExec_t)graphExec; \
cb_data.args.hipGraphExecGetFlags.flags = (unsigned long long*)flags; \
};
// hipGraphExecHostNodeSetParams[('hipGraphExec_t', 'hGraphExec'), ('hipGraphNode_t', 'node'), ('const hipHostNodeParams*', 'pNodeParams')]
#define INIT_hipGraphExecHostNodeSetParams_CB_ARGS_DATA(cb_data) { \
@@ -4511,6 +4518,9 @@ typedef struct hip_api_data_s {
};
// hipGraphExecNodeSetParams[('hipGraphExec_t', 'graphExec'), ('hipGraphNode_t', 'node'), ('hipGraphNodeParams*', 'nodeParams')]
#define INIT_hipGraphExecNodeSetParams_CB_ARGS_DATA(cb_data) { \
cb_data.args.hipGraphExecNodeSetParams.graphExec = (hipGraphExec_t)graphExec; \
cb_data.args.hipGraphExecNodeSetParams.node = (hipGraphNode_t)node; \
cb_data.args.hipGraphExecNodeSetParams.nodeParams = (hipGraphNodeParams*)nodeParams; \
};
// hipGraphExecUpdate[('hipGraphExec_t', 'hGraphExec'), ('hipGraph_t', 'hGraph'), ('hipGraphNode_t*', 'hErrorNode_out'), ('hipGraphExecUpdateResult*', 'updateResult_out')]
#define INIT_hipGraphExecUpdate_CB_ARGS_DATA(cb_data) { \
@@ -4707,6 +4717,8 @@ typedef struct hip_api_data_s {
};
// hipGraphNodeSetParams[('hipGraphNode_t', 'node'), ('hipGraphNodeParams*', 'nodeParams')]
#define INIT_hipGraphNodeSetParams_CB_ARGS_DATA(cb_data) { \
cb_data.args.hipGraphNodeSetParams.node = (hipGraphNode_t)node; \
cb_data.args.hipGraphNodeSetParams.nodeParams = (hipGraphNodeParams*)nodeParams; \
};
// hipGraphReleaseUserObject[('hipGraph_t', 'graph'), ('hipUserObject_t', 'object'), ('unsigned int', 'count')]
#define INIT_hipGraphReleaseUserObject_CB_ARGS_DATA(cb_data) { \
@@ -6031,6 +6043,8 @@ typedef struct hip_api_data_s {
#define INIT_hipDestroyTextureObject_CB_ARGS_DATA(cb_data) {};
// hipDeviceGetCount()
#define INIT_hipDeviceGetCount_CB_ARGS_DATA(cb_data) {};
// hipDeviceGetTexture1DLinearMaxWidth()
#define INIT_hipDeviceGetTexture1DLinearMaxWidth_CB_ARGS_DATA(cb_data) {};
// hipGetTextureAlignmentOffset()
#define INIT_hipGetTextureAlignmentOffset_CB_ARGS_DATA(cb_data) {};
// hipGetTextureObjectResourceDesc()
+1
Переглянути файл
@@ -29,6 +29,7 @@ hipDeviceGetCacheConfig
hipDeviceGetStreamPriorityRange
hipDeviceGetLimit
hipDeviceGetName
hipDeviceGetTexture1DLinearMaxWidth
hipDeviceGetUuid
hipDeviceGetPCIBusId
hipDeviceGetSharedMemConfig
+7 -2
Переглянути файл
@@ -121,6 +121,9 @@ hipError_t hipDeviceGetP2PAttribute(int* value, hipDeviceP2PAttr attr, int srcDe
hipError_t hipDeviceGetPCIBusId(char* pciBusId, int len, int device);
hipError_t hipDeviceGetSharedMemConfig(hipSharedMemConfig* pConfig);
hipError_t hipDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPriority);
hipError_t hipDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements,
const hipChannelFormatDesc* fmtDesc,
int device);
hipError_t hipDeviceGetUuid(hipUUID* uuid, hipDevice_t device);
hipError_t hipDeviceGraphMemTrim(int device);
hipError_t hipDevicePrimaryCtxGetState(hipDevice_t dev, unsigned int* flags, int* active);
@@ -872,6 +875,7 @@ void UpdateDispatchTable(HipDispatchTable* ptrDispatchTable) {
ptrDispatchTable->hipDeviceGetPCIBusId_fn = hip::hipDeviceGetPCIBusId;
ptrDispatchTable->hipDeviceGetSharedMemConfig_fn = hip::hipDeviceGetSharedMemConfig;
ptrDispatchTable->hipDeviceGetStreamPriorityRange_fn = hip::hipDeviceGetStreamPriorityRange;
ptrDispatchTable->hipDeviceGetTexture1DLinearMaxWidth_fn = hip::hipDeviceGetTexture1DLinearMaxWidth;
ptrDispatchTable->hipDeviceGetUuid_fn = hip::hipDeviceGetUuid;
ptrDispatchTable->hipDeviceGraphMemTrim_fn = hip::hipDeviceGraphMemTrim;
ptrDispatchTable->hipDevicePrimaryCtxGetState_fn = hip::hipDevicePrimaryCtxGetState;
@@ -1873,6 +1877,7 @@ HIP_ENFORCE_ABI(HipDispatchTable, hipExternalMemoryGetMappedMipmappedArray_fn, 4
HIP_ENFORCE_ABI(HipDispatchTable, hipDrvGraphMemcpyNodeGetParams_fn, 459)
HIP_ENFORCE_ABI(HipDispatchTable, hipDrvGraphMemcpyNodeSetParams_fn, 460)
HIP_ENFORCE_ABI(HipDispatchTable, hipExtHostAlloc_fn, 461)
HIP_ENFORCE_ABI(HipDispatchTable, hipDeviceGetTexture1DLinearMaxWidth_fn, 462)
// if HIP_ENFORCE_ABI entries are added for each new function pointer in the table, the number below
// will be +1 of the number in the last HIP_ENFORCE_ABI line. E.g.:
@@ -1880,9 +1885,9 @@ HIP_ENFORCE_ABI(HipDispatchTable, hipExtHostAlloc_fn, 461)
// HIP_ENFORCE_ABI(<table>, <functor>, 8)
//
// HIP_ENFORCE_ABI_VERSIONING(<table>, 9) <- 8 + 1 = 9
HIP_ENFORCE_ABI_VERSIONING(HipDispatchTable, 462)
HIP_ENFORCE_ABI_VERSIONING(HipDispatchTable, 463)
static_assert(HIP_RUNTIME_API_TABLE_MAJOR_VERSION == 0 && HIP_RUNTIME_API_TABLE_STEP_VERSION == 5,
static_assert(HIP_RUNTIME_API_TABLE_MAJOR_VERSION == 0 && HIP_RUNTIME_API_TABLE_STEP_VERSION == 6,
"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
+18
Переглянути файл
@@ -614,6 +614,24 @@ hipError_t hipDeviceSetSharedMemConfig(hipSharedMemConfig config) {
HIP_RETURN(hipSuccess);
}
hipError_t hipDeviceGetTexture1DLinearMaxWidth(size_t* maxWidthInElements,
const hipChannelFormatDesc* fmtDesc, int device) {
HIP_INIT_API(hipDeviceGetTexture1DLinearMaxWidth, maxWidthInElements, fmtDesc, device);
if (maxWidthInElements == nullptr || fmtDesc == nullptr) {
HIP_RETURN(hipErrorInvalidValue);
}
hipDeviceProp_tR0600 prop = {0};
HIP_RETURN_ONFAIL(ihipGetDeviceProperties(&prop, device));
// Calculate element size according to fmtDesc
size_t elementSize = (fmtDesc->x + fmtDesc->y
+ fmtDesc->z + fmtDesc->w) / 8; // Convert from bits to bytes
if (elementSize == 0) {
HIP_RETURN(hipErrorInvalidValue);
}
*maxWidthInElements = prop.maxTexture1DLinear / elementSize;
HIP_RETURN(hipSuccess);
}
hipError_t hipDeviceSynchronize() {
HIP_INIT_API(hipDeviceSynchronize);
CHECK_SUPPORTED_DURING_CAPTURE();
+1
Переглянути файл
@@ -31,6 +31,7 @@ global:
hipDeviceGetName;
hipDeviceGetPCIBusId;
hipDeviceGetSharedMemConfig;
hipDeviceGetTexture1DLinearMaxWidth;
hipDeviceGetP2PAttribute;
hipDevicePrimaryCtxGetState;
hipDevicePrimaryCtxRelease;