From 3f1cb973061ffc95590ff0ab200e1a53a6456776 Mon Sep 17 00:00:00 2001 From: Tao Sang Date: Fri, 20 Aug 2021 17:47:05 -0400 Subject: [PATCH] SWDEV-299966 - Fix hipModuleGetTexRef hipModuleGetTexRef() returns success for any global device variable name even if it's not a texture. This is wrong thus will fail "hipModuleTexture2dDrv --tests 0x14" This patch will compare the size to overcome this issue somehow. Change-Id: I4a4d96f947a68713036437ee525359ff412fefe2 --- hipamd/src/hip_platform.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hipamd/src/hip_platform.cpp b/hipamd/src/hip_platform.cpp index bc45c970dd..800e9c180a 100644 --- a/hipamd/src/hip_platform.cpp +++ b/hipamd/src/hip_platform.cpp @@ -875,6 +875,10 @@ hipError_t PlatformState::getDynTexRef(const char* hostVar, hipModule_t hmod, te hip::DeviceVar* dvar = nullptr; IHIP_RETURN_ONFAIL(it->second->getDeviceVar(&dvar, hostVar)); + if (dvar->size() != sizeof(textureReference)) { + return hipErrorNotFound; // Any better way to verify texture type? + } + dvar->shadowVptr = new texture(); *texRef = reinterpret_cast(dvar->shadowVptr); return hipSuccess;