mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23:03:02 +08:00
Refactor calculating maxMemAllocSize
Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
a4eb90a933
commit
217d067ad5
@@ -118,7 +118,6 @@ class Device : public ReferenceTrackedObject<Device> {
|
||||
std::unique_ptr<SyncBufferHandler> syncBufferHandler;
|
||||
GraphicsAllocation *getRTMemoryBackedBuffer() { return rtMemoryBackedBuffer; }
|
||||
void initializeRayTracing();
|
||||
void reduceMaxMemAllocSize();
|
||||
|
||||
virtual uint64_t getGlobalMemorySize(uint32_t deviceBitfield) const;
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "shared/source/debugger/debugger.h"
|
||||
#include "shared/source/device/device.h"
|
||||
#include "shared/source/helpers/api_specific_config.h"
|
||||
#include "shared/source/helpers/basic_math.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/memory_manager/memory_manager.h"
|
||||
@@ -72,6 +73,7 @@ void Device::initializeCaps() {
|
||||
deviceInfo.maxMemAllocSize = std::min(deviceInfo.globalMemSize, deviceInfo.maxMemAllocSize); // if globalMemSize was reduced for 32b
|
||||
|
||||
if (!deviceInfo.sharedSystemAllocationsSupport) {
|
||||
deviceInfo.maxMemAllocSize = ApiSpecificConfig::getReducedMaxAllocSize(deviceInfo.maxMemAllocSize);
|
||||
deviceInfo.maxMemAllocSize = std::min(deviceInfo.maxMemAllocSize, this->hardwareCapabilities.maxMemAllocSize);
|
||||
}
|
||||
|
||||
@@ -168,16 +170,4 @@ void Device::initializeCaps() {
|
||||
deviceInfo.name = deviceName.str();
|
||||
}
|
||||
|
||||
void Device::reduceMaxMemAllocSize() {
|
||||
deviceInfo.maxMemAllocSize = std::min(deviceInfo.globalMemSize, getGlobalMemorySize(1u));
|
||||
|
||||
if (!deviceInfo.sharedSystemAllocationsSupport) {
|
||||
deviceInfo.maxMemAllocSize /= 2;
|
||||
deviceInfo.maxMemAllocSize = std::min(deviceInfo.maxMemAllocSize, this->hardwareCapabilities.maxMemAllocSize);
|
||||
}
|
||||
|
||||
// OpenCL 1.2 requires 128MB minimum
|
||||
deviceInfo.maxMemAllocSize = std::max(deviceInfo.maxMemAllocSize, static_cast<uint64_t>(128llu * MB));
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#pragma once
|
||||
namespace NEO {
|
||||
struct ApiSpecificConfig {
|
||||
@@ -15,5 +17,6 @@ struct ApiSpecificConfig {
|
||||
static bool getBindlessConfiguration();
|
||||
static ApiType getApiType();
|
||||
static const char *getAubPrefixForSpecificApi();
|
||||
static uint64_t getReducedMaxAllocSize(uint64_t maxAllocSize);
|
||||
};
|
||||
} // namespace NEO
|
||||
} // namespace NEO
|
||||
|
||||
Reference in New Issue
Block a user