SWDEV-303204 - Disable texture/image Apis on some devices. (#2381)
Modify texture tests to pass on devices that don't support texture. Add hipDeviceAttributeImageSupport to check image support in runtime Change-Id: Ia89c494e651a6198a24448b59a91e046a9ebea38
Этот коммит содержится в:
@@ -29,11 +29,12 @@ THE SOFTWARE.
|
||||
// texture object is a kernel argument
|
||||
template <typename TYPE_t>
|
||||
__global__ void texture2dCopyKernel( hipTextureObject_t texObj, TYPE_t* dst,TYPE_t* A) {
|
||||
|
||||
#if !defined(__HIP_NO_IMAGE_SUPPORT) || !__HIP_NO_IMAGE_SUPPORT
|
||||
for(int i =0;i<SIZE_H;i++)
|
||||
for(int j = 0;j<SIZE_W;j++)
|
||||
dst[SIZE_W*i+j] = tex2D<TYPE_t>(texObj, j, i);
|
||||
__syncthreads();
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename TYPE_t>
|
||||
@@ -76,7 +77,7 @@ void texture2Dtest()
|
||||
texDescr.readMode = hipReadModeElementType;
|
||||
|
||||
hipTextureObject_t texObj;
|
||||
HIPCHECK( hipCreateTextureObject(&texObj, &texRes, &texDescr, NULL));
|
||||
HIPCHECK(hipCreateTextureObject(&texObj, &texRes, &texDescr, NULL));
|
||||
|
||||
HIPCHECK(hipMalloc((void**)&devPtrB, SIZE_W*sizeof(TYPE_t)*SIZE_H)) ;
|
||||
|
||||
@@ -95,6 +96,13 @@ void texture2Dtest()
|
||||
|
||||
int main()
|
||||
{
|
||||
int imageSupport = 0;
|
||||
hipDeviceGetAttribute(&imageSupport, hipDeviceAttributeImageSupport,
|
||||
p_gpuDevice);
|
||||
if (!imageSupport) {
|
||||
printf("Texture is not support on the device\n");
|
||||
passed();
|
||||
}
|
||||
texture2Dtest<float>();
|
||||
texture2Dtest<int>();
|
||||
texture2Dtest<unsigned char>();
|
||||
|
||||
Ссылка в новой задаче
Block a user