SWDEV-323899 - More capping of caps

Change-Id: If8ba22d01326b85455eaaee55e1e2a4b9832ebb2
This commit is contained in:
Christophe Paquot
2022-03-16 14:26:36 -07:00
committad av Christophe Paquot
förälder ae506b40c0
incheckning 2ef41ff5be
2 ändrade filer med 19 tillägg och 14 borttagningar
+6 -2
Visa fil
@@ -155,6 +155,8 @@ hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device)
hipDeviceProp_t prop = {0};
HIP_RETURN_ONFAIL(ihipGetDeviceProperties(&prop, device));
constexpr auto int32_max = static_cast<uint64_t>(std::numeric_limits<int32_t>::max());
switch (attr) {
case hipDeviceAttributeMaxThreadsPerBlock:
*pi = prop.maxThreadsPerBlock;
@@ -181,7 +183,8 @@ hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device)
*pi = prop.sharedMemPerBlock;
break;
case hipDeviceAttributeTotalConstantMemory:
*pi = prop.totalConstMem;
// size_t to int casting
*pi = std::min(prop.totalConstMem, int32_max);
break;
case hipDeviceAttributeWarpSize:
*pi = prop.warpSize;
@@ -265,7 +268,8 @@ hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device)
*reinterpret_cast<unsigned int**>(pi) = prop.hdpRegFlushCntl;
break;
case hipDeviceAttributeMaxPitch:
*pi = prop.memPitch;
// size_t to int casting
*pi = std::min(prop.memPitch, int32_max);
break;
case hipDeviceAttributeTextureAlignment:
*pi = prop.textureAlignment;