Move sharedSystemMemCapabilities to hwInfo

Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
Related-To: NEO-6075
This commit is contained in:
Kamil Kopryk 2021-11-17 11:26:26 +00:00 committed by Compute-Runtime-Automation
parent 8130727232
commit 7bbb43a563
29 changed files with 62 additions and 22 deletions

View File

@ -858,7 +858,7 @@ TEST_F(DeviceTest, givenCallToDevicePropertiesThenMaximumMemoryToBeAllocatedIsCo
auto &hwHelper = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily);
auto expectedSize = this->neoDevice->getDeviceInfo().globalMemSize;
if (!this->neoDevice->getDeviceInfo().sharedSystemAllocationsSupport) {
if (!this->neoDevice->areSharedSystemAllocationsAllowed()) {
expectedSize = std::min(expectedSize, hwHelper.getMaxMemAllocSize());
}
EXPECT_EQ(deviceProperties.maxMemAllocSize, expectedSize);

View File

@ -467,7 +467,7 @@ TEST_F(MemoryRelaxedSizeTests,
TEST_F(MemoryRelaxedSizeTests,
givenCallToDeviceAllocWithLargerThanAllowedSizeAndRelaxedFlagThenAllocationIsMade) {
if (device->getDeviceInfo().sharedSystemAllocationsSupport) {
if (device->getNEODevice()->areSharedSystemAllocationsAllowed()) {
GTEST_SKIP();
}
size_t size = device->getNEODevice()->getDeviceInfo().maxMemAllocSize + 1;
@ -492,7 +492,7 @@ TEST_F(MemoryRelaxedSizeTests,
TEST_F(MemoryRelaxedSizeTests,
givenCallToDeviceAllocWithLargerThanAllowedSizeAndDebugFlagThenAllocationIsMade) {
if (device->getDeviceInfo().sharedSystemAllocationsSupport) {
if (device->getNEODevice()->areSharedSystemAllocationsAllowed()) {
GTEST_SKIP();
}
DebugManagerStateRestore restorer;
@ -607,7 +607,7 @@ TEST_F(MemoryRelaxedSizeTests,
TEST_F(MemoryRelaxedSizeTests,
givenCallToSharedAllocWithLargerThanAllowedSizeAndRelaxedFlagThenAllocationIsMade) {
if (device->getDeviceInfo().sharedSystemAllocationsSupport) {
if (device->getNEODevice()->areSharedSystemAllocationsAllowed()) {
GTEST_SKIP();
}
size_t size = device->getNEODevice()->getDeviceInfo().maxMemAllocSize + 1;
@ -634,7 +634,7 @@ TEST_F(MemoryRelaxedSizeTests,
TEST_F(MemoryRelaxedSizeTests,
givenCallToSharedAllocWithLargerThanAllowedSizeAndDebugFlagThenAllocationIsMade) {
if (device->getDeviceInfo().sharedSystemAllocationsSupport) {
if (device->getNEODevice()->areSharedSystemAllocationsAllowed()) {
GTEST_SKIP();
}
DebugManagerStateRestore restorer;

View File

@ -1651,7 +1651,7 @@ HWTEST_F(ModuleTranslationUnitTest, givenSystemSharedAllocationAllowedWhenBuildi
rootDeviceEnvironment->compilerInterface.reset(mockCompilerInterface);
{
neoDevice->deviceInfo.sharedSystemAllocationsSupport = true;
neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable.sharedSystemMemCapabilities = 1;
MockModuleTranslationUnit moduleTu(device);
auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr);
@ -1661,7 +1661,7 @@ HWTEST_F(ModuleTranslationUnitTest, givenSystemSharedAllocationAllowedWhenBuildi
}
{
neoDevice->deviceInfo.sharedSystemAllocationsSupport = false;
neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable.sharedSystemMemCapabilities = 0;
MockModuleTranslationUnit moduleTu(device);
auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr);

View File

@ -103,7 +103,7 @@ TEST_F(clSetKernelArgSVMPointerTests, GivenLocalAddressAndNullArgValueWhenSettin
TEST_F(clSetKernelArgSVMPointerTests, GivenInvalidArgValueWhenSettingKernelArgThenInvalidArgValueErrorIsReturned) {
pDevice->deviceInfo.sharedSystemMemCapabilities = 0u;
pDevice->sharedDeviceInfo.sharedSystemAllocationsSupport = false;
pDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable.sharedSystemMemCapabilities = 0;
void *ptrHost = malloc(256);
EXPECT_NE(nullptr, ptrHost);
@ -185,7 +185,7 @@ TEST_F(clSetKernelArgSVMPointerTests, GivenSvmAndPointerWithOffsetWhenSettingKer
TEST_F(clSetKernelArgSVMPointerTests, GivenSvmAndPointerWithInvalidOffsetWhenSettingKernelArgThenInvalidArgValueErrorIsReturned) {
pDevice->deviceInfo.sharedSystemMemCapabilities = 0u;
pDevice->sharedDeviceInfo.sharedSystemAllocationsSupport = false;
pDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable.sharedSystemMemCapabilities = 0;
const ClDeviceInfo &devInfo = pDevice->getDeviceInfo();
if (devInfo.svmCapabilities != 0) {
void *ptrSvm = clSVMAlloc(pContext, CL_MEM_READ_WRITE, 256, 4);

View File

@ -1457,7 +1457,7 @@ TEST_F(BuiltInTests, GivenTypeSourceWhenCreatingProgramFromCodeThenValidPointerI
TEST_F(BuiltInTests, givenCreateProgramFromSourceWhenDeviceSupportSharedSystemAllocationThenInternalOptionsDisableStosoFlag) {
auto builtinsLib = std::unique_ptr<BuiltinsLib>(new BuiltinsLib());
pClDevice->deviceInfo.sharedSystemMemCapabilities = CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL | CL_UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS_INTEL | CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ACCESS_INTEL | CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ATOMIC_ACCESS_INTEL;
pDevice->deviceInfo.sharedSystemAllocationsSupport = true;
pDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable.sharedSystemMemCapabilities = 1;
const BuiltinCode bc = builtinsLib->getBuiltinCode(EBuiltInOps::CopyBufferToBuffer, BuiltinCode::ECodeType::Source, *pDevice);
EXPECT_NE(0u, bc.resource.size());

View File

@ -181,7 +181,7 @@ TEST_F(DeviceGetCapsTest, WhenCreatingDeviceThenCapsArePopulatedCorrectly) {
EXPECT_LE(sharedCaps.maxReadImageArgs * sizeof(cl_mem), sharedCaps.maxParameterSize);
EXPECT_LE(sharedCaps.maxWriteImageArgs * sizeof(cl_mem), sharedCaps.maxParameterSize);
EXPECT_LE(128u * MB, sharedCaps.maxMemAllocSize);
if (!sharedCaps.sharedSystemAllocationsSupport) {
if (!device->areSharedSystemAllocationsAllowed()) {
EXPECT_GE((4 * GB) - (8 * KB), sharedCaps.maxMemAllocSize);
}
EXPECT_LE(65536u, sharedCaps.imageMaxBufferSize);

View File

@ -1699,7 +1699,7 @@ TEST_F(ProgramTests, WhenCreatingProgramThenBindlessIsEnabledOnlyIfDebugFlagIsEn
TEST_F(ProgramTests, givenDeviceThatSupportsSharedSystemMemoryAllocationWhenProgramIsCompiledThenItForcesStatelessCompilation) {
pClDevice->deviceInfo.sharedSystemMemCapabilities = CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL | CL_UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS_INTEL | CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ACCESS_INTEL | CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ATOMIC_ACCESS_INTEL;
pClDevice->sharedDeviceInfo.sharedSystemAllocationsSupport = true;
pClDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable.sharedSystemMemCapabilities = 1;
MockProgram program(pContext, false, toClDeviceVector(*pClDevice));
auto internalOptions = program.getInitInternalOptions();
EXPECT_TRUE(CompilerOptions::contains(internalOptions.c_str(), CompilerOptions::greaterThan4gbBuffersRequired)) << internalOptions;

View File

@ -122,6 +122,19 @@ macro(macro_for_each_platform)
list(APPEND CLOC_LIB_SRCS_LIB ${SRC_FILE})
endif()
endforeach()
if(WIN32)
set(SRC_FILE ${NEO_SOURCE_DIR}/shared/source${BRANCH}${GEN_TYPE_LOWER}${BRANCH_DIR}windows/hw_info_extra_${PLATFORM_IT_LOWER}.cpp)
if(EXISTS ${SRC_FILE})
list(APPEND CLOC_LIB_SRCS_LIB ${SRC_FILE})
endif()
else()
set(SRC_FILE ${NEO_SOURCE_DIR}/shared/source${BRANCH}${GEN_TYPE_LOWER}${BRANCH_DIR}linux/hw_info_extra_${PLATFORM_IT_LOWER}.cpp)
if(EXISTS ${SRC_FILE})
list(APPEND CLOC_LIB_SRCS_LIB ${SRC_FILE})
endif()
endif()
endforeach()
endforeach()
endmacro()

View File

@ -10,6 +10,7 @@
#include "shared/source/command_stream/command_stream_receiver.h"
#include "shared/source/command_stream/experimental_command_buffer.h"
#include "shared/source/command_stream/preemption.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/hw_helper.h"
@ -406,6 +407,14 @@ bool Device::isDebuggerActive() const {
return deviceInfo.debuggerActive;
}
bool Device::areSharedSystemAllocationsAllowed() const {
auto sharedSystemAllocationsSupport = static_cast<bool>(getHardwareInfo().capabilityTable.sharedSystemMemCapabilities);
if (DebugManager.flags.EnableSharedSystemUsmSupport.get() != -1) {
sharedSystemAllocationsSupport = DebugManager.flags.EnableSharedSystemUsmSupport.get();
}
return sharedSystemAllocationsSupport;
}
const std::vector<EngineControl> *Device::getNonEmptyEngineGroup(size_t index) const {
auto nonEmptyGroupIndex = 0u;
for (auto groupIndex = 0u; groupIndex < CommonConstants::engineGroupCount; groupIndex++) {

View File

@ -92,9 +92,7 @@ class Device : public ReferenceTrackedObject<Device> {
bool isFullRangeSvm() const {
return getRootDeviceEnvironment().isFullRangeSvm();
}
bool areSharedSystemAllocationsAllowed() const {
return this->deviceInfo.sharedSystemAllocationsSupport;
}
bool areSharedSystemAllocationsAllowed() const;
template <typename SpecializedDeviceT>
void setSpecializedDevice(SpecializedDeviceT *specializedDevice) {
this->specializedDevice = reinterpret_cast<uintptr_t>(specializedDevice);

View File

@ -38,11 +38,6 @@ void Device::initializeCaps() {
addressing32bitAllowed = false;
}
deviceInfo.sharedSystemAllocationsSupport = hwInfoConfig->getSharedSystemMemCapabilities();
if (DebugManager.flags.EnableSharedSystemUsmSupport.get() != -1) {
deviceInfo.sharedSystemAllocationsSupport = DebugManager.flags.EnableSharedSystemUsmSupport.get();
}
deviceInfo.vendorId = 0x8086;
deviceInfo.maxReadImageArgs = 128;
deviceInfo.maxWriteImageArgs = 128;
@ -72,7 +67,7 @@ void Device::initializeCaps() {
deviceInfo.globalMemSize = alignDown(deviceInfo.globalMemSize, MemoryConstants::pageSize);
deviceInfo.maxMemAllocSize = std::min(deviceInfo.globalMemSize, deviceInfo.maxMemAllocSize); // if globalMemSize was reduced for 32b
if (!deviceInfo.sharedSystemAllocationsSupport) {
if (!areSharedSystemAllocationsAllowed()) {
deviceInfo.maxMemAllocSize = ApiSpecificConfig::getReducedMaxAllocSize(deviceInfo.maxMemAllocSize);
deviceInfo.maxMemAllocSize = std::min(deviceInfo.maxMemAllocSize, hwHelper.getMaxMemAllocSize());
}

View File

@ -49,7 +49,6 @@ struct DeviceInfo {
uint32_t vmeAvcSupportsPreemption;
bool debuggerActive;
bool force32BitAddressess;
bool sharedSystemAllocationsSupport;
std::string name;
};

View File

@ -57,6 +57,15 @@ macro(macro_for_each_platform)
list(APPEND CORE_SRCS_${GEN_TYPE}_H_BASE ${PATH_TO_FILE})
endif()
set(SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR}${GEN_TYPE_LOWER}${BRANCH}linux/hw_info_extra_${PLATFORM_IT_LOWER}.cpp)
if(EXISTS ${SRC_FILE})
list(APPEND CORE_SRCS_${GEN_TYPE}_CPP_LINUX ${SRC_FILE})
endif()
set(SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR}${GEN_TYPE_LOWER}${BRANCH}windows/hw_info_extra_${PLATFORM_IT_LOWER}.cpp)
if(EXISTS ${SRC_FILE})
list(APPEND CORE_SRCS_${GEN_TYPE}_CPP_WINDOWS ${SRC_FILE})
endif()
set(SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR}${GEN_TYPE_LOWER}${BRANCH}linux/hw_info_config_${PLATFORM_IT_LOWER}.cpp)
if(EXISTS ${SRC_FILE})
list(APPEND CORE_SRCS_${GEN_TYPE}_CPP_LINUX ${SRC_FILE})
@ -65,6 +74,7 @@ macro(macro_for_each_platform)
if(EXISTS ${SRC_FILE})
list(APPEND CORE_SRCS_${GEN_TYPE}_CPP_WINDOWS ${SRC_FILE})
endif()
set(SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR}${GEN_TYPE_LOWER}${BRANCH}enable_hw_info_config_${PLATFORM_IT_LOWER}.cpp)
if(EXISTS ${SRC_FILE})
list(APPEND ${GEN_TYPE}_SRC_LINK_BASE ${SRC_FILE})

View File

@ -39,6 +39,7 @@ const RuntimeCapabilityTable EHL::capabilityTable{
{aub_stream::ENGINE_RCS, {true, true}}}, // directSubmissionEngines
{0, 0, 0, false, false, false}, // kmdNotifyProperties
MemoryConstants::max36BitAddress, // gpuAddressSpace
0, // sharedSystemMemCapabilities
83.333, // defaultProfilingTimerResolution
MemoryConstants::pageSize, // requiredPreemptionSurfaceSize
&isSimulationEHL, // isSimulation

View File

@ -40,6 +40,7 @@ const RuntimeCapabilityTable ICLLP::capabilityTable{
{aub_stream::ENGINE_RCS, {true, true}}}, // directSubmissionEngines
{0, 0, 0, false, false, false}, // kmdNotifyProperties
MemoryConstants::max48BitAddress, // gpuAddressSpace
0, // sharedSystemMemCapabilities
83.333, // defaultProfilingTimerResolution
MemoryConstants::pageSize, // requiredPreemptionSurfaceSize
&isSimulationICLLP, // isSimulation

View File

@ -39,6 +39,7 @@ const RuntimeCapabilityTable LKF::capabilityTable{
{aub_stream::ENGINE_RCS, {true, true}}}, // directSubmissionEngines
{0, 0, 0, false, false, false}, // kmdNotifyProperties
MemoryConstants::max36BitAddress, // gpuAddressSpace
0, // sharedSystemMemCapabilities
83.333, // defaultProfilingTimerResolution
MemoryConstants::pageSize, // requiredPreemptionSurfaceSize
&isSimulationLKF, // isSimulation

View File

@ -37,6 +37,7 @@ const RuntimeCapabilityTable ADLP::capabilityTable{
{aub_stream::ENGINE_CCS, {true, true}}}, // directSubmissionEngines
{0, 0, 0, false, false, false}, // kmdNotifyProperties
MemoryConstants::max64BitAppAddress, // gpuAddressSpace
0, // sharedSystemMemCapabilities
83.333, // defaultProfilingTimerResolution
MemoryConstants::pageSize, // requiredPreemptionSurfaceSize
&isSimulationADLP, // isSimulation

View File

@ -37,6 +37,7 @@ const RuntimeCapabilityTable ADLS::capabilityTable{
{aub_stream::ENGINE_CCS, {true, true}}}, // directSubmissionEngines
{0, 0, 0, false, false, false}, // kmdNotifyProperties
MemoryConstants::max64BitAppAddress, // gpuAddressSpace
0, // sharedSystemMemCapabilities
83.333, // defaultProfilingTimerResolution
MemoryConstants::pageSize, // requiredPreemptionSurfaceSize
&isSimulationADLS, // isSimulation

View File

@ -45,6 +45,7 @@ const RuntimeCapabilityTable DG1::capabilityTable{
{aub_stream::ENGINE_CCS, {true, true}}}, // directSubmissionEngines
{0, 0, 0, false, false, false}, // kmdNotifyProperties
MemoryConstants::max64BitAppAddress, // gpuAddressSpace
0, // sharedSystemMemCapabilities
83.333, // defaultProfilingTimerResolution
MemoryConstants::pageSize, // requiredPreemptionSurfaceSize
&isSimulationDG1, // isSimulation

View File

@ -37,6 +37,7 @@ const RuntimeCapabilityTable RKL::capabilityTable{
{aub_stream::ENGINE_CCS, {true, true}}}, // directSubmissionEngines
{0, 0, 0, false, false, false}, // kmdNotifyProperties
MemoryConstants::max48BitAddress, // gpuAddressSpace
0, // sharedSystemMemCapabilities
83.333, // defaultProfilingTimerResolution
MemoryConstants::pageSize, // requiredPreemptionSurfaceSize
&isSimulationRKL, // isSimulation

View File

@ -41,6 +41,7 @@ const RuntimeCapabilityTable TGLLP::capabilityTable{
{aub_stream::ENGINE_CCS, {true, true}}}, // directSubmissionEngines
{0, 0, 0, false, false, false}, // kmdNotifyProperties
MemoryConstants::max64BitAppAddress, // gpuAddressSpace
0, // sharedSystemMemCapabilities
83.333, // defaultProfilingTimerResolution
MemoryConstants::pageSize, // requiredPreemptionSurfaceSize
&isSimulationTGLLP, // isSimulation

View File

@ -44,6 +44,7 @@ const RuntimeCapabilityTable BDW::capabilityTable{
{aub_stream::ENGINE_RCS, {true, true}}}, // directSubmissionEngines
{50000, 5000, 200000, true, true, true}, // kmdNotifyProperties
MemoryConstants::max48BitAddress, // gpuAddressSpace
0, // sharedSystemMemCapabilities
80, // defaultProfilingTimerResolution
MemoryConstants::pageSize, // requiredPreemptionSurfaceSize
&isSimulationBDW, // isSimulation

View File

@ -41,6 +41,7 @@ const RuntimeCapabilityTable BXT::capabilityTable{
{aub_stream::ENGINE_RCS, {true, true}}}, // directSubmissionEngines
{0, 0, 0, false, false, false}, // kmdNotifyProperties
MemoryConstants::max48BitAddress, // gpuAddressSpace
0, // sharedSystemMemCapabilities
52.083, // defaultProfilingTimerResolution
MemoryConstants::pageSize, // requiredPreemptionSurfaceSize
&isSimulationBXT, // isSimulation

View File

@ -36,6 +36,7 @@ const RuntimeCapabilityTable CFL::capabilityTable{
{aub_stream::ENGINE_RCS, {true, true}}}, // directSubmissionEngines
{0, 0, 0, false, false, false}, // kmdNotifyProperties
MemoryConstants::max48BitAddress, // gpuAddressSpace
0, // sharedSystemMemCapabilities
83.333, // defaultProfilingTimerResolution
MemoryConstants::pageSize, // requiredPreemptionSurfaceSize
&isSimulationCFL, // isSimulation

View File

@ -36,6 +36,7 @@ const RuntimeCapabilityTable GLK::capabilityTable{
{aub_stream::ENGINE_RCS, {true, true}}}, // directSubmissionEngines
{30000, 0, 0, true, false, false}, // kmdNotifyProperties
MemoryConstants::max48BitAddress, // gpuAddressSpace
0, // sharedSystemMemCapabilities
52.083, // defaultProfilingTimerResolution
MemoryConstants::pageSize, // requiredPreemptionSurfaceSize
&isSimulationGLK, // isSimulation

View File

@ -36,6 +36,7 @@ const RuntimeCapabilityTable KBL::capabilityTable{
{aub_stream::ENGINE_RCS, {true, true}}}, // directSubmissionEngines
{0, 0, 0, false, false, false}, // kmdNotifyProperties
MemoryConstants::max48BitAddress, // gpuAddressSpace
0, // sharedSystemMemCapabilities
83.333, // defaultProfilingTimerResolution
MemoryConstants::pageSize, // requiredPreemptionSurfaceSize
&isSimulationKBL, // isSimulation

View File

@ -44,6 +44,7 @@ const RuntimeCapabilityTable SKL::capabilityTable{
{aub_stream::ENGINE_RCS, {true, true}}}, // directSubmissionEngines
{0, 0, 0, false, false, false}, // kmdNotifyProperties
MemoryConstants::max48BitAddress, // gpuAddressSpace
0, // sharedSystemMemCapabilities
83.333, // defaultProfilingTimerResolution
MemoryConstants::pageSize, // requiredPreemptionSurfaceSize
&isSimulationSKL, // isSimulation

View File

@ -24,6 +24,7 @@ struct RuntimeCapabilityTable {
DirectSubmissionProperyEngines directSubmissionEngines;
KmdNotifyProperties kmdNotifyProperties;
uint64_t gpuAddressSpace;
uint64_t sharedSystemMemCapabilities;
double defaultProfilingTimerResolution;
size_t requiredPreemptionSurfaceSize;
bool (*isSimulation)(unsigned short);

View File

@ -41,6 +41,7 @@ const RuntimeCapabilityTable XE_HP_SDV::capabilityTable{
{aub_stream::ENGINE_CCS3, {true, false, true, true}}}, // directSubmissionEngines
{0, 0, 0, false, false, false}, // kmdNotifyProperties
MemoryConstants::max48BitAddress, // gpuAddressSpace
0, // sharedSystemMemCapabilities
83.333, // defaultProfilingTimerResolution
MemoryConstants::pageSize, // requiredPreemptionSurfaceSize
&isSimulationXEHP, // isSimulation