Revert "fix: disable shareable memory by default on Integrated gpu windows"

This reverts commit 84c7c6612b.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation
2025-09-11 04:46:43 +02:00
committed by Compute-Runtime-Automation
parent 8f08bfe454
commit d6a713c0e6
4 changed files with 2 additions and 133 deletions

View File

@@ -5,8 +5,6 @@
*
*/
#include "shared/source/helpers/hw_info.h"
#include "level_zero/core/source/context/context_imp.h"
#include "level_zero/core/source/driver/driver_handle_imp.h"
@@ -22,13 +20,6 @@ bool ContextImp::isShareableMemory(const void *exportDesc, bool exportableMemory
return true;
}
// Currently, deny default sharing of memory given Integrated GPU Device type unless explicitly enabled via debug flag.
// Making shareable memory resident on windows integrated gpus causes a perf hit in the KMD. Disabling until a solution can be determined.
const auto &hardwareInfo = neoDevice->getHardwareInfo();
if (hardwareInfo.capabilityTable.isIntegratedDevice && NEO::debugManager.flags.EnableShareableWithoutNTHandle.get() != 1) {
return false;
}
if (shareableWithoutNTHandle) {
return true;
}

View File

@@ -7,7 +7,6 @@
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/os_interface/os_interface.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/mocks/mock_builtins.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_driver_model.h"
@@ -79,126 +78,5 @@ HWTEST2_F(ContextTestWindows, whenCreatingContextWithSvmHeapDisabledThenContextS
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
}
using ContextShareableMemoryTests = Test<DeviceFixture>;
TEST_F(ContextShareableMemoryTests, givenIntegratedDeviceAndEnableShareableWithoutNTHandleDisabledWhenCallingIsShareableMemoryThenReturnsFalse) {
DebugManagerStateRestore restore;
NEO::debugManager.flags.EnableShareableWithoutNTHandle.set(0);
// Set device as integrated
neoDevice->executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo()->capabilityTable.isIntegratedDevice = true;
ze_context_handle_t hContext;
ze_context_desc_t desc = {ZE_STRUCTURE_TYPE_CONTEXT_DESC, nullptr, 0};
ze_result_t res = driverHandle->createContext(&desc, 0u, nullptr, &hContext);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
ContextImp *contextImp = static_cast<ContextImp *>(L0::Context::fromHandle(hContext));
// Test with exportableMemory = false, shareableWithoutNTHandle = true
bool result = contextImp->isShareableMemory(nullptr, false, neoDevice, true);
EXPECT_FALSE(result);
res = contextImp->destroy();
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
}
TEST_F(ContextShareableMemoryTests, givenIntegratedDeviceAndEnableShareableWithoutNTHandleMinusOneWhenCallingIsShareableMemoryThenReturnsFalse) {
DebugManagerStateRestore restore;
NEO::debugManager.flags.EnableShareableWithoutNTHandle.set(-1);
// Set device as integrated
neoDevice->executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo()->capabilityTable.isIntegratedDevice = true;
ze_context_handle_t hContext;
ze_context_desc_t desc = {ZE_STRUCTURE_TYPE_CONTEXT_DESC, nullptr, 0};
ze_result_t res = driverHandle->createContext(&desc, 0u, nullptr, &hContext);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
ContextImp *contextImp = static_cast<ContextImp *>(L0::Context::fromHandle(hContext));
// Test with exportableMemory = false, shareableWithoutNTHandle = true
bool result = contextImp->isShareableMemory(nullptr, false, neoDevice, true);
EXPECT_FALSE(result);
res = contextImp->destroy();
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
}
TEST_F(ContextShareableMemoryTests, givenIntegratedDeviceAndEnableShareableWithoutNTHandleEnabledWhenCallingIsShareableMemoryThenReturnsTrue) {
DebugManagerStateRestore restore;
NEO::debugManager.flags.EnableShareableWithoutNTHandle.set(1);
// Set device as integrated
neoDevice->executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo()->capabilityTable.isIntegratedDevice = true;
ze_context_handle_t hContext;
ze_context_desc_t desc = {ZE_STRUCTURE_TYPE_CONTEXT_DESC, nullptr, 0};
ze_result_t res = driverHandle->createContext(&desc, 0u, nullptr, &hContext);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
ContextImp *contextImp = static_cast<ContextImp *>(L0::Context::fromHandle(hContext));
// Test with exportableMemory = false, shareableWithoutNTHandle = true
bool result = contextImp->isShareableMemory(nullptr, false, neoDevice, true);
EXPECT_TRUE(result);
res = contextImp->destroy();
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
}
TEST_F(ContextShareableMemoryTests, givenDiscreteDeviceWhenCallingIsShareableMemoryThenReturnsShareableWithoutNTHandleValue) {
DebugManagerStateRestore restore;
NEO::debugManager.flags.EnableShareableWithoutNTHandle.set(0);
// Set device as discrete (not integrated)
neoDevice->executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo()->capabilityTable.isIntegratedDevice = false;
ze_context_handle_t hContext;
ze_context_desc_t desc = {ZE_STRUCTURE_TYPE_CONTEXT_DESC, nullptr, 0};
ze_result_t res = driverHandle->createContext(&desc, 0u, nullptr, &hContext);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
ContextImp *contextImp = static_cast<ContextImp *>(L0::Context::fromHandle(hContext));
// Test with exportableMemory = false, shareableWithoutNTHandle = true -> should return true (discrete device bypasses flag check)
bool result = contextImp->isShareableMemory(nullptr, false, neoDevice, true);
EXPECT_TRUE(result);
// Test with exportableMemory = false, shareableWithoutNTHandle = false -> should return false
result = contextImp->isShareableMemory(nullptr, false, neoDevice, false);
EXPECT_FALSE(result);
res = contextImp->destroy();
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
}
TEST_F(ContextShareableMemoryTests, givenExportableMemoryTrueWhenCallingIsShareableMemoryThenAlwaysReturnsTrue) {
DebugManagerStateRestore restore;
NEO::debugManager.flags.EnableShareableWithoutNTHandle.set(0);
// Set device as integrated
neoDevice->executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo()->capabilityTable.isIntegratedDevice = true;
ze_context_handle_t hContext;
ze_context_desc_t desc = {ZE_STRUCTURE_TYPE_CONTEXT_DESC, nullptr, 0};
ze_result_t res = driverHandle->createContext(&desc, 0u, nullptr, &hContext);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
ContextImp *contextImp = static_cast<ContextImp *>(L0::Context::fromHandle(hContext));
// Test with exportableMemory = true -> should always return true regardless of other parameters
bool result = contextImp->isShareableMemory(nullptr, true, neoDevice, false);
EXPECT_TRUE(result);
res = contextImp->destroy();
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
}
} // namespace ult
} // namespace L0

View File

@@ -30,7 +30,7 @@ struct AllocUsmPoolMemoryTest : public ::testing::Test {
NEO::debugManager.flags.EnableHostUsmAllocationPool.set(hostUsmPoolFlag);
NEO::debugManager.flags.EnableDeviceUsmAllocationPool.set(deviceUsmPoolFlag);
NEO::debugManager.flags.ExperimentalUSMAllocationReuseVersion.set(poolingVersionFlag);
NEO::debugManager.flags.EnableShareableWithoutNTHandle.set(0);
NEO::debugManager.flags.EnableShareableWithoutNTHandle.set(false);
executionEnvironment = new NEO::ExecutionEnvironment();
executionEnvironment->prepareRootDeviceEnvironments(numRootDevices);

View File

@@ -78,7 +78,7 @@ DECLARE_DEBUG_VARIABLE(bool, DisableForceToStateless, false, "Do not force state
DECLARE_DEBUG_VARIABLE(bool, ForceTheoreticalMaxWorkGroupCount, false, "Do not apply any limitation to max cooperative/concurrent work-group count queries")
DECLARE_DEBUG_VARIABLE(bool, AppendMemoryPrefetchForKmdMigratedSharedAllocations, true, "Allow prefetching shared memory to the device associated with the specified command list")
DECLARE_DEBUG_VARIABLE(bool, ForceMemoryPrefetchForKmdMigratedSharedAllocations, false, "Force prefetch of shared memory in command queue execute command lists")
DECLARE_DEBUG_VARIABLE(int32_t, EnableShareableWithoutNTHandle, -1, "-1: default, 0: disable, 1: enable, Enable creating shareable allocations without NT handle on Windows")
DECLARE_DEBUG_VARIABLE(bool, EnableShareableWithoutNTHandle, true, "Enable creating shareable allocations without NT handle on Windows")
DECLARE_DEBUG_VARIABLE(bool, ClKhrExternalMemoryExtension, true, "Enable cl_khr_external_memory extension")
DECLARE_DEBUG_VARIABLE(bool, WaitForMemoryRelease, false, "Wait for memory release when out of memory")
DECLARE_DEBUG_VARIABLE(bool, RemoveRestrictionsOnNumberOfThreadsInGpgpuThreadGroup, 0, "0 - default disabled, 1- remove restrictions on NumberOfThreadsInGpgpuThreadGroup in INTERFACE_DESCRIPTOR_DATA")