From b3dd1b53d7b340d05b2c4789544eb8efa140e4dc Mon Sep 17 00:00:00 2001 From: foreman Date: Tue, 25 Apr 2017 20:51:55 -0400 Subject: [PATCH] P4 to Git Change 1402535 by lmoriche@lmoriche_opencl_dev2 on 2017/04/25 20:42:52 SWDEV-102726 - [OCL-LC-ROCm] Open source OpenCL Runtime - Use the access flags in the metadata to handle read-only arguments. Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.cpp#35 edit [ROCm/clr commit: 6e6d58727cb92ccaa15dea5397c8b49e33669d65] --- .../rocclr/runtime/device/rocm/rocvirtual.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/projects/clr/rocclr/runtime/device/rocm/rocvirtual.cpp b/projects/clr/rocclr/runtime/device/rocm/rocvirtual.cpp index 0e214a7cb8..1710830703 100644 --- a/projects/clr/rocclr/runtime/device/rocm/rocvirtual.cpp +++ b/projects/clr/rocclr/runtime/device/rocm/rocvirtual.cpp @@ -1514,8 +1514,13 @@ bool VirtualGPU::submitKernelInternal(const amd::NDRangeContainer& sizes, const void* globalAddress = devMem->getDeviceMemory(); argPtr = addArg(argPtr, &globalAddress, arg->size_, arg->alignment_); - //! @todo Compiler has to return read/write attributes - if ((mem->getMemFlags() & CL_MEM_READ_ONLY) == 0) { + const bool readOnly = +#if defined(WITH_LIGHTNING_COMPILER) + signature.at(arg->index_).typeQualifier_ == CL_KERNEL_ARG_TYPE_CONST || +#endif // defined(WITH_LIGHTNING_COMPILER) + (mem->getMemFlags() & CL_MEM_READ_ONLY) != 0; + + if (!readOnly) { mem->signalWrite(&dev()); } break; @@ -1551,8 +1556,13 @@ bool VirtualGPU::submitKernelInternal(const amd::NDRangeContainer& sizes, const HSA_IMAGE_OBJECT_ALIGNMENT); } - //! @todo Compiler has to return read/write attributes - if ((mem->getMemFlags() & CL_MEM_READ_ONLY) == 0) { + const bool readOnly = +#if defined(WITH_LIGHTNING_COMPILER) + signature.at(arg->index_).accessQualifier_ == CL_KERNEL_ARG_ACCESS_READ_ONLY || +#endif // defined(WITH_LIGHTNING_COMPILER) + mem->getMemFlags() & CL_MEM_READ_ONLY; + + if (!readOnly) { mem->signalWrite(&dev()); } break;