EXSWCPHIPT-112 - Unit test for hipMalloc3DArray for default and surface arrays (#2713)

[ROCm/hip-tests commit: a230bd0f56]
This commit is contained in:
Finlay
2022-07-11 07:49:05 +01:00
committad av GitHub
förälder 8eb2bda558
incheckning eb02afea20
4 ändrade filer med 302 tillägg och 184 borttagningar
@@ -122,3 +122,39 @@ inline size_t getFreeMem() {
HIP_CHECK(hipMemGetInfo(&free, &total));
return free;
}
struct Sizes {
int max1D;
std::array<int, 2> max2D;
std::array<int, 3> max3D;
Sizes(unsigned int flag) {
int device;
HIP_CHECK(hipGetDevice(&device));
switch (flag) {
case hipArrayDefault: {
hipDeviceProp_t prop;
HIP_CHECK(hipGetDeviceProperties(&prop, device));
max1D = prop.maxTexture1D;
max2D = {prop.maxTexture2D[0], prop.maxTexture2D[1]};
max3D = {prop.maxTexture3D[0], prop.maxTexture3D[1], prop.maxTexture3D[2]};
return;
}
case hipArraySurfaceLoadStore: {
int value;
HIP_CHECK(hipDeviceGetAttribute(&value, hipDeviceAttributeMaxSurface1D, device));
max1D = value;
HIP_CHECK(hipDeviceGetAttribute(&value, hipDeviceAttributeMaxSurface2D, device));
max2D = {value, value};
HIP_CHECK(hipDeviceGetAttribute(&value, hipDeviceAttributeMaxSurface3D, device));
max3D = {value, value, value};
return;
}
default: {
INFO("Array flag not supported");
REQUIRE(false);
return;
}
}
}
};