From 40b90694c66ebbb6e7cfcb5441aaa79107f1c014 Mon Sep 17 00:00:00 2001 From: Rahul Garg Date: Fri, 9 Oct 2020 19:07:04 +0000 Subject: [PATCH] Add image1DMaxWidth_ for maxTexture1D property Needed by SWDEV-254068 Change-Id: Ic650dfb6e5b38d7544ba647c53de52deda39b92d [ROCm/clr commit: c0f8b52f067e9013052c61869ea9b2abf1a8763f] --- projects/clr/rocclr/device/device.hpp | 3 +++ projects/clr/rocclr/device/gpu/gpudevice.cpp | 1 + projects/clr/rocclr/device/pal/paldevice.cpp | 1 + projects/clr/rocclr/device/rocm/rocdevice.cpp | 9 +++++++++ 4 files changed, 14 insertions(+) diff --git a/projects/clr/rocclr/device/device.hpp b/projects/clr/rocclr/device/device.hpp index d0fdc72769..ba7d2a276c 100755 --- a/projects/clr/rocclr/device/device.hpp +++ b/projects/clr/rocclr/device/device.hpp @@ -432,6 +432,9 @@ struct Info : public amd::EmbeddedObject { //! Returns the list of built-in kernels, supported by the device const char* builtInKernels_; + //! Returns max number of pixels for a 1D image + size_t image1DMaxWidth_; + //! Returns max number of pixels for a 1D image created from a buffer object size_t imageMaxBufferSize_; diff --git a/projects/clr/rocclr/device/gpu/gpudevice.cpp b/projects/clr/rocclr/device/gpu/gpudevice.cpp index 7bf80cbeef..176ce6677f 100644 --- a/projects/clr/rocclr/device/gpu/gpudevice.cpp +++ b/projects/clr/rocclr/device/gpu/gpudevice.cpp @@ -541,6 +541,7 @@ void NullDevice::fillDeviceInfo(const CALdeviceattribs& calAttr, const gslMemInf // OpenCL1.2 device info fields info_.builtInKernels_ = ""; info_.imageMaxBufferSize_ = MaxImageBufferSize; + info_.image1DMaxWidth_ = maxTextureSize; info_.imageMaxArraySize_ = MaxImageArraySize; info_.preferredInteropUserSync_ = true; info_.printfBufferSize_ = PrintfDbg::WorkitemDebugSize * info().maxWorkGroupSize_; diff --git a/projects/clr/rocclr/device/pal/paldevice.cpp b/projects/clr/rocclr/device/pal/paldevice.cpp index a6eb57b8e4..4521d4b4f1 100755 --- a/projects/clr/rocclr/device/pal/paldevice.cpp +++ b/projects/clr/rocclr/device/pal/paldevice.cpp @@ -619,6 +619,7 @@ void NullDevice::fillDeviceInfo(const Pal::DeviceProperties& palProp, // OpenCL1.2 device info fields info_.builtInKernels_ = ""; info_.imageMaxBufferSize_ = MaxImageBufferSize; + info_.image1DMaxWidth_ = maxTextureSize; info_.imageMaxArraySize_ = MaxImageArraySize; info_.preferredInteropUserSync_ = true; info_.printfBufferSize_ = PrintfDbg::WorkitemDebugSize * info().maxWorkGroupSize_; diff --git a/projects/clr/rocclr/device/rocm/rocdevice.cpp b/projects/clr/rocclr/device/rocm/rocdevice.cpp index 004be5a9c0..315903909f 100755 --- a/projects/clr/rocclr/device/rocm/rocdevice.cpp +++ b/projects/clr/rocclr/device/rocm/rocdevice.cpp @@ -1341,6 +1341,15 @@ bool Device::populateOCLDeviceConstants() { info_.imageMaxArraySize_ = max_array_size; + uint32_t max_image1d_width = 0; + if (HSA_STATUS_SUCCESS != + hsa_agent_get_info(_bkendDevice, + static_cast(HSA_EXT_AGENT_INFO_IMAGE_1D_MAX_ELEMENTS), + &max_image1d_width)) { + return false; + } + info_.image1DMaxWidth_ = max_image1d_width; + if (HSA_STATUS_SUCCESS != hsa_agent_get_info(_bkendDevice, static_cast(HSA_EXT_AGENT_INFO_IMAGE_1DB_MAX_ELEMENTS),