2018-02-14 20:48:31 +08:00
|
|
|
/*
|
2022-02-04 21:41:04 +08:00
|
|
|
* Copyright (C) 2018-2022 Intel Corporation
|
2018-02-14 20:48:31 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-02-14 20:48:31 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2021-01-21 20:10:13 +08:00
|
|
|
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
|
|
|
#include "shared/test/common/helpers/ult_hw_config.h"
|
|
|
|
#include "shared/test/common/helpers/variable_backup.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/platform/platform.h"
|
2020-03-17 21:25:44 +08:00
|
|
|
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
2018-02-14 20:48:31 +08:00
|
|
|
|
2022-07-20 18:13:10 +08:00
|
|
|
#include "gtest/gtest.h"
|
2021-08-10 19:20:40 +08:00
|
|
|
|
2022-07-20 18:13:10 +08:00
|
|
|
namespace NEO {
|
2021-08-10 19:20:40 +08:00
|
|
|
TEST(MultiDeviceTests, givenCreateMultipleRootDevicesAndLimitAmountOfReturnedDevicesFlagWhenClGetDeviceIdsIsCalledThenLowerValueIsReturned) {
|
|
|
|
platformsImpl->clear();
|
|
|
|
VariableBackup<UltHwConfig> backup(&ultHwConfig);
|
|
|
|
ultHwConfig.useHwCsr = true;
|
|
|
|
ultHwConfig.forceOsAgnosticMemoryManager = false;
|
|
|
|
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
|
|
|
|
DebugManagerStateRestore stateRestore;
|
|
|
|
DebugManager.flags.CreateMultipleRootDevices.set(2);
|
|
|
|
DebugManager.flags.LimitAmountOfReturnedDevices.set(1);
|
|
|
|
cl_uint numDevices = 0;
|
|
|
|
|
|
|
|
auto retVal = clGetDeviceIDs(nullptr, CL_DEVICE_TYPE_GPU, 0, nullptr, &numDevices);
|
|
|
|
EXPECT_EQ(CL_SUCCESS, retVal);
|
|
|
|
EXPECT_EQ(1u, numDevices);
|
|
|
|
}
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|