SWDEV-477218 - Implement hipDeviceGetTexture1DLinearMaxWidth

Change-Id: I8103f710abeb869f5f84be61c57a30b24356def6
This commit is contained in:
victzhan
2024-08-29 11:03:57 -04:00
committed by Victor Zhang
parent 7a01db98e9
commit 8be00b6602
7 changed files with 50 additions and 3 deletions
+18
View File
@@ -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();