From 0723455cb59987a1e2d31d478c0ad77859c1d3a2 Mon Sep 17 00:00:00 2001 From: "Hoppe, Mateusz" Date: Fri, 17 Aug 2018 11:00:21 +0200 Subject: [PATCH] Add localMemorySupported flag to HardwareCapabilities Change-Id: Ie57aa6418eecdd288001ded2605c731dd61b9879 --- runtime/device/device.cpp | 2 ++ runtime/device/device.h | 2 ++ runtime/device/device_caps.cpp | 8 +++----- runtime/helpers/hw_helper.inl | 1 + runtime/helpers/hw_info.h | 1 + runtime/program/program.cpp | 4 +--- unit_tests/helpers/hw_helper_default_tests.cpp | 1 + 7 files changed, 11 insertions(+), 8 deletions(-) diff --git a/runtime/device/device.cpp b/runtime/device/device.cpp index 96551a5fcb..2bc3681c17 100644 --- a/runtime/device/device.cpp +++ b/runtime/device/device.cpp @@ -92,6 +92,8 @@ Device::Device(const HardwareInfo &hwInfo, ExecutionEnvironment *executionEnviro this->executionEnvironment->initSourceLevelDebugger(hwInfo); } this->executionEnvironment->incRefInternal(); + auto &hwHelper = HwHelper::get(hwInfo.pPlatform->eRenderCoreFamily); + hwHelper.setupHardwareCapabilities(&this->hardwareCapabilities); } Device::~Device() { diff --git a/runtime/device/device.h b/runtime/device/device.h index 4e3afb3226..eb2873c211 100644 --- a/runtime/device/device.h +++ b/runtime/device/device.h @@ -130,6 +130,7 @@ class Device : public BaseObject<_cl_device_id> { bool isSourceLevelDebuggerActive() const; SourceLevelDebugger *getSourceLevelDebugger() { return executionEnvironment->sourceLevelDebugger.get(); } ExecutionEnvironment *getExecutionEnvironment() const { return executionEnvironment; } + const HardwareCapabilities &getHardwareCapabilities() { return hardwareCapabilities; } protected: Device() = delete; @@ -153,6 +154,7 @@ class Device : public BaseObject<_cl_device_id> { unsigned int enabledClVersion; const HardwareInfo &hwInfo; + HardwareCapabilities hardwareCapabilities = {}; DeviceInfo deviceInfo; volatile uint32_t *tagAddress; diff --git a/runtime/device/device_caps.cpp b/runtime/device/device_caps.cpp index 0f475a77c2..5fb355df4f 100644 --- a/runtime/device/device_caps.cpp +++ b/runtime/device/device_caps.cpp @@ -110,9 +110,7 @@ void Device::initializeCaps() { driverVersion.assign(driverInfo.get()->getVersion(driverVersion).c_str()); } - HardwareCapabilities hwCaps = {0}; auto &hwHelper = HwHelper::get(hwInfo.pPlatform->eRenderCoreFamily); - hwHelper.setupHardwareCapabilities(&hwCaps); deviceInfo.name = name.c_str(); deviceInfo.driverVersion = driverVersion.c_str(); @@ -256,7 +254,7 @@ void Device::initializeCaps() { // OpenCL 1.2 requires 128MB minimum auto maxMemAllocSize = std::max((uint64_t)(deviceInfo.globalMemSize / 2), (uint64_t)(128 * MB)); - deviceInfo.maxMemAllocSize = std::min(maxMemAllocSize, hwCaps.maxMemAllocSize); + deviceInfo.maxMemAllocSize = std::min(maxMemAllocSize, this->hardwareCapabilities.maxMemAllocSize); deviceInfo.maxConstantBufferSize = deviceInfo.maxMemAllocSize; @@ -312,8 +310,8 @@ void Device::initializeCaps() { deviceInfo.imageSupport = CL_TRUE; deviceInfo.image2DMaxWidth = 16384; deviceInfo.image2DMaxHeight = 16384; - deviceInfo.image3DMaxWidth = hwCaps.image3DMaxWidth; - deviceInfo.image3DMaxHeight = hwCaps.image3DMaxHeight; + deviceInfo.image3DMaxWidth = this->hardwareCapabilities.image3DMaxWidth; + deviceInfo.image3DMaxHeight = this->hardwareCapabilities.image3DMaxHeight; deviceInfo.image3DMaxDepth = 2048; deviceInfo.imageMaxArraySize = 2048; diff --git a/runtime/helpers/hw_helper.inl b/runtime/helpers/hw_helper.inl index a700391000..2ecaa7930f 100644 --- a/runtime/helpers/hw_helper.inl +++ b/runtime/helpers/hw_helper.inl @@ -42,6 +42,7 @@ void HwHelperHw::setupHardwareCapabilities(HardwareCapabilities *caps) { //Reason to subtract 8KB is that driver may pad the buffer with addition pages for over fetching.. caps->maxMemAllocSize = (4ULL * MemoryConstants::gigaByte) - (8ULL * MemoryConstants::kiloByte); caps->isStatelesToStatefullWithOffsetSupported = true; + caps->localMemorySupported = false; } template diff --git a/runtime/helpers/hw_info.h b/runtime/helpers/hw_info.h index 765659112e..06f00bb26e 100644 --- a/runtime/helpers/hw_info.h +++ b/runtime/helpers/hw_info.h @@ -85,6 +85,7 @@ struct HardwareCapabilities { size_t image3DMaxHeight; uint64_t maxMemAllocSize; bool isStatelesToStatefullWithOffsetSupported; + bool localMemorySupported; }; struct HardwareInfo { diff --git a/runtime/program/program.cpp b/runtime/program/program.cpp index 0a3900377c..4c2373a455 100644 --- a/runtime/program/program.cpp +++ b/runtime/program/program.cpp @@ -90,9 +90,7 @@ Program::Program(ExecutionEnvironment &executionEnvironment, Context *context, b } kernelDebugEnabled = pDevice->isSourceLevelDebuggerActive(); - HardwareCapabilities hwCaps = {0}; - HwHelper::get(pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily).setupHardwareCapabilities(&hwCaps); - auto enableStatelessToStatefullWithOffset = hwCaps.isStatelesToStatefullWithOffsetSupported; + auto enableStatelessToStatefullWithOffset = pDevice->getHardwareCapabilities().isStatelesToStatefullWithOffsetSupported; if (DebugManager.flags.EnableStatelessToStatefulBufferOffsetOpt.get() != -1) { enableStatelessToStatefullWithOffset = DebugManager.flags.EnableStatelessToStatefulBufferOffsetOpt.get() != 0; } diff --git a/unit_tests/helpers/hw_helper_default_tests.cpp b/unit_tests/helpers/hw_helper_default_tests.cpp index 05cb9118fc..093d41bff6 100644 --- a/unit_tests/helpers/hw_helper_default_tests.cpp +++ b/unit_tests/helpers/hw_helper_default_tests.cpp @@ -31,4 +31,5 @@ void testDefaultImplementationOfSetupHardwareCapabilities(HwHelper &hwHelper) { EXPECT_EQ(16384u, hwCaps.image3DMaxHeight); EXPECT_EQ(16384u, hwCaps.image3DMaxWidth); EXPECT_TRUE(hwCaps.isStatelesToStatefullWithOffsetSupported); + EXPECT_FALSE(hwCaps.localMemorySupported); }