fix: check if any of devices has BindlessHeapHelper enabled

- report Bindless_images extension in driver only when at least one
device has global bindless heaps enabled

Related-To: NEO-10352

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2024-03-20 16:58:17 +00:00
committed by Compute-Runtime-Automation
parent 614ed7ff5f
commit 0cec5ccc32
8 changed files with 33 additions and 11 deletions

View File

@@ -143,10 +143,12 @@ ze_result_t DriverHandleImp::getExtensionProperties(uint32_t *pCount,
std::vector<std::pair<std::string, uint32_t>> additionalExtensions;
if (NEO::ApiSpecificConfig::getGlobalBindlessHeapConfiguration()) {
for (const auto device : devices) {
if (device->getNEODevice()->getRootDeviceEnvironment().getBindlessHeapsHelper()) {
additionalExtensions.push_back({ZE_BINDLESS_IMAGE_EXP_NAME, ZE_BINDLESS_IMAGE_EXP_VERSION_CURRENT});
break;
}
}
devices[0]->getL0GfxCoreHelper().appendPlatformSpecificExtensions(additionalExtensions, devices[0]->getProductHelper());
auto extensionCount = static_cast<uint32_t>(this->extensionsSupported.size() + additionalExtensions.size());

View File

@@ -21,7 +21,7 @@ bool ApiSpecificConfig::isStatelessCompressionSupported() {
return false;
}
bool ApiSpecificConfig::getGlobalBindlessHeapConfiguration() {
bool ApiSpecificConfig::getGlobalBindlessHeapConfiguration(const ReleaseHelper *releaseHelper) {
if (debugManager.flags.UseExternalAllocatorForSshAndDsh.get() != -1) {
return debugManager.flags.UseExternalAllocatorForSshAndDsh.get();
}

View File

@@ -149,11 +149,28 @@ TEST_F(DriverVersionTest, givenCallToGetExtensionPropertiesThenSupportedExtensio
TEST_F(DriverVersionTest, givenExternalAllocatorWhenCallingGetExtensionPropertiesThenBindlessImageExtensionIsReturned) {
DebugManagerStateRestore restorer;
NEO::debugManager.flags.UseBindlessMode.set(1);
NEO::debugManager.flags.UseExternalAllocatorForSshAndDsh.set(1);
auto hwInfo = *NEO::defaultHwInfo;
NEO::MockDevice *neoDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo);
NEO::DeviceVector devices;
devices.push_back(std::unique_ptr<NEO::Device>(neoDevice));
NEO::MockDevice *neoDevice2 = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo);
NEO::debugManager.flags.UseBindlessMode.set(0);
NEO::debugManager.flags.UseExternalAllocatorForSshAndDsh.set(0);
NEO::MockDevice *neoDevice3 = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo);
devices.push_back(std::unique_ptr<NEO::Device>(neoDevice3));
devices.push_back(std::unique_ptr<NEO::Device>(neoDevice2));
ze_result_t res;
auto driverHandle = DriverHandle::create(std::move(devices), L0EnvVariables{}, &res);
DriverHandleImp *driverHandleImp = static_cast<DriverHandleImp *>(driverHandle);
uint32_t count = 0;
ze_result_t res = driverHandle->getExtensionProperties(&count, nullptr);
EXPECT_GT(count, static_cast<uint32_t>(driverHandle->extensionsSupported.size()));
res = driverHandle->getExtensionProperties(&count, nullptr);
EXPECT_GT(count, static_cast<uint32_t>(driverHandleImp->extensionsSupported.size()));
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
ze_driver_extension_properties_t *extensionProperties = new ze_driver_extension_properties_t[count];
@@ -164,12 +181,15 @@ TEST_F(DriverVersionTest, givenExternalAllocatorWhenCallingGetExtensionPropertie
for (uint32_t i = 0; i < count; i++) {
auto extension = extensionProperties[i];
if (strcmp(extension.name, ZE_BINDLESS_IMAGE_EXP_NAME) == 0) {
EXPECT_FALSE(extensionFound);
extensionFound = true;
}
}
EXPECT_TRUE(extensionFound);
delete[] extensionProperties;
delete driverHandle;
L0::globalDriver = nullptr;
}
TEST_F(DriverVersionTest, WhenGettingDriverVersionThenExpectedDriverVersionIsReturned) {

View File

@@ -20,7 +20,7 @@ bool ApiSpecificConfig::isStatelessCompressionSupported() {
return true;
}
bool ApiSpecificConfig::getGlobalBindlessHeapConfiguration() {
bool ApiSpecificConfig::getGlobalBindlessHeapConfiguration(const ReleaseHelper *releaseHelper) {
return false;
}

View File

@@ -38,7 +38,7 @@ Device *RootDevice::getRootDevice() const {
void RootDevice::createBindlessHeapsHelper() {
if (ApiSpecificConfig::getGlobalBindlessHeapConfiguration() && ApiSpecificConfig::getBindlessMode(this->getReleaseHelper())) {
if (ApiSpecificConfig::getGlobalBindlessHeapConfiguration(this->getReleaseHelper()) && ApiSpecificConfig::getBindlessMode(this->getReleaseHelper())) {
this->executionEnvironment->rootDeviceEnvironments[getRootDeviceIndex()]->createBindlessHeapsHelper(this, getNumGenericSubDevices() > 1);
}
}

View File

@@ -20,7 +20,7 @@ struct ApiSpecificConfig {
enum ApiType { OCL,
L0 };
static bool isStatelessCompressionSupported();
static bool getGlobalBindlessHeapConfiguration();
static bool getGlobalBindlessHeapConfiguration(const ReleaseHelper *releaseHelper);
static bool getBindlessMode(const ReleaseHelper *);
static bool isDeviceAllocationCacheEnabled();
static bool isHostAllocationCacheEnabled();

View File

@@ -73,7 +73,7 @@ MemoryManager::MemoryManager(ExecutionEnvironment &executionEnvironment) : execu
anyLocalMemorySupported |= this->localMemorySupported[rootDeviceIndex];
isLocalMemoryUsedForIsa(rootDeviceIndex);
auto globalHeap = ApiSpecificConfig::getGlobalBindlessHeapConfiguration();
auto globalHeap = ApiSpecificConfig::getGlobalBindlessHeapConfiguration(rootDeviceEnvironment.getReleaseHelper());
heapAssigners.push_back(std::make_unique<HeapAssigner>(globalHeap));
}

View File

@@ -25,7 +25,7 @@ StackVec<NEO::DebugVarPrefix, 4> validUltOclPrefixTypes = {DebugVarPrefix::neoOc
bool ApiSpecificConfig::isStatelessCompressionSupported() {
return isStatelessCompressionSupportedForUlts;
}
bool ApiSpecificConfig::getGlobalBindlessHeapConfiguration() {
bool ApiSpecificConfig::getGlobalBindlessHeapConfiguration(const ReleaseHelper *releaseHelper) {
if (debugManager.flags.UseExternalAllocatorForSshAndDsh.get() != -1) {
return debugManager.flags.UseExternalAllocatorForSshAndDsh.get();
}