From a5d9f56befa03a792af75fc7ccaa37f7bbbea43d Mon Sep 17 00:00:00 2001 From: Anusha Godavarthy Surya Date: Wed, 9 Oct 2019 16:26:06 +0530 Subject: [PATCH 1/3] Fix undefine ref to hipUbindTexture for texture types --- hipamd/src/hip_texture.cpp | 7 +++---- hipamd/tests/src/texture/hipNormalizedFloatValueTex.cpp | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hipamd/src/hip_texture.cpp b/hipamd/src/hip_texture.cpp index 6d4ef24673..8820878fc0 100644 --- a/hipamd/src/hip_texture.cpp +++ b/hipamd/src/hip_texture.cpp @@ -634,16 +634,15 @@ hipError_t hipBindTextureToMipmappedArray(textureReference* tex, return ihipLogStatus(hip_status); } -hipError_t ihipUnbindTextureImpl(TlsData *tls, const hipTextureObject_t& textureObject) { +hipError_t ihipUnbindTextureImpl(const hipTextureObject_t& textureObject) { hipError_t hip_status = hipSuccess; - + TlsData* tls=tls_get_ptr(); auto ctx = ihipGetTlsDefaultCtx(); if (ctx) { hc::accelerator acc = ctx->getDevice()->_acc; auto device = ctx->getWriteableDevice(); hsa_agent_t* agent = static_cast(acc.get_hsa_agent()); - hipTexture* pTexture = textureHash[textureObject]; if (pTexture != nullptr) { hsa_ext_image_destroy(*agent, pTexture->image); @@ -659,7 +658,7 @@ hipError_t ihipUnbindTextureImpl(TlsData *tls, const hipTextureObject_t& texture hipError_t hipUnbindTexture(const textureReference* tex) { HIP_INIT_API(hipUnbindTexture, tex); hipError_t hip_status = hipSuccess; - hip_status = ihipUnbindTextureImpl(tls, tex->textureObject); + hip_status = ihipUnbindTextureImpl(tex->textureObject); return ihipLogStatus(hip_status); } diff --git a/hipamd/tests/src/texture/hipNormalizedFloatValueTex.cpp b/hipamd/tests/src/texture/hipNormalizedFloatValueTex.cpp index e519605157..fd2e8ccf0f 100644 --- a/hipamd/tests/src/texture/hipNormalizedFloatValueTex.cpp +++ b/hipamd/tests/src/texture/hipNormalizedFloatValueTex.cpp @@ -91,6 +91,7 @@ bool textureTest(enum hipArray_Format texFormat) } hipFree(dData); hipFree(dOutputData); + hipUnbindTexture(textureNormalizedVal_1D); delete [] hOutputData; return testResult; } From 20cfe178055926993ed9e0d2ca3c0f24356a5bc1 Mon Sep 17 00:00:00 2001 From: Anusha Godavarthy Surya Date: Tue, 15 Oct 2019 11:34:15 +0530 Subject: [PATCH 2/3] Added unbind texture to samples and tests --- hipamd/samples/2_Cookbook/11_texture_driver/texture2dDrv.cpp | 1 + hipamd/tests/src/texture/hipTextureRef2D.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/hipamd/samples/2_Cookbook/11_texture_driver/texture2dDrv.cpp b/hipamd/samples/2_Cookbook/11_texture_driver/texture2dDrv.cpp index 2cb9877cac..0aa9ef2913 100644 --- a/hipamd/samples/2_Cookbook/11_texture_driver/texture2dDrv.cpp +++ b/hipamd/samples/2_Cookbook/11_texture_driver/texture2dDrv.cpp @@ -124,6 +124,7 @@ bool runTest(int argc, char** argv) { } } } + hipUnbindTexture(tex); hipFree(dData); hipFreeArray(array); return true; diff --git a/hipamd/tests/src/texture/hipTextureRef2D.cpp b/hipamd/tests/src/texture/hipTextureRef2D.cpp index 2fb4097b0a..b476ae8062 100644 --- a/hipamd/tests/src/texture/hipTextureRef2D.cpp +++ b/hipamd/tests/src/texture/hipTextureRef2D.cpp @@ -90,6 +90,7 @@ int runTest(int argc, char** argv) { } } } + HIPCHECK(hipUnbindTexture(tex)); hipFree(dData); hipFreeArray(hipArray); return testResult; From b9c8dd8ac6efcd95f51eee083ee1f5f5780f2af3 Mon Sep 17 00:00:00 2001 From: Anusha Godavarthy Surya Date: Fri, 25 Oct 2019 12:21:41 +0530 Subject: [PATCH 3/3] Fixed CI build failure --- hipamd/include/hip/nvcc_detail/hip_runtime_api.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hipamd/include/hip/nvcc_detail/hip_runtime_api.h b/hipamd/include/hip/nvcc_detail/hip_runtime_api.h index 97551d15d4..ee08c668e9 100644 --- a/hipamd/include/hip/nvcc_detail/hip_runtime_api.h +++ b/hipamd/include/hip/nvcc_detail/hip_runtime_api.h @@ -1383,6 +1383,11 @@ inline static hipError_t hipUnbindTexture(struct texture* tex) return hipCUDAErrorTohipError(cudaUnbindTexture(tex)); } +template +inline static hipError_t hipUnbindTexture(struct texture &tex) { + return hipCUDAErrorTohipError(cudaUnbindTexture(tex)); +} + inline static hipError_t hipBindTexture(size_t* offset, textureReference* tex, const void* devPtr, const hipChannelFormatDesc* desc, size_t size = UINT_MAX){ return hipCUDAErrorTohipError(cudaBindTexture(offset, tex, devPtr, desc, size));