From 9021c30aad443d8663a2b53a6859c4dfad499fa5 Mon Sep 17 00:00:00 2001
From: foreman
Date: Thu, 14 Sep 2017 16:26:32 -0400
Subject: [PATCH] P4 to Git Change 1459027 by wchau@wchau_OCL_boltzmann on
2017/09/14 15:39:04
SWDEV-111439 - Add query for preferred constant size
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_device.cpp#67 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/headers/opencl1.2/CL/cl.hpp#7 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/headers/opencl1.2/CL/cl_ext.h#18 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl.hpp#9 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl_ext.h#34 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/headers/opencl2.1/CL/cl.hpp#6 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/headers/opencl2.1/CL/cl_ext.h#11 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/headers/opencl2.2/CL/cl.hpp#5 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/headers/opencl2.2/CL/cl_ext.h#5 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#291 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#575 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#61 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#61 edit
[ROCm/clr commit: b44fd81c76d84cc165cb12f50242f2843a4ab691]
---
projects/clr/rocclr/runtime/device/device.hpp | 3 +++
projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp | 1 +
projects/clr/rocclr/runtime/device/pal/paldevice.cpp | 1 +
projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp | 1 +
4 files changed, 6 insertions(+)
diff --git a/projects/clr/rocclr/runtime/device/device.hpp b/projects/clr/rocclr/runtime/device/device.hpp
index 15d8d631ab..1916ef12e5 100644
--- a/projects/clr/rocclr/runtime/device/device.hpp
+++ b/projects/clr/rocclr/runtime/device/device.hpp
@@ -382,6 +382,9 @@ struct Info : public amd::EmbeddedObject {
//! Max size in bytes of a constant buffer allocation.
cl_ulong maxConstantBufferSize_;
+ //! Preferred size in bytes of a constant buffer allocation.
+ cl_ulong preferredConstantBufferSize_;
+
//! Max number of arguments declared
cl_uint maxConstantArgs_;
diff --git a/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp b/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
index b6d3b77974..44875714c1 100644
--- a/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
+++ b/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
@@ -434,6 +434,7 @@ void NullDevice::fillDeviceInfo(const CALdeviceattribs& calAttr, const gslMemInf
//! should be able to create a view with 256 bytes alignement
info_.memBaseAddrAlign_ = 8 * MemBaseAlignment;
+ info_.preferredConstantBufferSize_ = 64 * Ki;
info_.maxConstantBufferSize_ = (settings().ciPlus_) ? info_.maxMemAllocSize_ : 64 * Ki;
info_.maxConstantArgs_ = MaxConstArguments;
diff --git a/projects/clr/rocclr/runtime/device/pal/paldevice.cpp b/projects/clr/rocclr/runtime/device/pal/paldevice.cpp
index 2fd57ee4f9..85e86b2ddb 100644
--- a/projects/clr/rocclr/runtime/device/pal/paldevice.cpp
+++ b/projects/clr/rocclr/runtime/device/pal/paldevice.cpp
@@ -377,6 +377,7 @@ void NullDevice::fillDeviceInfo(const Pal::DeviceProperties& palProp,
//! should be able to create a view with 256 bytes alignement
info_.memBaseAddrAlign_ = 8 * MemBaseAlignment;
+ info_.preferredConstantBufferSize_ = 64 * Ki;
info_.maxConstantBufferSize_ = info_.maxMemAllocSize_;
info_.maxConstantArgs_ = MaxConstArguments;
diff --git a/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp b/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp
index e719fdd9fb..315343dcb6 100644
--- a/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp
+++ b/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp
@@ -933,6 +933,7 @@ bool Device::populateOCLDeviceConstants() {
info_.minDataTypeAlignSize_ = sizeof(cl_long16);
info_.maxConstantArgs_ = 8;
+ info_.preferredConstantBufferSize_ = 64 * Ki;
info_.maxConstantBufferSize_ = info_.maxMemAllocSize_;
info_.localMemType_ = CL_LOCAL;
info_.errorCorrectionSupport_ = false;