From 1af35a604453768eb33e99466cd29dacd37eaa78 Mon Sep 17 00:00:00 2001 From: vsytch Date: Mon, 27 Jan 2020 19:37:00 -0500 Subject: [PATCH] Add missing texturePitchAlignment member to the hipDeviceProp_t struct. (#1802) * Add missing texturePitchAlignment member to the hipDeviceProp_t struct. * Add missing hipDeviceAttributeTexturePitchAlignment enumerator to the hipDeviceAttribute_t enum. * Initialize texturePitchAlignment to 256. This works for gfx9+, but is technically overaligned in most cases for pre-gfx9. * Add the texturePitchAlignment property to the NVCC path. [ROCm/hip commit: f72a669487dd352e45321c4b3038f8fe2365c236] --- projects/hip/include/hip/hip_runtime_api.h | 2 ++ projects/hip/include/hip/nvcc_detail/hip_runtime_api.h | 4 ++++ projects/hip/src/hip_device.cpp | 5 ++++- projects/hip/src/hip_hcc.cpp | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/projects/hip/include/hip/hip_runtime_api.h b/projects/hip/include/hip/hip_runtime_api.h index e725846cbd..64b2a85d8a 100644 --- a/projects/hip/include/hip/hip_runtime_api.h +++ b/projects/hip/include/hip/hip_runtime_api.h @@ -124,6 +124,7 @@ typedef struct hipDeviceProp_t { unsigned int* hdpRegFlushCntl; ///< Addres of HDP_REG_COHERENCY_FLUSH_CNTL register size_t memPitch; ///memPitch = cdprop.memPitch; p_prop->textureAlignment = cdprop.textureAlignment; + p_prop->texturePitchAlignment = cdprop.texturePitchAlignment; p_prop->kernelExecTimeoutEnabled = cdprop.kernelExecTimeoutEnabled; p_prop->ECCEnabled = cdprop.ECCEnabled; p_prop->tccDriver = cdprop.tccDriver; @@ -1244,6 +1245,9 @@ inline static hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t att case hipDeviceAttributeTextureAlignment: cdattr = cudaDevAttrTextureAlignment; break; + case hipDeviceAttributeTexturePitchAlignment: + cdattr = cudaDevAttrTexturePitchAlignment; + break; case hipDeviceAttributeKernelExecTimeout: cdattr = cudaDevAttrKernelExecTimeout; break; diff --git a/projects/hip/src/hip_device.cpp b/projects/hip/src/hip_device.cpp index 403194483a..aa89e62271 100644 --- a/projects/hip/src/hip_device.cpp +++ b/projects/hip/src/hip_device.cpp @@ -312,9 +312,12 @@ hipError_t ihipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device case hipDeviceAttributeMaxPitch: *pi = prop->memPitch; break; - case hipDeviceAttributeTextureAlignment: + case hipDeviceAttributeTextureAlignment: *pi = prop->textureAlignment; break; + case hipDeviceAttributeTexturePitchAlignment: + *pi = prop->texturePitchAlignment; + break; case hipDeviceAttributeKernelExecTimeout: *pi = prop->kernelExecTimeoutEnabled; break; diff --git a/projects/hip/src/hip_hcc.cpp b/projects/hip/src/hip_hcc.cpp index 63bc8fe14f..175d301ee1 100644 --- a/projects/hip/src/hip_hcc.cpp +++ b/projects/hip/src/hip_hcc.cpp @@ -925,6 +925,7 @@ hipError_t ihipDevice_t::initProperties(hipDeviceProp_t* prop) { prop->memPitch = INT_MAX; //Maximum pitch in bytes allowed by memory copies (hardcoded 128 bytes in hipMallocPitch) prop->textureAlignment = 0; //Alignment requirement for textures + prop->texturePitchAlignment = IMAGE_PITCH_ALIGNMENT; //Alignment requirment for texture pitch prop->kernelExecTimeoutEnabled = 0; //no run time limit for running kernels on device hsa_isa_t isa;