mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-19 06:24:51 +08:00
feature: move host mem alloc pool from context to platform
Related-To: NEO-13247 Signed-off-by: Aleksander Czerwionka <aleksander.czerwionka@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
d5d7276d1e
commit
e52235b8ff
@@ -3977,9 +3977,10 @@ CL_API_ENTRY void *CL_API_CALL clHostMemAllocINTEL(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
neoContext->initializeUsmAllocationPools();
|
||||
auto platform = neoContext->getDevice(0u)->getPlatform();
|
||||
platform->initializeHostUsmAllocationPool();
|
||||
|
||||
auto allocationFromPool = neoContext->getHostMemAllocPool().createUnifiedMemoryAllocation(size, unifiedMemoryProperties);
|
||||
auto allocationFromPool = platform->getHostMemAllocPool().createUnifiedMemoryAllocation(size, unifiedMemoryProperties);
|
||||
if (allocationFromPool) {
|
||||
TRACING_EXIT(ClHostMemAllocINTEL, &allocationFromPool);
|
||||
return allocationFromPool;
|
||||
@@ -4041,7 +4042,7 @@ CL_API_ENTRY void *CL_API_CALL clDeviceMemAllocINTEL(
|
||||
|
||||
unifiedMemoryProperties.device = &neoDevice->getDevice();
|
||||
|
||||
neoContext->initializeUsmAllocationPools();
|
||||
neoContext->initializeDeviceUsmAllocationPool();
|
||||
|
||||
auto allocationFromPool = neoContext->getDeviceMemAllocPool().createUnifiedMemoryAllocation(size, unifiedMemoryProperties);
|
||||
if (allocationFromPool) {
|
||||
@@ -4136,7 +4137,7 @@ CL_API_ENTRY cl_int CL_API_CALL clMemFreeCommon(cl_context context,
|
||||
successfulFree = true;
|
||||
}
|
||||
|
||||
if (!successfulFree && ptr && neoContext->getHostMemAllocPool().freeSVMAlloc(const_cast<void *>(ptr), blocking)) {
|
||||
if (!successfulFree && ptr && neoContext->getDevice(0u)->getPlatform()->getHostMemAllocPool().freeSVMAlloc(const_cast<void *>(ptr), blocking)) {
|
||||
successfulFree = true;
|
||||
}
|
||||
|
||||
@@ -4238,7 +4239,7 @@ CL_API_ENTRY cl_int CL_API_CALL clGetMemAllocInfoINTEL(
|
||||
TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal);
|
||||
return retVal;
|
||||
}
|
||||
if (auto basePtrFromHostPool = pContext->getHostMemAllocPool().getPooledAllocationBasePtr(ptr)) {
|
||||
if (auto basePtrFromHostPool = pContext->getDevice(0u)->getPlatform()->getHostMemAllocPool().getPooledAllocationBasePtr(ptr)) {
|
||||
retVal = changeGetInfoStatusToCLResultType(info.set<uint64_t>(castToUint64(basePtrFromHostPool)));
|
||||
TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal);
|
||||
return retVal;
|
||||
@@ -4258,7 +4259,7 @@ CL_API_ENTRY cl_int CL_API_CALL clGetMemAllocInfoINTEL(
|
||||
TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal);
|
||||
return retVal;
|
||||
}
|
||||
if (auto sizeFromHostPool = pContext->getHostMemAllocPool().getPooledAllocationSize(ptr)) {
|
||||
if (auto sizeFromHostPool = pContext->getDevice(0u)->getPlatform()->getHostMemAllocPool().getPooledAllocationSize(ptr)) {
|
||||
retVal = changeGetInfoStatusToCLResultType(info.set<size_t>(sizeFromHostPool));
|
||||
TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal);
|
||||
return retVal;
|
||||
|
||||
@@ -64,7 +64,7 @@ Context::~Context() {
|
||||
smallBufferPoolAllocator.releasePools();
|
||||
}
|
||||
|
||||
cleanupUsmAllocationPools();
|
||||
usmDeviceMemAllocPool.cleanup();
|
||||
|
||||
delete[] properties;
|
||||
|
||||
@@ -504,14 +504,7 @@ bool Context::isSingleDeviceContext() {
|
||||
return getNumDevices() == 1 && devices[0]->getNumGenericSubDevices() == 0;
|
||||
}
|
||||
|
||||
Context::UsmPoolParams Context::getUsmHostPoolParams() const {
|
||||
return {
|
||||
.poolSize = 2 * MemoryConstants::megaByte,
|
||||
.minServicedSize = 0u,
|
||||
.maxServicedSize = 1 * MemoryConstants::megaByte};
|
||||
}
|
||||
|
||||
Context::UsmPoolParams Context::getUsmDevicePoolParams() const {
|
||||
UsmPoolParams Context::getUsmDevicePoolParams() const {
|
||||
const auto &productHelper = devices[0]->getDevice().getProductHelper();
|
||||
|
||||
if (productHelper.is2MBLocalMemAlignmentEnabled()) {
|
||||
@@ -527,7 +520,7 @@ Context::UsmPoolParams Context::getUsmDevicePoolParams() const {
|
||||
.maxServicedSize = 1 * MemoryConstants::megaByte};
|
||||
}
|
||||
|
||||
void Context::initializeUsmAllocationPools() {
|
||||
void Context::initializeDeviceUsmAllocationPool() {
|
||||
if (this->usmPoolInitialized) {
|
||||
return;
|
||||
}
|
||||
@@ -560,31 +553,9 @@ void Context::initializeUsmAllocationPools() {
|
||||
memoryProperties.device = &neoDevice;
|
||||
usmDeviceMemAllocPool.initialize(svmMemoryManager, memoryProperties, usmDevicePoolParams.poolSize, usmDevicePoolParams.minServicedSize, usmDevicePoolParams.maxServicedSize);
|
||||
}
|
||||
|
||||
enabled = ApiSpecificConfig::isHostUsmPoolingEnabled() &&
|
||||
productHelper.isHostUsmPoolAllocatorSupported() &&
|
||||
DeviceFactory::isHwModeSelected();
|
||||
auto usmHostPoolParams = getUsmHostPoolParams();
|
||||
if (debugManager.flags.EnableHostUsmAllocationPool.get() != -1) {
|
||||
enabled = debugManager.flags.EnableHostUsmAllocationPool.get() > 0;
|
||||
usmHostPoolParams.poolSize = debugManager.flags.EnableHostUsmAllocationPool.get() * MemoryConstants::megaByte;
|
||||
}
|
||||
if (enabled) {
|
||||
auto subDeviceBitfields = getDeviceBitfields();
|
||||
auto &neoDevice = devices[0]->getDevice();
|
||||
subDeviceBitfields[neoDevice.getRootDeviceIndex()] = neoDevice.getDeviceBitfield();
|
||||
SVMAllocsManager::UnifiedMemoryProperties memoryProperties(InternalMemoryType::hostUnifiedMemory, MemoryConstants::pageSize2M,
|
||||
getRootDeviceIndices(), subDeviceBitfields);
|
||||
usmHostMemAllocPool.initialize(svmMemoryManager, memoryProperties, usmHostPoolParams.poolSize, usmHostPoolParams.minServicedSize, usmHostPoolParams.maxServicedSize);
|
||||
}
|
||||
this->usmPoolInitialized = true;
|
||||
}
|
||||
|
||||
void Context::cleanupUsmAllocationPools() {
|
||||
usmDeviceMemAllocPool.cleanup();
|
||||
usmHostMemAllocPool.cleanup();
|
||||
}
|
||||
|
||||
bool Context::BufferPoolAllocator::isAggregatedSmallBuffersEnabled(Context *context) const {
|
||||
bool isSupportedForSingleDeviceContexts = false;
|
||||
bool isSupportedForAllContexts = false;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "opencl/source/gtpin/gtpin_notify.h"
|
||||
#include "opencl/source/helpers/base_object.h"
|
||||
#include "opencl/source/helpers/destructor_callbacks.h"
|
||||
#include "opencl/source/helpers/usm_pool_params.h"
|
||||
#include "opencl/source/mem_obj/map_operations_handler.h"
|
||||
|
||||
#include <map>
|
||||
@@ -49,7 +50,6 @@ struct OpenCLObjectMapper<_cl_context> {
|
||||
};
|
||||
|
||||
class Context : public BaseObject<_cl_context> {
|
||||
using UsmHostMemAllocPool = UsmMemAllocPool;
|
||||
using UsmDeviceMemAllocPool = UsmMemAllocPool;
|
||||
|
||||
public:
|
||||
@@ -248,16 +248,12 @@ class Context : public BaseObject<_cl_context> {
|
||||
UsmMemAllocPool &getDeviceMemAllocPool() {
|
||||
return usmDeviceMemAllocPool;
|
||||
}
|
||||
UsmMemAllocPool &getHostMemAllocPool() {
|
||||
return usmHostMemAllocPool;
|
||||
}
|
||||
|
||||
TagAllocatorBase *getMultiRootDeviceTimestampPacketAllocator();
|
||||
std::unique_lock<std::mutex> obtainOwnershipForMultiRootDeviceAllocator();
|
||||
void setMultiRootDeviceTimestampPacketAllocator(std::unique_ptr<TagAllocatorBase> &allocator);
|
||||
|
||||
void initializeUsmAllocationPools();
|
||||
void cleanupUsmAllocationPools();
|
||||
void initializeDeviceUsmAllocationPool();
|
||||
|
||||
protected:
|
||||
struct BuiltInKernel {
|
||||
@@ -270,13 +266,6 @@ class Context : public BaseObject<_cl_context> {
|
||||
}
|
||||
};
|
||||
|
||||
struct UsmPoolParams {
|
||||
size_t poolSize{0};
|
||||
size_t minServicedSize{0};
|
||||
size_t maxServicedSize{0};
|
||||
};
|
||||
|
||||
UsmPoolParams getUsmHostPoolParams() const;
|
||||
UsmPoolParams getUsmDevicePoolParams() const;
|
||||
|
||||
Context(void(CL_CALLBACK *pfnNotify)(const char *, const void *, size_t, void *) = nullptr,
|
||||
@@ -306,7 +295,6 @@ class Context : public BaseObject<_cl_context> {
|
||||
DriverDiagnostics *driverDiagnostics = nullptr;
|
||||
BufferPoolAllocator smallBufferPoolAllocator;
|
||||
UsmDeviceMemAllocPool usmDeviceMemAllocPool;
|
||||
UsmHostMemAllocPool usmHostMemAllocPool;
|
||||
|
||||
uint32_t maxRootDeviceIndex = std::numeric_limits<uint32_t>::max();
|
||||
cl_bool preferD3dSharedResources = 0u;
|
||||
|
||||
@@ -48,6 +48,8 @@ set(RUNTIME_SRCS_HELPERS_BASE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/task_information.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/task_information.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/task_information.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/usm_pool_params.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/usm_pool_params.h
|
||||
)
|
||||
|
||||
if(SUPPORT_XEHP_AND_LATER)
|
||||
|
||||
19
opencl/source/helpers/usm_pool_params.cpp
Normal file
19
opencl/source/helpers/usm_pool_params.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencl/source/helpers/usm_pool_params.h"
|
||||
|
||||
#include "shared/source/helpers/constants.h"
|
||||
|
||||
namespace NEO {
|
||||
UsmPoolParams UsmPoolParams::getUsmHostPoolParams() {
|
||||
return {
|
||||
.poolSize = 2 * MemoryConstants::megaByte,
|
||||
.minServicedSize = 0u,
|
||||
.maxServicedSize = 1 * MemoryConstants::megaByte};
|
||||
}
|
||||
} // namespace NEO
|
||||
19
opencl/source/helpers/usm_pool_params.h
Normal file
19
opencl/source/helpers/usm_pool_params.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <cstddef>
|
||||
|
||||
namespace NEO {
|
||||
struct UsmPoolParams {
|
||||
size_t poolSize{0};
|
||||
size_t minServicedSize{0};
|
||||
size_t maxServicedSize{0};
|
||||
|
||||
static UsmPoolParams getUsmHostPoolParams();
|
||||
};
|
||||
} // namespace NEO
|
||||
@@ -14,16 +14,19 @@
|
||||
#include "shared/source/device/root_device.h"
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/helpers/api_specific_config.h"
|
||||
#include "shared/source/helpers/debug_helpers.h"
|
||||
#include "shared/source/helpers/get_info.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/os_interface/debug_env_reader.h"
|
||||
#include "shared/source/os_interface/device_factory.h"
|
||||
#include "shared/source/pin/pin.h"
|
||||
|
||||
#include "opencl/source/api/api.h"
|
||||
#include "opencl/source/cl_device/cl_device.h"
|
||||
#include "opencl/source/gtpin/gtpin_notify.h"
|
||||
#include "opencl/source/helpers/get_info_status_mapper.h"
|
||||
#include "opencl/source/helpers/usm_pool_params.h"
|
||||
#include "opencl/source/platform/platform_info.h"
|
||||
#include "opencl/source/sharings/sharing_factory.h"
|
||||
|
||||
@@ -43,13 +46,13 @@ Platform::Platform(ExecutionEnvironment &executionEnvironmentIn) : executionEnvi
|
||||
Platform::~Platform() {
|
||||
executionEnvironment.prepareForCleanup();
|
||||
|
||||
devicesCleanup(false);
|
||||
|
||||
usmHostMemAllocPool.cleanup();
|
||||
if (isInitialized()) {
|
||||
delete stagingBufferManager;
|
||||
svmAllocsManager->cleanupUSMAllocCaches();
|
||||
delete svmAllocsManager;
|
||||
}
|
||||
devicesCleanup(false);
|
||||
|
||||
gtpinNotifyPlatformShutdown();
|
||||
executionEnvironment.decRefInternal();
|
||||
@@ -288,6 +291,10 @@ StagingBufferManager *Platform::getStagingBufferManager() const {
|
||||
return this->stagingBufferManager;
|
||||
}
|
||||
|
||||
UsmMemAllocPool &Platform::getHostMemAllocPool() {
|
||||
return this->usmHostMemAllocPool;
|
||||
}
|
||||
|
||||
void Platform::incActiveContextCount() {
|
||||
TakeOwnershipWrapper<Platform> platformOwnership(*this);
|
||||
this->activeContextCount++;
|
||||
@@ -302,4 +309,49 @@ void Platform::decActiveContextCount() {
|
||||
}
|
||||
}
|
||||
|
||||
void Platform::initializeHostUsmAllocationPool() {
|
||||
if (this->usmPoolInitialized) {
|
||||
return;
|
||||
}
|
||||
auto svmMemoryManager = this->getSVMAllocsManager();
|
||||
|
||||
TakeOwnershipWrapper<Platform> platformOwnership(*this);
|
||||
if (this->usmPoolInitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto usmHostAllocPoolingEnabled = ApiSpecificConfig::isHostUsmPoolingEnabled();
|
||||
for (auto &device : this->clDevices) {
|
||||
usmHostAllocPoolingEnabled &= device->getProductHelper().isHostUsmPoolAllocatorSupported() && DeviceFactory::isHwModeSelected();
|
||||
}
|
||||
|
||||
auto usmHostPoolParams = UsmPoolParams::getUsmHostPoolParams();
|
||||
if (debugManager.flags.EnableHostUsmAllocationPool.get() != -1) {
|
||||
usmHostAllocPoolingEnabled = debugManager.flags.EnableHostUsmAllocationPool.get() > 0;
|
||||
usmHostPoolParams.poolSize = debugManager.flags.EnableHostUsmAllocationPool.get() * MemoryConstants::megaByte;
|
||||
}
|
||||
if (usmHostAllocPoolingEnabled) {
|
||||
RootDeviceIndicesContainer rootDeviceIndices;
|
||||
std::map<uint32_t, DeviceBitfield> deviceBitfields;
|
||||
|
||||
for (auto &device : this->clDevices) {
|
||||
rootDeviceIndices.pushUnique(device->getRootDeviceIndex());
|
||||
}
|
||||
|
||||
for (auto &rootDeviceIndex : rootDeviceIndices) {
|
||||
DeviceBitfield deviceBitfield{};
|
||||
for (const auto &pDevice : this->clDevices) {
|
||||
if (pDevice->getRootDeviceIndex() == rootDeviceIndex) {
|
||||
deviceBitfield |= pDevice->getDeviceBitfield();
|
||||
}
|
||||
}
|
||||
deviceBitfields.insert({rootDeviceIndex, deviceBitfield});
|
||||
}
|
||||
|
||||
SVMAllocsManager::UnifiedMemoryProperties memoryProperties(InternalMemoryType::hostUnifiedMemory, MemoryConstants::pageSize2M,
|
||||
rootDeviceIndices, deviceBitfields);
|
||||
this->usmHostMemAllocPool.initialize(svmMemoryManager, memoryProperties, usmHostPoolParams.poolSize, usmHostPoolParams.minServicedSize, usmHostPoolParams.maxServicedSize);
|
||||
}
|
||||
this->usmPoolInitialized = true;
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#pragma once
|
||||
#include "shared/source/helpers/common_types.h"
|
||||
#include "shared/source/memory_manager/unified_memory_manager.h"
|
||||
#include "shared/source/memory_manager/unified_memory_pooling.h"
|
||||
#include "shared/source/utilities/reference_tracked_object.h"
|
||||
#include "shared/source/utilities/staging_buffer_manager.h"
|
||||
|
||||
@@ -62,6 +63,8 @@ class Platform : public BaseObject<_cl_platform_id> {
|
||||
|
||||
SVMAllocsManager *getSVMAllocsManager() const;
|
||||
StagingBufferManager *getStagingBufferManager() const;
|
||||
UsmMemAllocPool &getHostMemAllocPool();
|
||||
void initializeHostUsmAllocationPool();
|
||||
|
||||
void incActiveContextCount();
|
||||
void decActiveContextCount();
|
||||
@@ -84,6 +87,8 @@ class Platform : public BaseObject<_cl_platform_id> {
|
||||
SVMAllocsManager *svmAllocsManager = nullptr;
|
||||
StagingBufferManager *stagingBufferManager = nullptr;
|
||||
int32_t activeContextCount = 0;
|
||||
UsmMemAllocPool usmHostMemAllocPool;
|
||||
bool usmPoolInitialized = false;
|
||||
};
|
||||
|
||||
static_assert(NEO::NonCopyableAndNonMovable<BaseObject<_cl_platform_id>>);
|
||||
|
||||
@@ -36,7 +36,7 @@ struct ApiFixture {
|
||||
debugManager.flags.ContextGroupSize.set(0);
|
||||
executionEnvironment = new ClExecutionEnvironment();
|
||||
prepareDeviceEnvironments(*executionEnvironment);
|
||||
NEO::constructPlatform(executionEnvironment);
|
||||
auto platform = NEO::constructPlatform(executionEnvironment);
|
||||
for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) {
|
||||
executionEnvironment->rootDeviceEnvironments[i]->initGmm();
|
||||
}
|
||||
@@ -45,11 +45,10 @@ struct ApiFixture {
|
||||
rootDeviceEnvironmentBackup.swap(executionEnvironment->rootDeviceEnvironments[0]);
|
||||
}
|
||||
|
||||
pDevice = new MockClDevice(rootDevice);
|
||||
NEO::initPlatform({rootDevice});
|
||||
pDevice = static_cast<MockClDevice *>(platform->getClDevice(0u));
|
||||
ASSERT_NE(nullptr, pDevice);
|
||||
|
||||
NEO::initPlatform({pDevice});
|
||||
|
||||
testedClDevice = pDevice;
|
||||
pContext = Context::create<MockContext>(nullptr, ClDeviceVector(&testedClDevice, 1), nullptr, nullptr, retVal);
|
||||
EXPECT_EQ(retVal, CL_SUCCESS);
|
||||
@@ -68,11 +67,10 @@ struct ApiFixture {
|
||||
pCommandQueue->release();
|
||||
pContext->release();
|
||||
pProgram->release();
|
||||
NEO::cleanupPlatform(executionEnvironment);
|
||||
if (rootDeviceIndex != 0u) {
|
||||
rootDeviceEnvironmentBackup.swap(executionEnvironment->rootDeviceEnvironments[0]);
|
||||
}
|
||||
pDevice->decRefInternal();
|
||||
NEO::cleanupPlatform(executionEnvironment);
|
||||
}
|
||||
|
||||
void disableQueueCapabilities(cl_command_queue_capabilities_intel capabilities) {
|
||||
|
||||
@@ -423,7 +423,7 @@ TEST_F(clSetKernelArgSVMPointerTests, givenSvmAndValidArgValueWhenAllocIdCacheHi
|
||||
EXPECT_EQ(++callCounter, pMockKernel->setArgSvmAllocCalls);
|
||||
|
||||
auto expectedAllocationsCounter = 1u;
|
||||
expectedAllocationsCounter += pContext->getHostMemAllocPool().isInitialized() ? 1u : 0u;
|
||||
expectedAllocationsCounter += pContext->getDevice(0u)->getPlatform()->getHostMemAllocPool().isInitialized() ? 1u : 0u;
|
||||
expectedAllocationsCounter += pContext->getDeviceMemAllocPool().isInitialized() ? 1u : 0u;
|
||||
|
||||
EXPECT_EQ(expectedAllocationsCounter, mockSvmManager->allocationsCounter);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -234,7 +234,7 @@ struct EnqueueWithWalkerPartitionFourTilesTests : public FourTilesSingleContextT
|
||||
kernelIds |= (1 << 8);
|
||||
|
||||
FourTilesSingleContextTest::SetUp();
|
||||
SimpleKernelFixture::setUp(rootDevice.get(), context.get());
|
||||
SimpleKernelFixture::setUp(rootDevice, context.get());
|
||||
|
||||
rootCsr = rootDevice->getDefaultEngine().commandStreamReceiver;
|
||||
EXPECT_EQ(4u, rootCsr->getOsContext().getNumSupportedDevices());
|
||||
@@ -278,7 +278,7 @@ struct DynamicWalkerPartitionFourTilesTests : EnqueueWithWalkerPartitionFourTile
|
||||
HWTEST2_F(DynamicWalkerPartitionFourTilesTests, whenWalkerPartitionIsEnabledForKernelWithAtomicThenOutputDataIsValid, SupportsMultiTile) {
|
||||
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
|
||||
|
||||
auto mockCommandQueue = new MockCommandQueueHw<FamilyType>(multiTileDefaultContext.get(), rootDevice.get(), nullptr);
|
||||
auto mockCommandQueue = new MockCommandQueueHw<FamilyType>(multiTileDefaultContext.get(), rootDevice, nullptr);
|
||||
|
||||
commandQueues[0][0].reset(mockCommandQueue);
|
||||
|
||||
@@ -336,7 +336,7 @@ HWTEST2_F(DynamicWalkerPartitionFourTilesTests, whenWalkerPartitionIsEnabledForK
|
||||
|
||||
HWTEST2_F(DynamicWalkerPartitionFourTilesTests, whenWalkerPartitionIsEnabledForKernelWithoutAtomicThenOutputDataIsValid, SupportsMultiTile) {
|
||||
|
||||
auto mockCommandQueue = new MockCommandQueueHw<FamilyType>(multiTileDefaultContext.get(), rootDevice.get(), nullptr);
|
||||
auto mockCommandQueue = new MockCommandQueueHw<FamilyType>(multiTileDefaultContext.get(), rootDevice, nullptr);
|
||||
|
||||
commandQueues[0][0].reset(mockCommandQueue);
|
||||
|
||||
@@ -407,7 +407,7 @@ struct StaticWalkerPartitionFourTilesTests : EnqueueWithWalkerPartitionFourTiles
|
||||
|
||||
HWTEST2_F(StaticWalkerPartitionFourTilesTests, givenFourTilesWhenStaticWalkerPartitionIsEnabledForKernelThenOutputDataIsValid, SupportsMultiTile) {
|
||||
|
||||
auto mockCommandQueue = new MockCommandQueueHw<FamilyType>(multiTileDefaultContext.get(), rootDevice.get(), nullptr);
|
||||
auto mockCommandQueue = new MockCommandQueueHw<FamilyType>(multiTileDefaultContext.get(), rootDevice, nullptr);
|
||||
|
||||
commandQueues[0][0].reset(mockCommandQueue);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
* Copyright (C) 2018-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -21,7 +21,7 @@ struct CommandEnqueueAUBFixture : public AUBFixture {
|
||||
void setUp() {
|
||||
AUBFixture::setUp(nullptr);
|
||||
pDevice = &device->device;
|
||||
pClDevice = device.get();
|
||||
pClDevice = device;
|
||||
}
|
||||
|
||||
void tearDown() {
|
||||
|
||||
@@ -61,7 +61,7 @@ struct AUBHelloWorldFixture
|
||||
ClHardwareParse::setUp();
|
||||
|
||||
IndirectHeapFixture::setUp(pCmdQ);
|
||||
KernelFixture::setUp(device.get(), kernelFilename, kernelName);
|
||||
KernelFixture::setUp(device, kernelFilename, kernelName);
|
||||
ASSERT_NE(nullptr, pKernel);
|
||||
|
||||
auto retVal = CL_INVALID_VALUE;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2024 Intel Corporation
|
||||
* Copyright (C) 2020-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -23,8 +23,8 @@ class AUBPrintfKernelFixture : public AUBFixture,
|
||||
|
||||
void SetUp() override {
|
||||
AUBFixture::setUp(nullptr);
|
||||
ASSERT_NE(nullptr, device.get());
|
||||
HelloWorldKernelFixture::setUp(device.get(), programFile, kernelName);
|
||||
ASSERT_NE(nullptr, device);
|
||||
HelloWorldKernelFixture::setUp(device, programFile, kernelName);
|
||||
}
|
||||
void TearDown() override {
|
||||
if (IsSkipped()) {
|
||||
|
||||
@@ -248,7 +248,7 @@ class LargeGrfTest : public AUBFixture,
|
||||
|
||||
Context *getContext() const override { return context; }
|
||||
|
||||
ClDevice *getDevice() const override { return device.get(); }
|
||||
ClDevice *getDevice() const override { return device; }
|
||||
|
||||
void SetUp() override {
|
||||
testHwInfo = *defaultHwInfo;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
* Copyright (C) 2018-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -28,7 +28,7 @@ void AUBCommandStreamFixture::setUp(const HardwareInfo *hardwareInfo) {
|
||||
|
||||
CommandStreamFixture::setUp(pCmdQ);
|
||||
|
||||
pClDevice = device.get();
|
||||
pClDevice = device;
|
||||
pDevice = &pClDevice->device;
|
||||
pCommandStreamReceiver = csr;
|
||||
pTagMemory = pCommandStreamReceiver->getTagAddress();
|
||||
|
||||
@@ -52,12 +52,13 @@ class AUBFixture : public CommandQueueHwFixture {
|
||||
ultHwConfig.aubTestName = aubFileName.c_str();
|
||||
|
||||
auto pDevice = MockDevice::create<MockDevice>(executionEnvironment, rootDeviceIndex);
|
||||
device = std::make_unique<MockClDevice>(pDevice);
|
||||
pDevice->disableSecondaryEngines = true;
|
||||
initPlatform({pDevice});
|
||||
device = static_cast<MockClDevice *>(platform(pDevice->getExecutionEnvironment())->getClDevice(0));
|
||||
|
||||
this->csr = pDevice->getDefaultEngine().commandStreamReceiver;
|
||||
|
||||
CommandQueueHwFixture::setUp(AUBFixture::device.get(), cl_command_queue_properties(0));
|
||||
CommandQueueHwFixture::setUp(AUBFixture::device, cl_command_queue_properties(0));
|
||||
}
|
||||
void tearDown() {
|
||||
CommandQueueHwFixture::tearDown();
|
||||
@@ -157,7 +158,7 @@ class AUBFixture : public CommandQueueHwFixture {
|
||||
const uint32_t rootDeviceIndex = 0;
|
||||
CommandStreamReceiver *csr = nullptr;
|
||||
volatile uint32_t *pTagMemory = nullptr;
|
||||
std::unique_ptr<MockClDevice> device;
|
||||
MockClDevice *device;
|
||||
|
||||
ExecutionEnvironment *executionEnvironment;
|
||||
|
||||
@@ -173,7 +174,7 @@ struct KernelAUBFixture : public AUBFixture,
|
||||
public KernelFixture {
|
||||
void setUp() {
|
||||
AUBFixture::setUp(nullptr);
|
||||
KernelFixture::setUp(device.get(), context);
|
||||
KernelFixture::setUp(device, context);
|
||||
}
|
||||
|
||||
void tearDown() {
|
||||
|
||||
@@ -39,7 +39,7 @@ void MulticontextOclAubFixture::setUp(uint32_t numberOfTiles, EnabledCommandStre
|
||||
};
|
||||
|
||||
{
|
||||
cl_device_id deviceId = rootDevice.get();
|
||||
cl_device_id deviceId = rootDevice;
|
||||
ClDeviceVector clDeviceVector{&deviceId, 1};
|
||||
if (numberOfTiles > 1) {
|
||||
for (uint32_t i = 0; i < numberOfTiles; i++) {
|
||||
@@ -86,7 +86,7 @@ void MulticontextOclAubFixture::setUp(uint32_t numberOfTiles, EnabledCommandStre
|
||||
|
||||
{
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
cl_device_id deviceId = rootDevice.get();
|
||||
cl_device_id deviceId = rootDevice;
|
||||
multiTileDefaultContext.reset(MockContext::create<MockContext>(nullptr, ClDeviceVector(&deviceId, 1), nullptr, nullptr, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
}
|
||||
@@ -100,7 +100,10 @@ void MulticontextOclAubFixture::createDevices(const HardwareInfo &hwInfo, uint32
|
||||
VariableBackup<UltHwConfig> backup(&ultHwConfig);
|
||||
ultHwConfig.useHwCsr = true;
|
||||
|
||||
rootDevice = std::make_unique<MockClDevice>(MockClDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, rootDeviceIndex));
|
||||
auto device = MockClDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, rootDeviceIndex);
|
||||
auto platform = constructPlatform(device->getExecutionEnvironment());
|
||||
initPlatform({device});
|
||||
rootDevice = static_cast<MockClDevice *>(platform->getClDevice(0u));
|
||||
|
||||
EXPECT_EQ(rootDeviceIndex, rootDevice->getRootDeviceIndex());
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
* Copyright (C) 2022-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -27,7 +27,7 @@ struct MulticontextOclAubFixture : public MulticontextAubFixture {
|
||||
void createDevices(const HardwareInfo &hwInfo, uint32_t numTiles) override;
|
||||
|
||||
std::vector<ClDevice *> tileDevices;
|
||||
std::unique_ptr<MockClDevice> rootDevice;
|
||||
MockClDevice *rootDevice;
|
||||
std::unique_ptr<MockContext> context;
|
||||
std::unique_ptr<MockContext> multiTileDefaultContext;
|
||||
std::vector<std::vector<std::unique_ptr<CommandQueue>>> commandQueues;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Intel Corporation
|
||||
* Copyright (C) 2023-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -30,13 +30,13 @@ void *UnifiedMemoryAubFixture::allocateUSM(InternalMemoryType type) {
|
||||
if (!this->skipped) {
|
||||
switch (type) {
|
||||
case InternalMemoryType::deviceUnifiedMemory:
|
||||
ptr = clDeviceMemAllocINTEL(this->context, this->device.get(), nullptr, dataSize, 0, &retVal);
|
||||
ptr = clDeviceMemAllocINTEL(this->context, this->device, nullptr, dataSize, 0, &retVal);
|
||||
break;
|
||||
case InternalMemoryType::hostUnifiedMemory:
|
||||
ptr = clHostMemAllocINTEL(this->context, nullptr, dataSize, 0, &retVal);
|
||||
break;
|
||||
case InternalMemoryType::sharedUnifiedMemory:
|
||||
ptr = clSharedMemAllocINTEL(this->context, this->device.get(), nullptr, dataSize, 0, &retVal);
|
||||
ptr = clSharedMemAllocINTEL(this->context, this->device, nullptr, dataSize, 0, &retVal);
|
||||
break;
|
||||
default:
|
||||
ptr = new char[dataSize];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
* Copyright (C) 2024-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -43,7 +43,7 @@ XE2_HPG_CORETEST_F(SystemMemFenceViaMiMemFenceXe2HpgCore, WhenGeneratedAsMiMemFe
|
||||
const size_t bufferSize = MemoryConstants::kiloByte;
|
||||
std::vector<char> buffer(bufferSize, 0x11);
|
||||
|
||||
auto deviceMemAlloc = clDeviceMemAllocINTEL(this->context, this->device.get(), nullptr, bufferSize, 0, &retVal);
|
||||
auto deviceMemAlloc = clDeviceMemAllocINTEL(this->context, this->device, nullptr, bufferSize, 0, &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, deviceMemAlloc);
|
||||
|
||||
@@ -91,7 +91,7 @@ XE2_HPG_CORETEST_F(SystemMemFenceViaComputeWalkerXe2HpgCore, WhenGeneratedAsPost
|
||||
const size_t bufferSize = MemoryConstants::kiloByte;
|
||||
std::vector<char> buffer(bufferSize, 0x11);
|
||||
|
||||
auto deviceMemAlloc = clDeviceMemAllocINTEL(this->context, this->device.get(), nullptr, bufferSize, 0, &retVal);
|
||||
auto deviceMemAlloc = clDeviceMemAllocINTEL(this->context, this->device, nullptr, bufferSize, 0, &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, deviceMemAlloc);
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ XE3_CORETEST_F(SystemMemFenceViaMiMemFenceXe3Core, WhenGeneratedAsMiMemFenceComm
|
||||
const size_t bufferSize = MemoryConstants::kiloByte;
|
||||
std::vector<char> buffer(bufferSize, 0x11);
|
||||
|
||||
auto deviceMemAlloc = clDeviceMemAllocINTEL(this->context, this->device.get(), nullptr, bufferSize, 0, &retVal);
|
||||
auto deviceMemAlloc = clDeviceMemAllocINTEL(this->context, this->device, nullptr, bufferSize, 0, &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, deviceMemAlloc);
|
||||
|
||||
@@ -93,7 +93,7 @@ XE3_CORETEST_F(SystemMemFenceViaComputeWalkerXe3Core, WhenGeneratedAsPostSyncOpe
|
||||
const size_t bufferSize = MemoryConstants::kiloByte;
|
||||
std::vector<char> buffer(bufferSize, 0x11);
|
||||
|
||||
auto deviceMemAlloc = clDeviceMemAllocINTEL(this->context, this->device.get(), nullptr, bufferSize, 0, &retVal);
|
||||
auto deviceMemAlloc = clDeviceMemAllocINTEL(this->context, this->device, nullptr, bufferSize, 0, &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, deviceMemAlloc);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
* Copyright (C) 2022-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -40,7 +40,7 @@ XE_HPC_CORETEST_F(SystemMemFenceViaMiMemFence, givenSystemMemFenceWhenMiMemFence
|
||||
const size_t bufferSize = MemoryConstants::kiloByte;
|
||||
std::vector<char> buffer(bufferSize, 0x11);
|
||||
|
||||
auto deviceMemAlloc = clDeviceMemAllocINTEL(this->context, this->device.get(), nullptr, bufferSize, 0, &retVal);
|
||||
auto deviceMemAlloc = clDeviceMemAllocINTEL(this->context, this->device, nullptr, bufferSize, 0, &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, deviceMemAlloc);
|
||||
|
||||
@@ -86,7 +86,7 @@ XE_HPC_CORETEST_F(SystemMemFenceViaComputeWalker, givenSystemMemFenceWhenPostSyn
|
||||
const size_t bufferSize = MemoryConstants::kiloByte;
|
||||
std::vector<char> buffer(bufferSize, 0x11);
|
||||
|
||||
auto deviceMemAlloc = clDeviceMemAllocINTEL(this->context, this->device.get(), nullptr, bufferSize, 0, &retVal);
|
||||
auto deviceMemAlloc = clDeviceMemAllocINTEL(this->context, this->device, nullptr, bufferSize, 0, &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, deviceMemAlloc);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
* Copyright (C) 2022-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -40,7 +40,7 @@ XE_HPC_CORETEST_P(UmStatelessCompression, givenDeviceMemAllocWhenStatelessCompre
|
||||
const size_t bufferSize = MemoryConstants::kiloByte;
|
||||
std::vector<char> buffer(bufferSize, 0x11);
|
||||
|
||||
auto deviceMemAlloc = clDeviceMemAllocINTEL(this->context, this->device.get(), nullptr, bufferSize, 0, &retVal);
|
||||
auto deviceMemAlloc = clDeviceMemAllocINTEL(this->context, this->device, nullptr, bufferSize, 0, &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, deviceMemAlloc);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
* Copyright (C) 2022-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -103,7 +103,7 @@ XE_HPG_CORETEST_P(XeHpgCoreStatelessCompressionInSBA, GENERATEONLY_givenCompress
|
||||
|
||||
device->getGpgpuCommandStreamReceiver().overrideDispatchPolicy(DispatchMode::batchedDispatch);
|
||||
|
||||
auto compressedDeviceMemAllocPtr1 = clDeviceMemAllocINTEL(context, device.get(), nullptr, bufferSize, 0, &retVal);
|
||||
auto compressedDeviceMemAllocPtr1 = clDeviceMemAllocINTEL(context, device, nullptr, bufferSize, 0, &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_NE(nullptr, compressedDeviceMemAllocPtr1);
|
||||
auto compressedDeviceMemAlloc1 = context->getSVMAllocsManager()->getSVMAllocs()->get(compressedDeviceMemAllocPtr1)->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex());
|
||||
@@ -112,7 +112,7 @@ XE_HPG_CORETEST_P(XeHpgCoreStatelessCompressionInSBA, GENERATEONLY_givenCompress
|
||||
EXPECT_EQ(MemoryPool::localMemory, compressedDeviceMemAlloc1->getMemoryPool());
|
||||
EXPECT_TRUE(compressedDeviceMemAlloc1->getDefaultGmm()->isCompressionEnabled());
|
||||
|
||||
auto compressedDeviceMemAllocPtr2 = clDeviceMemAllocINTEL(context, device.get(), nullptr, bufferSize, 0, &retVal);
|
||||
auto compressedDeviceMemAllocPtr2 = clDeviceMemAllocINTEL(context, device, nullptr, bufferSize, 0, &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_NE(nullptr, compressedDeviceMemAllocPtr2);
|
||||
auto compressedDeviceMemAlloc2 = context->getSVMAllocsManager()->getSVMAllocs()->get(compressedDeviceMemAllocPtr2)->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex());
|
||||
@@ -205,7 +205,7 @@ XE_HPG_CORETEST_P(XeHpgCoreStatelessCompressionInSBA, givenUncompressibleHostMem
|
||||
|
||||
device->getGpgpuCommandStreamReceiver().overrideDispatchPolicy(DispatchMode::batchedDispatch);
|
||||
|
||||
auto compressedDeviceMemAllocPtr = clDeviceMemAllocINTEL(context, device.get(), nullptr, bufferSize, 0, &retVal);
|
||||
auto compressedDeviceMemAllocPtr = clDeviceMemAllocINTEL(context, device, nullptr, bufferSize, 0, &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_NE(nullptr, compressedDeviceMemAllocPtr);
|
||||
auto compressedDeviceMemAlloc = context->getSVMAllocsManager()->getSVMAllocs()->get(compressedDeviceMemAllocPtr)->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex());
|
||||
@@ -286,11 +286,11 @@ XE_HPG_CORETEST_P(XeHpgCoreUmStatelessCompressionInSBA, GENERATEONLY_givenStatel
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, uncompressibleHostMemAlloc);
|
||||
|
||||
auto compressedDeviceMemAlloc1 = clDeviceMemAllocINTEL(context, device.get(), nullptr, bufferSize, 0, &retVal);
|
||||
auto compressedDeviceMemAlloc1 = clDeviceMemAllocINTEL(context, device, nullptr, bufferSize, 0, &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, compressedDeviceMemAlloc1);
|
||||
|
||||
auto compressedDeviceMemAlloc2 = clDeviceMemAllocINTEL(context, device.get(), nullptr, bufferSize, 0, &retVal);
|
||||
auto compressedDeviceMemAlloc2 = clDeviceMemAllocINTEL(context, device, nullptr, bufferSize, 0, &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, compressedDeviceMemAlloc2);
|
||||
|
||||
@@ -341,11 +341,11 @@ XE_HPG_CORETEST_P(XeHpgCoreUmStatelessCompressionInSBA, GENERATEONLY_givenKernel
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, uncompressibleHostMemAlloc);
|
||||
|
||||
auto compressedDeviceMemAlloc1 = clDeviceMemAllocINTEL(context, device.get(), nullptr, bufferSize, 0, &retVal);
|
||||
auto compressedDeviceMemAlloc1 = clDeviceMemAllocINTEL(context, device, nullptr, bufferSize, 0, &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, compressedDeviceMemAlloc1);
|
||||
|
||||
auto compressedDeviceMemAlloc2 = clDeviceMemAllocINTEL(context, device.get(), nullptr, bufferSize, 0, &retVal);
|
||||
auto compressedDeviceMemAlloc2 = clDeviceMemAllocINTEL(context, device, nullptr, bufferSize, 0, &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, compressedDeviceMemAlloc2);
|
||||
|
||||
@@ -393,7 +393,7 @@ XE_HPG_CORETEST_P(XeHpgCoreUmStatelessCompressionInSBA, givenStatelessKernelWhen
|
||||
const size_t bufferSize = MemoryConstants::kiloByte;
|
||||
uint8_t bufferData[bufferSize] = {};
|
||||
|
||||
auto compressedDeviceMemAlloc = clDeviceMemAllocINTEL(context, device.get(), nullptr, bufferSize, 0, &retVal);
|
||||
auto compressedDeviceMemAlloc = clDeviceMemAllocINTEL(context, device, nullptr, bufferSize, 0, &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, compressedDeviceMemAlloc);
|
||||
|
||||
@@ -436,7 +436,7 @@ XE_HPG_CORETEST_P(XeHpgCoreUmStatelessCompressionInSBA, givenKernelExecInfoWhenI
|
||||
const size_t bufferSize = MemoryConstants::kiloByte;
|
||||
uint8_t bufferData[bufferSize] = {};
|
||||
|
||||
auto compressedDeviceMemAlloc = clDeviceMemAllocINTEL(context, device.get(), nullptr, bufferSize, 0, &retVal);
|
||||
auto compressedDeviceMemAlloc = clDeviceMemAllocINTEL(context, device, nullptr, bufferSize, 0, &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, compressedDeviceMemAlloc);
|
||||
|
||||
|
||||
@@ -80,6 +80,12 @@ class BuiltInTests
|
||||
|
||||
void TearDown() override {
|
||||
allBuiltIns.clear();
|
||||
auto builders = pClExecutionEnvironment->peekBuilders(pClDevice->getRootDeviceIndex());
|
||||
if (builders) {
|
||||
for (uint32_t i = 0; i < static_cast<uint32_t>(EBuiltInOps::count); ++i) {
|
||||
builders[i].first.reset();
|
||||
}
|
||||
}
|
||||
BuiltInFixture::tearDown();
|
||||
ContextFixture::tearDown();
|
||||
ClDeviceFixture::tearDown();
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "opencl/test/unit_test/fixtures/hello_world_fixture.h"
|
||||
#include "opencl/test/unit_test/helpers/cl_hw_parse.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_command_queue.h"
|
||||
#include "opencl/test/unit_test/mocks/ult_cl_device_factory_with_platform.h"
|
||||
#include "opencl/test/unit_test/test_macros/test_checks_ocl.h"
|
||||
using namespace NEO;
|
||||
|
||||
@@ -114,7 +115,7 @@ TEST_F(EnqueueKernelTest, givenKernelWhenAllArgsAreSetThenClEnqueueNDRangeKernel
|
||||
|
||||
TEST(EnqueueMultiDeviceKernelTest, givenMultiDeviceKernelWhenSetArgDeviceUSMThenOnlyOneKernelIsPatched) {
|
||||
USE_REAL_FILE_SYSTEM();
|
||||
auto deviceFactory = std::make_unique<UltClDeviceFactory>(3, 0);
|
||||
auto deviceFactory = std::make_unique<UltClDeviceFactoryWithPlatform>(3, 0);
|
||||
auto device0 = deviceFactory->rootDevices[0];
|
||||
auto device1 = deviceFactory->rootDevices[1];
|
||||
auto device2 = deviceFactory->rootDevices[2];
|
||||
|
||||
@@ -62,6 +62,7 @@ TEST_P(GetCommandQueueInfoTest, GivenClQueueContextWhenGettingCommandQueueInfoTh
|
||||
|
||||
TEST_P(GetCommandQueueInfoTest, GivenClQueueDeviceWhenGettingCommandQueueInfoThenSuccessIsReturned) {
|
||||
cl_device_id deviceExpected = pClDevice;
|
||||
|
||||
cl_device_id deviceReturned = nullptr;
|
||||
|
||||
auto retVal = pCmdQ->getCommandQueueInfo(
|
||||
|
||||
@@ -152,13 +152,12 @@ HWCMDTEST_TEMPLATED_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLaterWi
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, WhenOsContextSupportsMultipleDevicesThenScratchSpaceAllocationIsPlacedOnEachSupportedDevice) {
|
||||
DebugManagerStateRestore restorer;
|
||||
debugManager.flags.CreateMultipleSubDevices.set(2u);
|
||||
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
auto executionEnvironment = std::unique_ptr<ExecutionEnvironment>(MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0));
|
||||
executionEnvironment->memoryManager.reset(new MockMemoryManager(false, true, *executionEnvironment));
|
||||
uint32_t tileMask = 0b11;
|
||||
uint32_t rootDeviceIndex = 0;
|
||||
std::unique_ptr<OsContext> osContext(OsContext::create(nullptr, rootDeviceIndex, 0u, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::regular}, PreemptionMode::MidThread, tileMask)));
|
||||
auto commandStreamReceiver = std::make_unique<MockCsrHw<FamilyType>>(*executionEnvironment, rootDeviceIndex, tileMask);
|
||||
initPlatform();
|
||||
|
||||
void *ssh = alignedMalloc(512, 4096);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2018-2023 Intel Corporation
|
||||
# Copyright (C) 2018-2025 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
@@ -10,7 +10,6 @@ set(IGDRCL_SRCS_tests_context
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/context_multi_device_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/context_negative_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/context_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/context_usm_memory_pool_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/driver_diagnostics_enqueue_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/driver_diagnostics_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/driver_diagnostics_tests.h
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "opencl/source/command_queue/command_queue.h"
|
||||
#include "opencl/source/context/context.inl"
|
||||
#include "opencl/source/gtpin/gtpin_defs.h"
|
||||
#include "opencl/source/helpers/usm_pool_params.h"
|
||||
#include "opencl/source/mem_obj/buffer.h"
|
||||
#include "opencl/source/sharings/sharing.h"
|
||||
#include "opencl/test/unit_test/fixtures/platform_fixture.h"
|
||||
@@ -777,21 +778,19 @@ TEST_F(AllocationReuseContextTest, givenHostPtrStoredInMapOperationsStorageAndRe
|
||||
|
||||
struct ContextUsmPoolParamsTest : public ::testing::Test {
|
||||
void SetUp() override {
|
||||
deviceFactory = std::make_unique<UltClDeviceFactoryWithPlatform>(2, 0);
|
||||
device = deviceFactory->rootDevices[rootDeviceIndex];
|
||||
device = deviceFactory.rootDevices[0];
|
||||
mockNeoDevice = static_cast<MockDevice *>(&device->getDevice());
|
||||
mockProductHelper = new MockProductHelper;
|
||||
mockNeoDevice->getRootDeviceEnvironmentRef().productHelper.reset(mockProductHelper);
|
||||
}
|
||||
|
||||
bool compareUsmPoolParams(const MockContext::UsmPoolParams &first, const MockContext::UsmPoolParams &second) {
|
||||
bool compareUsmPoolParams(const UsmPoolParams &first, const UsmPoolParams &second) {
|
||||
return first.poolSize == second.poolSize &&
|
||||
first.minServicedSize == second.minServicedSize &&
|
||||
first.maxServicedSize == second.maxServicedSize;
|
||||
}
|
||||
|
||||
const size_t rootDeviceIndex = 1u;
|
||||
std::unique_ptr<UltClDeviceFactoryWithPlatform> deviceFactory;
|
||||
UltClDeviceFactoryWithPlatform deviceFactory{1, 0};
|
||||
MockClDevice *device;
|
||||
MockDevice *mockNeoDevice;
|
||||
MockProductHelper *mockProductHelper;
|
||||
@@ -807,17 +806,17 @@ TEST_F(ContextUsmPoolParamsTest, GivenDisabled2MBLocalMemAlignmentWhenGettingUsm
|
||||
context.reset(Context::create<MockContext>(nullptr, ClDeviceVector(devices, 1), nullptr, nullptr, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
const MockContext::UsmPoolParams expectedUsmHostPoolParams{
|
||||
const UsmPoolParams expectedUsmHostPoolParams{
|
||||
.poolSize = 2 * MemoryConstants::megaByte,
|
||||
.minServicedSize = 0u,
|
||||
.maxServicedSize = 1 * MemoryConstants::megaByte};
|
||||
|
||||
const MockContext::UsmPoolParams expectedUsmDevicePoolParams{
|
||||
const UsmPoolParams expectedUsmDevicePoolParams{
|
||||
.poolSize = 2 * MemoryConstants::megaByte,
|
||||
.minServicedSize = 0u,
|
||||
.maxServicedSize = 1 * MemoryConstants::megaByte};
|
||||
|
||||
EXPECT_TRUE(compareUsmPoolParams(expectedUsmHostPoolParams, context->getUsmHostPoolParams()));
|
||||
EXPECT_TRUE(compareUsmPoolParams(expectedUsmHostPoolParams, UsmPoolParams::getUsmHostPoolParams()));
|
||||
EXPECT_TRUE(compareUsmPoolParams(expectedUsmDevicePoolParams, context->getUsmDevicePoolParams()));
|
||||
}
|
||||
|
||||
@@ -828,17 +827,17 @@ TEST_F(ContextUsmPoolParamsTest, GivenEnabled2MBLocalMemAlignmentWhenGettingUsmP
|
||||
context.reset(Context::create<MockContext>(nullptr, ClDeviceVector(devices, 1), nullptr, nullptr, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
const MockContext::UsmPoolParams expectedUsmHostPoolParams{
|
||||
const UsmPoolParams expectedUsmHostPoolParams{
|
||||
.poolSize = 2 * MemoryConstants::megaByte,
|
||||
.minServicedSize = 0u,
|
||||
.maxServicedSize = 1 * MemoryConstants::megaByte};
|
||||
|
||||
const MockContext::UsmPoolParams expectedUsmDevicePoolParams{
|
||||
const UsmPoolParams expectedUsmDevicePoolParams{
|
||||
.poolSize = 16 * MemoryConstants::megaByte,
|
||||
.minServicedSize = 0u,
|
||||
.maxServicedSize = 2 * MemoryConstants::megaByte};
|
||||
|
||||
EXPECT_TRUE(compareUsmPoolParams(expectedUsmHostPoolParams, context->getUsmHostPoolParams()));
|
||||
EXPECT_TRUE(compareUsmPoolParams(expectedUsmHostPoolParams, UsmPoolParams::getUsmHostPoolParams()));
|
||||
EXPECT_TRUE(compareUsmPoolParams(expectedUsmDevicePoolParams, context->getUsmDevicePoolParams()));
|
||||
}
|
||||
|
||||
@@ -849,30 +848,33 @@ TEST_F(ContextUsmPoolParamsTest, GivenUsmPoolAllocatorSupportedWhenInitializingU
|
||||
cl_device_id devices[] = {device};
|
||||
context.reset(Context::create<MockContext>(nullptr, ClDeviceVector(devices, 1), nullptr, nullptr, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
auto platform = context->getDevice(0)->getPlatform();
|
||||
EXPECT_NE(nullptr, platform);
|
||||
|
||||
context->initializeUsmAllocationPools();
|
||||
context->initializeDeviceUsmAllocationPool();
|
||||
platform->initializeHostUsmAllocationPool();
|
||||
|
||||
EXPECT_TRUE(context->getHostMemAllocPool().isInitialized());
|
||||
EXPECT_TRUE(platform->getHostMemAllocPool().isInitialized());
|
||||
EXPECT_TRUE(context->getDeviceMemAllocPool().isInitialized());
|
||||
|
||||
{
|
||||
auto mockHostUsmMemAllocPool = static_cast<MockUsmMemAllocPool *>(&context->getHostMemAllocPool());
|
||||
const MockContext::UsmPoolParams givenUsmHostPoolParams{
|
||||
auto mockHostUsmMemAllocPool = static_cast<MockUsmMemAllocPool *>(&platform->getHostMemAllocPool());
|
||||
const UsmPoolParams givenUsmHostPoolParams{
|
||||
.poolSize = mockHostUsmMemAllocPool->poolSize,
|
||||
.minServicedSize = mockHostUsmMemAllocPool->minServicedSize,
|
||||
.maxServicedSize = mockHostUsmMemAllocPool->maxServicedSize};
|
||||
const MockContext::UsmPoolParams expectedUsmHostPoolParams = context->getUsmHostPoolParams();
|
||||
const UsmPoolParams expectedUsmHostPoolParams = UsmPoolParams::getUsmHostPoolParams();
|
||||
|
||||
EXPECT_TRUE(compareUsmPoolParams(expectedUsmHostPoolParams, givenUsmHostPoolParams));
|
||||
}
|
||||
|
||||
{
|
||||
auto mockDeviceUsmMemAllocPool = static_cast<MockUsmMemAllocPool *>(&context->getDeviceMemAllocPool());
|
||||
const MockContext::UsmPoolParams givenUsmDevicePoolParams{
|
||||
const UsmPoolParams givenUsmDevicePoolParams{
|
||||
.poolSize = mockDeviceUsmMemAllocPool->poolSize,
|
||||
.minServicedSize = mockDeviceUsmMemAllocPool->minServicedSize,
|
||||
.maxServicedSize = mockDeviceUsmMemAllocPool->maxServicedSize};
|
||||
const MockContext::UsmPoolParams expectedUsmDevicePoolParams = context->getUsmDevicePoolParams();
|
||||
const UsmPoolParams expectedUsmDevicePoolParams = context->getUsmDevicePoolParams();
|
||||
|
||||
EXPECT_TRUE(compareUsmPoolParams(expectedUsmDevicePoolParams, givenUsmDevicePoolParams));
|
||||
}
|
||||
@@ -889,13 +891,18 @@ TEST_F(ContextUsmPoolParamsTest, GivenUsmPoolAllocatorSupportedWhenInitializingU
|
||||
for (int32_t csrType = 0; csrType < static_cast<int32_t>(CommandStreamReceiverType::typesNum); ++csrType) {
|
||||
DebugManagerStateRestore restorer;
|
||||
debugManager.flags.SetCommandStreamReceiver.set(static_cast<int32_t>(csrType));
|
||||
EXPECT_FALSE(context->getHostMemAllocPool().isInitialized());
|
||||
auto platform = static_cast<MockPlatform *>(context->getDevice(0)->getPlatform());
|
||||
EXPECT_NE(nullptr, platform);
|
||||
EXPECT_FALSE(platform->getHostMemAllocPool().isInitialized());
|
||||
EXPECT_FALSE(context->getDeviceMemAllocPool().isInitialized());
|
||||
context->initializeUsmAllocationPools();
|
||||
context->initializeDeviceUsmAllocationPool();
|
||||
platform->initializeHostUsmAllocationPool();
|
||||
|
||||
EXPECT_EQ(DeviceFactory::isHwModeSelected(), context->getHostMemAllocPool().isInitialized());
|
||||
EXPECT_EQ(DeviceFactory::isHwModeSelected(), platform->getHostMemAllocPool().isInitialized());
|
||||
EXPECT_EQ(DeviceFactory::isHwModeSelected(), context->getDeviceMemAllocPool().isInitialized());
|
||||
context->cleanupUsmAllocationPools();
|
||||
context->getDeviceMemAllocPool().cleanup();
|
||||
platform->getHostMemAllocPool().cleanup();
|
||||
context->usmPoolInitialized = false;
|
||||
platform->usmPoolInitialized = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,10 +9,12 @@
|
||||
|
||||
#include "shared/source/built_ins/sip.h"
|
||||
#include "shared/source/command_stream/command_stream_receiver.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
|
||||
#include "opencl/source/helpers/cl_gfx_core_helper.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_execution_environment.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
@@ -27,7 +29,9 @@ void ClDeviceFixture::setUpImpl(const NEO::HardwareInfo *hardwareInfo) {
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->memoryOperationsInterface = std::make_unique<MockMemoryOperations>();
|
||||
ASSERT_NE(nullptr, pDevice);
|
||||
pClExecutionEnvironment = static_cast<MockClExecutionEnvironment *>(pDevice->getExecutionEnvironment());
|
||||
pClDevice = new MockClDevice{pDevice};
|
||||
auto platform = NEO::constructPlatform(pClExecutionEnvironment);
|
||||
NEO::initPlatform({pDevice});
|
||||
pClDevice = static_cast<MockClDevice *>(platform->getClDevice(0u));
|
||||
ASSERT_NE(nullptr, pClDevice);
|
||||
|
||||
auto &commandStreamReceiver = pDevice->getGpgpuCommandStreamReceiver();
|
||||
@@ -41,9 +45,9 @@ void ClDeviceFixture::setUpImpl(const NEO::HardwareInfo *hardwareInfo) {
|
||||
}
|
||||
|
||||
void ClDeviceFixture::tearDown() {
|
||||
delete pClDevice;
|
||||
pClDevice = nullptr;
|
||||
pDevice = nullptr;
|
||||
NEO::cleanupPlatform(pClExecutionEnvironment);
|
||||
}
|
||||
|
||||
MockDevice *ClDeviceFixture::createWithUsDeviceId(unsigned short usDeviceId) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2023 Intel Corporation
|
||||
* Copyright (C) 2019-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/ult_cl_device_factory_with_platform.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
@@ -21,7 +22,7 @@ namespace NEO {
|
||||
class MultiRootDeviceFixture : public ::testing::Test {
|
||||
public:
|
||||
void SetUp() override {
|
||||
deviceFactory = std::make_unique<UltClDeviceFactory>(3, 0);
|
||||
deviceFactory = std::make_unique<UltClDeviceFactoryWithPlatform>(3, 0);
|
||||
device1 = deviceFactory->rootDevices[1];
|
||||
device2 = deviceFactory->rootDevices[2];
|
||||
|
||||
@@ -37,7 +38,7 @@ class MultiRootDeviceFixture : public ::testing::Test {
|
||||
}
|
||||
|
||||
const uint32_t expectedRootDeviceIndex = 1;
|
||||
std::unique_ptr<UltClDeviceFactory> deviceFactory;
|
||||
std::unique_ptr<UltClDeviceFactoryWithPlatform> deviceFactory;
|
||||
MockClDevice *device1 = nullptr;
|
||||
MockClDevice *device2 = nullptr;
|
||||
std::unique_ptr<MockContext> context;
|
||||
|
||||
@@ -351,7 +351,7 @@ TEST_F(KernelArgBufferTest, givenKernelExecInfoWithIndirectStatelessAccessWhenHa
|
||||
if (svmAllocationsManager == nullptr) {
|
||||
return;
|
||||
}
|
||||
pContext->getHostMemAllocPool().cleanup();
|
||||
pContext->getDevice(0u)->getPlatform()->getHostMemAllocPool().cleanup();
|
||||
svmAllocationsManager->cleanupUSMAllocCaches();
|
||||
|
||||
mockKernel.unifiedMemoryControls.indirectHostAllocationsAllowed = true;
|
||||
|
||||
@@ -41,6 +41,7 @@ set(IGDRCL_SRCS_tests_mem_obj
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/packed_yuv_image_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sub_buffer_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/zero_copy_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/usm_memory_pool_tests.cpp
|
||||
)
|
||||
|
||||
if(TESTS_XEHP_AND_LATER)
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_command_queue.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/ult_cl_device_factory_with_platform.h"
|
||||
#include "opencl/test/unit_test/test_macros/test_checks_ocl.h"
|
||||
|
||||
#include <cinttypes>
|
||||
@@ -80,6 +81,8 @@ struct BcsBufferTests : public ::testing::Test {
|
||||
debugManager.flags.EnableBlitterForEnqueueOperations.set(1);
|
||||
debugManager.flags.ForceGpgpuSubmissionForBcsEnqueue.set(1);
|
||||
debugManager.flags.PreferCopyEngineForCopyBufferToBuffer.set(1);
|
||||
debugManager.flags.EnableHostUsmAllocationPool.set(0);
|
||||
debugManager.flags.EnableDeviceUsmAllocationPool.set(0);
|
||||
auto hwInfo = *defaultHwInfo;
|
||||
hwInfo.capabilityTable.blitterOperationsSupported = true;
|
||||
{
|
||||
@@ -91,10 +94,11 @@ struct BcsBufferTests : public ::testing::Test {
|
||||
hwInfo.featureTable.ftrBcsInfo.set(bcsIndex, true);
|
||||
hwInfo.featureTable.ftrBcsInfo.set(EngineHelpers::getBcsIndex(aub_stream::EngineType::ENGINE_BCS3)); // add internal engine
|
||||
}
|
||||
device = std::make_unique<MockClDevice>(MockClDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
|
||||
deviceFactory = std::make_unique<UltClDeviceFactoryWithPlatform>(1, 0, MockClDevice::prepareExecutionEnvironment(&hwInfo, 0));
|
||||
device = deviceFactory->rootDevices[0];
|
||||
device->device.disableSecondaryEngines = true;
|
||||
bcsMockContext = std::make_unique<BcsMockContext>(device.get());
|
||||
commandQueue.reset(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
bcsMockContext = std::make_unique<BcsMockContext>(device);
|
||||
commandQueue.reset(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device, nullptr));
|
||||
bcsCsr = static_cast<MockCommandQueueHw<FamilyType> *>(commandQueue.get())->bcsEngines[bcsIndex]->commandStreamReceiver;
|
||||
}
|
||||
|
||||
@@ -112,7 +116,8 @@ struct BcsBufferTests : public ::testing::Test {
|
||||
DebugManagerStateRestore restore;
|
||||
|
||||
std::unique_ptr<OsContext> bcsOsContext;
|
||||
std::unique_ptr<MockClDevice> device;
|
||||
MockClDevice *device;
|
||||
std::unique_ptr<UltClDeviceFactoryWithPlatform> deviceFactory;
|
||||
std::unique_ptr<BcsMockContext> bcsMockContext;
|
||||
std::unique_ptr<CommandQueue> commandQueue;
|
||||
CommandStreamReceiver *bcsCsr;
|
||||
@@ -392,7 +397,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenBuffersWhenCopyBufferCalledThenUseBcs) {
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
|
||||
resetCopyEngineSelector();
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device, nullptr));
|
||||
|
||||
auto bufferForBlt0 = clUniquePtr(Buffer::create(bcsMockContext.get(), CL_MEM_READ_WRITE, 1, nullptr, retVal));
|
||||
auto bufferForBlt1 = clUniquePtr(Buffer::create(bcsMockContext.get(), CL_MEM_READ_WRITE, 1, nullptr, retVal));
|
||||
@@ -415,7 +420,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenBuffersWhenCopyBufferRectCalledThenUseBc
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
|
||||
resetCopyEngineSelector();
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device, nullptr));
|
||||
|
||||
auto bufferForBlt0 = clUniquePtr(Buffer::create(bcsMockContext.get(), CL_MEM_READ_WRITE, 1, nullptr, retVal));
|
||||
auto bufferForBlt1 = clUniquePtr(Buffer::create(bcsMockContext.get(), CL_MEM_READ_WRITE, 1, nullptr, retVal));
|
||||
@@ -442,7 +447,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenDstHostPtrWhenEnqueueSVMMemcpyThenEnqueu
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
|
||||
resetCopyEngineSelector();
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device, nullptr));
|
||||
|
||||
auto pDstSVM = std::make_unique<char[]>(1);
|
||||
auto pSrcSVM = bcsMockContext->getSVMAllocsManager()->createSVMAlloc(1, {}, bcsMockContext->getRootDeviceIndices(), bcsMockContext->getDeviceBitfields());
|
||||
@@ -465,7 +470,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenSrcHostPtrWhenEnqueueSVMMemcpyThenEnqueu
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
|
||||
resetCopyEngineSelector();
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device, nullptr));
|
||||
|
||||
auto pSrcSVM = std::make_unique<char[]>(1);
|
||||
auto pDstSVM = bcsMockContext->getSVMAllocsManager()->createSVMAlloc(1, {}, bcsMockContext->getRootDeviceIndices(), bcsMockContext->getDeviceBitfields());
|
||||
@@ -682,7 +687,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenWriteBufferEnqueueWithGpgpuSubmissionWhe
|
||||
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
|
||||
|
||||
resetCopyEngineSelector();
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device, nullptr));
|
||||
|
||||
auto queueCsr = &cmdQ->getGpgpuCommandStreamReceiver();
|
||||
auto initialTaskCount = queueCsr->peekTaskCount();
|
||||
@@ -714,7 +719,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenReadBufferEnqueueWithGpgpuSubmissionWhen
|
||||
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
|
||||
|
||||
resetCopyEngineSelector();
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device, nullptr));
|
||||
|
||||
auto queueCsr = &cmdQ->getGpgpuCommandStreamReceiver();
|
||||
auto initialTaskCount = queueCsr->peekTaskCount();
|
||||
@@ -793,7 +798,7 @@ void BcsBufferTests::waitForCacheFlushFromBcsTest(MockCommandQueueHw<FamilyType>
|
||||
|
||||
HWTEST_TEMPLATED_F(BcsBufferTests, givenCommandQueueWithCacheFlushRequirementWhenProgrammingCmdBufferThenWaitForCacheFlushFromBcs) {
|
||||
resetCopyEngineSelector();
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device, nullptr));
|
||||
cmdQ->overrideIsCacheFlushForBcsRequired.enabled = true;
|
||||
cmdQ->overrideIsCacheFlushForBcsRequired.returnValue = true;
|
||||
waitForCacheFlushFromBcsTest<FamilyType>(*cmdQ);
|
||||
@@ -801,7 +806,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenCommandQueueWithCacheFlushRequirementWhe
|
||||
|
||||
HWTEST_TEMPLATED_F(BcsBufferTests, givenCommandQueueWithoutCacheFlushRequirementWhenProgrammingCmdBufferThenWaitForCacheFlushFromBcs) {
|
||||
resetCopyEngineSelector();
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device, nullptr));
|
||||
cmdQ->overrideIsCacheFlushForBcsRequired.enabled = true;
|
||||
cmdQ->overrideIsCacheFlushForBcsRequired.returnValue = false;
|
||||
waitForCacheFlushFromBcsTest<FamilyType>(*cmdQ);
|
||||
@@ -812,7 +817,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenPipeControlRequestWhenDispatchingBlitEnq
|
||||
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
|
||||
|
||||
resetCopyEngineSelector();
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device, nullptr));
|
||||
|
||||
auto bcsCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(this->bcsCsr);
|
||||
|
||||
@@ -865,7 +870,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenStallingCommandsOnNextFlushWhenReleasing
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
|
||||
resetCopyEngineSelector();
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device, nullptr));
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto buffer = clUniquePtr<Buffer>(Buffer::create(bcsMockContext.get(), CL_MEM_READ_WRITE, 1, nullptr, retVal));
|
||||
@@ -919,7 +924,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenPipeControlRequestWhenDispatchingBlocked
|
||||
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
|
||||
|
||||
resetCopyEngineSelector();
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device, nullptr));
|
||||
auto bcsCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(this->bcsCsr);
|
||||
|
||||
cmdQ->setStallingCommandsOnNextFlush(true);
|
||||
@@ -950,7 +955,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenPipeControlRequestWhenDispatchingBlocked
|
||||
|
||||
HWTEST_TEMPLATED_F(BcsBufferTests, givenBufferOperationWithoutKernelWhenEstimatingCommandsSizeThenReturnCorrectValue) {
|
||||
resetCopyEngineSelector();
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device, nullptr));
|
||||
CsrDependencies csrDependencies;
|
||||
MultiDispatchInfo multiDispatchInfo;
|
||||
|
||||
@@ -976,7 +981,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenOutputTimestampPacketWhenBlitCalledThenp
|
||||
|
||||
auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(this->bcsCsr);
|
||||
resetCopyEngineSelector();
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device, nullptr));
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
|
||||
auto buffer = clUniquePtr<Buffer>(Buffer::create(bcsMockContext.get(), CL_MEM_READ_WRITE, 1, nullptr, retVal));
|
||||
@@ -1022,7 +1027,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenOutputTimestampPacketWhenBlitCalledThenp
|
||||
HWTEST_TEMPLATED_F(BcsBufferTests, givenInputAndOutputTimestampPacketWhenBlitCalledThenMakeThemResident) {
|
||||
auto bcsCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(this->bcsCsr);
|
||||
resetCopyEngineSelector();
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device, nullptr));
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
|
||||
auto memoryManager = bcsCsr->getMemoryManager();
|
||||
@@ -1059,7 +1064,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenBlockingWriteBufferWhenUsingBcsThenCallW
|
||||
EngineControl bcsEngineControl = {myMockCsr, bcsMockContext->bcsOsContext.get()};
|
||||
|
||||
resetCopyEngineSelector();
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device, nullptr));
|
||||
cmdQ->clearBcsEngines();
|
||||
cmdQ->bcsEngines[bcsIndex] = &bcsEngineControl;
|
||||
auto &gpgpuCsr = cmdQ->getGpgpuCommandStreamReceiver();
|
||||
@@ -1105,7 +1110,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenBlockingReadBufferRectWhenUsingBcsThenCa
|
||||
EngineControl bcsEngineControl = {myMockCsr, bcsMockContext->bcsOsContext.get()};
|
||||
|
||||
resetCopyEngineSelector();
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device, nullptr));
|
||||
cmdQ->clearBcsEngines();
|
||||
cmdQ->bcsEngines[bcsIndex] = &bcsEngineControl;
|
||||
auto &gpgpuCsr = cmdQ->getGpgpuCommandStreamReceiver();
|
||||
@@ -1159,7 +1164,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenBlockingWriteBufferRectWhenUsingBcsThenC
|
||||
EngineControl bcsEngineControl = {myMockCsr, bcsMockContext->bcsOsContext.get()};
|
||||
|
||||
resetCopyEngineSelector();
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device, nullptr));
|
||||
cmdQ->clearBcsEngines();
|
||||
cmdQ->bcsEngines[bcsIndex] = &bcsEngineControl;
|
||||
auto &gpgpuCsr = cmdQ->getGpgpuCommandStreamReceiver();
|
||||
@@ -1213,7 +1218,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenBlockingReadBufferWhenUsingBcsThenCallWa
|
||||
EngineControl bcsEngineControl = {myMockCsr, bcsMockContext->bcsOsContext.get()};
|
||||
|
||||
resetCopyEngineSelector();
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device, nullptr));
|
||||
cmdQ->clearBcsEngines();
|
||||
cmdQ->bcsEngines[bcsIndex] = &bcsEngineControl;
|
||||
auto &gpgpuCsr = cmdQ->getGpgpuCommandStreamReceiver();
|
||||
@@ -1258,7 +1263,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenBlockingSVMMemcpyAndEnqueuReadBufferIsCa
|
||||
EngineControl bcsEngineControl = {myMockCsr, bcsMockContext->bcsOsContext.get()};
|
||||
|
||||
resetCopyEngineSelector();
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device, nullptr));
|
||||
cmdQ->clearBcsEngines();
|
||||
cmdQ->bcsEngines[bcsIndex] = &bcsEngineControl;
|
||||
auto &gpgpuCsr = cmdQ->getGpgpuCommandStreamReceiver();
|
||||
@@ -1297,7 +1302,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenSrcHostPtrBlockingEnqueueSVMMemcpyAndEnq
|
||||
EngineControl bcsEngineControl = {myMockCsr, bcsMockContext->bcsOsContext.get()};
|
||||
|
||||
resetCopyEngineSelector();
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device, nullptr));
|
||||
cmdQ->clearBcsEngines();
|
||||
cmdQ->bcsEngines[bcsIndex] = &bcsEngineControl;
|
||||
auto &gpgpuCsr = cmdQ->getGpgpuCommandStreamReceiver();
|
||||
@@ -1336,7 +1341,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenDstHostPtrAndSrcHostPtrBlockingEnqueueSV
|
||||
EngineControl bcsEngineControl = {myMockCsr, bcsMockContext->bcsOsContext.get()};
|
||||
|
||||
resetCopyEngineSelector();
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device, nullptr));
|
||||
cmdQ->clearBcsEngines();
|
||||
cmdQ->bcsEngines[bcsIndex] = &bcsEngineControl;
|
||||
auto &gpgpuCsr = cmdQ->getGpgpuCommandStreamReceiver();
|
||||
@@ -1368,7 +1373,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenSvmToSvmCopyWhenEnqueueSVMMemcpyThenSvmM
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
|
||||
resetCopyEngineSelector();
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device, nullptr));
|
||||
|
||||
auto pDstSVM = bcsMockContext->getSVMAllocsManager()->createSVMAlloc(256, {}, bcsMockContext->getRootDeviceIndices(), bcsMockContext->getDeviceBitfields());
|
||||
auto pSrcSVM = bcsMockContext->getSVMAllocsManager()->createSVMAlloc(256, {}, bcsMockContext->getRootDeviceIndices(), bcsMockContext->getDeviceBitfields());
|
||||
@@ -1398,7 +1403,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenSvmToSvmCopyTypeWhenEnqueueNonBlockingSV
|
||||
EngineControl bcsEngineControl = {myMockCsr, bcsMockContext->bcsOsContext.get()};
|
||||
|
||||
resetCopyEngineSelector();
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device, nullptr));
|
||||
cmdQ->clearBcsEngines();
|
||||
cmdQ->bcsEngines[bcsIndex] = &bcsEngineControl;
|
||||
auto &gpgpuCsr = cmdQ->getGpgpuCommandStreamReceiver();
|
||||
@@ -1431,7 +1436,7 @@ struct BcsSvmTests : public BcsBufferTests {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
deviceMemAlloc = clDeviceMemAllocINTEL(bcsMockContext.get(), device.get(), nullptr, allocSize, 0u, &retVal);
|
||||
deviceMemAlloc = clDeviceMemAllocINTEL(bcsMockContext.get(), device, nullptr, allocSize, 0u, &retVal);
|
||||
ASSERT_NE(nullptr, deviceMemAlloc);
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
allocation.push_back(deviceMemAlloc);
|
||||
@@ -1442,7 +1447,7 @@ struct BcsSvmTests : public BcsBufferTests {
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
allocation.push_back(hostMemAlloc);
|
||||
|
||||
sharedMemAlloc = clSharedMemAllocINTEL(bcsMockContext.get(), device.get(), nullptr, allocSize, 0u, &retVal);
|
||||
sharedMemAlloc = clSharedMemAllocINTEL(bcsMockContext.get(), device, nullptr, allocSize, 0u, &retVal);
|
||||
ASSERT_NE(nullptr, sharedMemAlloc);
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
allocation.push_back(sharedMemAlloc);
|
||||
@@ -1530,7 +1535,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenBlockedEnqueueWhenUsingBcsThenWaitForVal
|
||||
EngineControl bcsEngineControl = {myMockCsr, bcsMockContext->bcsOsContext.get()};
|
||||
|
||||
resetCopyEngineSelector();
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device, nullptr));
|
||||
cmdQ->clearBcsEngines();
|
||||
cmdQ->bcsEngines[bcsIndex] = &bcsEngineControl;
|
||||
auto &gpgpuCsr = cmdQ->getGpgpuCommandStreamReceiver();
|
||||
@@ -1597,7 +1602,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenBcsQueueWhenEnqueueingCopyBufferToBuffer
|
||||
0,
|
||||
};
|
||||
resetCopyEngineSelector();
|
||||
MockCommandQueueHw<FamilyType> queue(bcsMockContext.get(), device.get(), properties);
|
||||
MockCommandQueueHw<FamilyType> queue(bcsMockContext.get(), device, properties);
|
||||
auto bcsCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(this->bcsCsr);
|
||||
MockGraphicsAllocation srcGraphicsAllocation{};
|
||||
MockGraphicsAllocation dstGraphicsAllocation{};
|
||||
|
||||
@@ -42,7 +42,7 @@ class AggregatedSmallBuffersTestTemplate : public ::testing::Test {
|
||||
this->mockMemoryManager->failInDevicePoolWithError = shouldFail;
|
||||
}
|
||||
|
||||
std::unique_ptr<UltClDeviceFactory> deviceFactory;
|
||||
std::unique_ptr<UltClDeviceFactoryWithPlatform> deviceFactory;
|
||||
MockClDevice *device;
|
||||
MockDevice *mockNeoDevice;
|
||||
std::unique_ptr<MockContext> context;
|
||||
@@ -62,7 +62,7 @@ class AggregatedSmallBuffersTestTemplate : public ::testing::Test {
|
||||
debugManager.flags.EnableDeviceUsmAllocationPool.set(0);
|
||||
debugManager.flags.EnableHostUsmAllocationPool.set(0);
|
||||
debugManager.flags.RenderCompressedBuffersEnabled.set(1);
|
||||
this->deviceFactory = std::make_unique<UltClDeviceFactory>(2, 0);
|
||||
this->deviceFactory = std::make_unique<UltClDeviceFactoryWithPlatform>(2, 0);
|
||||
this->device = deviceFactory->rootDevices[rootDeviceIndex];
|
||||
this->mockNeoDevice = static_cast<MockDevice *>(&this->device->getDevice());
|
||||
const auto bitfield = mockNeoDevice->getDeviceBitfield();
|
||||
@@ -74,8 +74,7 @@ class AggregatedSmallBuffersTestTemplate : public ::testing::Test {
|
||||
this->setAllocationToFail(failMainStorageAllocation);
|
||||
cl_device_id devices[] = {device};
|
||||
this->context.reset(Context::create<MockContext>(nullptr, ClDeviceVector(devices, 1), nullptr, nullptr, retVal));
|
||||
this->context->usmPoolInitialized = false;
|
||||
this->context->initializeUsmAllocationPools();
|
||||
this->context->initializeDeviceUsmAllocationPool();
|
||||
EXPECT_EQ(retVal, CL_SUCCESS);
|
||||
this->setAllocationToFail(false);
|
||||
this->poolAllocator = static_cast<MockBufferPoolAllocator *>(&context->getBufferPoolAllocator());
|
||||
@@ -590,7 +589,7 @@ TEST_F(AggregatedSmallBuffersEnabledTestDoNotRunSetup, givenProductWithAndWithou
|
||||
debugManager.flags.EnableHostUsmAllocationPool.set(0);
|
||||
debugManager.flags.RenderCompressedBuffersEnabled.set(1);
|
||||
|
||||
this->deviceFactory = std::make_unique<UltClDeviceFactory>(2, 0);
|
||||
this->deviceFactory = std::make_unique<UltClDeviceFactoryWithPlatform>(2, 0);
|
||||
this->device = deviceFactory->rootDevices[rootDeviceIndex];
|
||||
this->mockNeoDevice = static_cast<MockDevice *>(&this->device->getDevice());
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_image.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
#include "opencl/test/unit_test/mocks/ult_cl_device_factory_with_platform.h"
|
||||
|
||||
#include "CL/cl.h"
|
||||
#include "memory_properties_flags.h"
|
||||
@@ -835,6 +836,7 @@ TEST_P(CreateImageHostPtr, givenLinearImageWhenFailedAtCreationThenReturnError)
|
||||
}
|
||||
|
||||
TEST_P(CreateImageHostPtr, WhenWritingOutsideAllocatedMemoryWhileCreatingImageThenWriteIsHandledCorrectly) {
|
||||
pClDevice->getPlatform()->getSVMAllocsManager()->cleanupUSMAllocCaches();
|
||||
auto mockMemoryManager = new MockMemoryManager(*pDevice->executionEnvironment);
|
||||
pDevice->injectMemoryManager(mockMemoryManager);
|
||||
context->memoryManager = mockMemoryManager;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "shared/test/common/mocks/mock_allocation_properties.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
#include "shared/test/common/mocks/ult_device_factory.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
#include "opencl/source/api/api.h"
|
||||
@@ -24,6 +25,7 @@
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
#include "opencl/test/unit_test/mocks/ult_cl_device_factory_with_platform.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
@@ -622,10 +624,9 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
using UsmDestructionTests = ::testing::Test;
|
||||
|
||||
HWTEST_F(UsmDestructionTests, givenSharedUsmAllocationWhenBlockingFreeIsCalledThenWaitForCompletionIsCalled) {
|
||||
MockDevice mockDevice;
|
||||
mockDevice.incRefInternal();
|
||||
MockClDevice mockClDevice(&mockDevice);
|
||||
MockContext mockContext(&mockClDevice, false);
|
||||
UltClDeviceFactoryWithPlatform deviceFactory(1, 0);
|
||||
MockDevice &mockDevice = *deviceFactory.pUltDeviceFactory->rootDevices[0];
|
||||
MockContext mockContext(deviceFactory.rootDevices[0], false);
|
||||
|
||||
if (mockContext.getDevice(0u)->getHardwareInfo().capabilityTable.supportsOcl21Features == false) {
|
||||
GTEST_SKIP();
|
||||
@@ -656,10 +657,9 @@ HWTEST_F(UsmDestructionTests, givenSharedUsmAllocationWhenBlockingFreeIsCalledTh
|
||||
}
|
||||
|
||||
HWTEST_F(UsmDestructionTests, givenUsmAllocationWhenBlockingFreeIsCalledThenWaitForCompletionIsCalled) {
|
||||
MockDevice mockDevice;
|
||||
mockDevice.incRefInternal();
|
||||
MockClDevice mockClDevice(&mockDevice);
|
||||
MockContext mockContext(&mockClDevice, false);
|
||||
UltClDeviceFactoryWithPlatform deviceFactory(1, 0);
|
||||
MockDevice &mockDevice = *deviceFactory.pUltDeviceFactory->rootDevices[0];
|
||||
MockContext mockContext(deviceFactory.rootDevices[0], false);
|
||||
|
||||
if (mockContext.getDevice(0u)->getHardwareInfo().capabilityTable.supportsOcl21Features == false) {
|
||||
GTEST_SKIP();
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
struct ContextUsmPoolTest : public ::testing::Test {
|
||||
struct UsmPoolTest : public ::testing::Test {
|
||||
void SetUp() override {
|
||||
deviceFactory = std::make_unique<UltClDeviceFactoryWithPlatform>(1, 0);
|
||||
deviceFactory = std::make_unique<UltClDeviceFactoryWithPlatform>(2, 0);
|
||||
device = deviceFactory->rootDevices[0];
|
||||
if (device->deviceInfo.svmCapabilities == 0) {
|
||||
GTEST_SKIP();
|
||||
@@ -32,7 +32,7 @@ struct ContextUsmPoolTest : public ::testing::Test {
|
||||
mockContext.reset(Context::create<MockContext>(nullptr, ClDeviceVector(&deviceId, 1), nullptr, nullptr, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
mockDeviceUsmMemAllocPool = static_cast<MockUsmMemAllocPool *>(&mockContext->getDeviceMemAllocPool());
|
||||
mockHostUsmMemAllocPool = static_cast<MockUsmMemAllocPool *>(&mockContext->getHostMemAllocPool());
|
||||
mockHostUsmMemAllocPool = static_cast<MockUsmMemAllocPool *>(&mockContext->getDevice(0u)->getPlatform()->getHostMemAllocPool());
|
||||
}
|
||||
|
||||
MockClDevice *device;
|
||||
@@ -43,7 +43,7 @@ struct ContextUsmPoolTest : public ::testing::Test {
|
||||
constexpr static auto poolAllocationThreshold = 1 * MemoryConstants::megaByte;
|
||||
};
|
||||
|
||||
TEST_F(ContextUsmPoolTest, givenCreatedContextWhenCheckingUsmPoolsThenPoolsAreNotInitialized) {
|
||||
TEST_F(UsmPoolTest, givenCreatedContextWhenCheckingUsmPoolsThenPoolsAreNotInitialized) {
|
||||
EXPECT_FALSE(mockDeviceUsmMemAllocPool->isInitialized());
|
||||
EXPECT_EQ(0u, mockDeviceUsmMemAllocPool->poolSize);
|
||||
EXPECT_EQ(nullptr, mockDeviceUsmMemAllocPool->pool);
|
||||
@@ -53,13 +53,16 @@ TEST_F(ContextUsmPoolTest, givenCreatedContextWhenCheckingUsmPoolsThenPoolsAreNo
|
||||
EXPECT_EQ(nullptr, mockHostUsmMemAllocPool->pool);
|
||||
}
|
||||
|
||||
TEST_F(ContextUsmPoolTest, givenEnabledDebugFlagsAndUsmPoolsNotSupportedWhenCreatingAllocationsThenPoolsAreInitialized) {
|
||||
TEST_F(UsmPoolTest, givenEnabledDebugFlagsAndUsmPoolsNotSupportedWhenCreatingAllocationsThenPoolsAreInitialized) {
|
||||
DebugManagerStateRestore restorer;
|
||||
debugManager.flags.EnableDeviceUsmAllocationPool.set(1);
|
||||
debugManager.flags.EnableHostUsmAllocationPool.set(3);
|
||||
RAIIProductHelperFactory<MockProductHelper> raii(*device->getExecutionEnvironment()->rootDeviceEnvironments[0]);
|
||||
raii.mockProductHelper->isDeviceUsmPoolAllocatorSupportedResult = false;
|
||||
raii.mockProductHelper->isHostUsmPoolAllocatorSupportedResult = false;
|
||||
RAIIProductHelperFactory<MockProductHelper> device1Raii(*device->getExecutionEnvironment()->rootDeviceEnvironments[0]);
|
||||
RAIIProductHelperFactory<MockProductHelper> device2Raii(*device->getExecutionEnvironment()->rootDeviceEnvironments[1]);
|
||||
device1Raii.mockProductHelper->isDeviceUsmPoolAllocatorSupportedResult = false;
|
||||
device1Raii.mockProductHelper->isHostUsmPoolAllocatorSupportedResult = false;
|
||||
device2Raii.mockProductHelper->isHostUsmPoolAllocatorSupportedResult = false;
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
void *pooledDeviceAlloc = clDeviceMemAllocINTEL(mockContext.get(), static_cast<cl_device_id>(mockContext->getDevice(0)), nullptr, poolAllocationThreshold, 0, &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
@@ -82,10 +85,12 @@ TEST_F(ContextUsmPoolTest, givenEnabledDebugFlagsAndUsmPoolsNotSupportedWhenCrea
|
||||
EXPECT_EQ(InternalMemoryType::hostUnifiedMemory, mockHostUsmMemAllocPool->poolMemoryType);
|
||||
}
|
||||
|
||||
TEST_F(ContextUsmPoolTest, givenUsmPoolsSupportedWhenCreatingAllocationsThenPoolsAreInitialized) {
|
||||
RAIIProductHelperFactory<MockProductHelper> raii(*device->getExecutionEnvironment()->rootDeviceEnvironments[0]);
|
||||
raii.mockProductHelper->isDeviceUsmPoolAllocatorSupportedResult = true;
|
||||
raii.mockProductHelper->isHostUsmPoolAllocatorSupportedResult = true;
|
||||
TEST_F(UsmPoolTest, givenUsmPoolsSupportedWhenCreatingAllocationsThenPoolsAreInitialized) {
|
||||
RAIIProductHelperFactory<MockProductHelper> device1Raii(*device->getExecutionEnvironment()->rootDeviceEnvironments[0]);
|
||||
RAIIProductHelperFactory<MockProductHelper> device2Raii(*device->getExecutionEnvironment()->rootDeviceEnvironments[1]);
|
||||
device1Raii.mockProductHelper->isDeviceUsmPoolAllocatorSupportedResult = true;
|
||||
device1Raii.mockProductHelper->isHostUsmPoolAllocatorSupportedResult = true;
|
||||
device2Raii.mockProductHelper->isHostUsmPoolAllocatorSupportedResult = true;
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
void *pooledDeviceAlloc = clDeviceMemAllocINTEL(mockContext.get(), static_cast<cl_device_id>(mockContext->getDevice(0)), nullptr, poolAllocationThreshold, 0, &retVal);
|
||||
@@ -104,13 +109,15 @@ TEST_F(ContextUsmPoolTest, givenUsmPoolsSupportedWhenCreatingAllocationsThenPool
|
||||
EXPECT_TRUE(mockHostUsmMemAllocPool->isInitialized());
|
||||
}
|
||||
|
||||
TEST_F(ContextUsmPoolTest, givenUsmPoolsSupportedAndDisabledByDebugFlagsWhenCreatingAllocationsThenPoolsAreNotInitialized) {
|
||||
TEST_F(UsmPoolTest, givenUsmPoolsSupportedAndDisabledByDebugFlagsWhenCreatingAllocationsThenPoolsAreNotInitialized) {
|
||||
DebugManagerStateRestore restorer;
|
||||
debugManager.flags.EnableDeviceUsmAllocationPool.set(0);
|
||||
debugManager.flags.EnableHostUsmAllocationPool.set(0);
|
||||
RAIIProductHelperFactory<MockProductHelper> raii(*device->getExecutionEnvironment()->rootDeviceEnvironments[0]);
|
||||
raii.mockProductHelper->isDeviceUsmPoolAllocatorSupportedResult = true;
|
||||
raii.mockProductHelper->isHostUsmPoolAllocatorSupportedResult = true;
|
||||
RAIIProductHelperFactory<MockProductHelper> device1Raii(*device->getExecutionEnvironment()->rootDeviceEnvironments[0]);
|
||||
RAIIProductHelperFactory<MockProductHelper> device2Raii(*device->getExecutionEnvironment()->rootDeviceEnvironments[1]);
|
||||
device1Raii.mockProductHelper->isDeviceUsmPoolAllocatorSupportedResult = true;
|
||||
device1Raii.mockProductHelper->isHostUsmPoolAllocatorSupportedResult = true;
|
||||
device2Raii.mockProductHelper->isHostUsmPoolAllocatorSupportedResult = true;
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
void *deviceAlloc = clDeviceMemAllocINTEL(mockContext.get(), static_cast<cl_device_id>(mockContext->getDevice(0)), nullptr, poolAllocationThreshold, 0, &retVal);
|
||||
@@ -125,11 +132,15 @@ TEST_F(ContextUsmPoolTest, givenUsmPoolsSupportedAndDisabledByDebugFlagsWhenCrea
|
||||
EXPECT_FALSE(mockHostUsmMemAllocPool->isInitialized());
|
||||
}
|
||||
|
||||
TEST_F(ContextUsmPoolTest, givenUsmPoolsSupportedAndMultiDeviceContextWhenCreatingAllocationsThenPoolsAreNotInitialized) {
|
||||
RAIIProductHelperFactory<MockProductHelper> raii(*device->getExecutionEnvironment()->rootDeviceEnvironments[0]);
|
||||
raii.mockProductHelper->isDeviceUsmPoolAllocatorSupportedResult = true;
|
||||
raii.mockProductHelper->isHostUsmPoolAllocatorSupportedResult = true;
|
||||
mockContext->devices.push_back(nullptr);
|
||||
TEST_F(UsmPoolTest, givenUsmPoolsSupportedAndMultiDeviceContextWhenCreatingAllocationsThenDevicePoolIsNotInitialized) {
|
||||
RAIIProductHelperFactory<MockProductHelper> device1Raii(*device->getExecutionEnvironment()->rootDeviceEnvironments[0]);
|
||||
RAIIProductHelperFactory<MockProductHelper> device2Raii(*device->getExecutionEnvironment()->rootDeviceEnvironments[1]);
|
||||
device1Raii.mockProductHelper->isDeviceUsmPoolAllocatorSupportedResult = true;
|
||||
device1Raii.mockProductHelper->isHostUsmPoolAllocatorSupportedResult = true;
|
||||
device2Raii.mockProductHelper->isDeviceUsmPoolAllocatorSupportedResult = true;
|
||||
device2Raii.mockProductHelper->isHostUsmPoolAllocatorSupportedResult = true;
|
||||
|
||||
mockContext->devices.push_back(deviceFactory->rootDevices[1]);
|
||||
EXPECT_FALSE(mockContext->isSingleDeviceContext());
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
@@ -142,6 +153,33 @@ TEST_F(ContextUsmPoolTest, givenUsmPoolsSupportedAndMultiDeviceContextWhenCreati
|
||||
clMemFreeINTEL(mockContext.get(), hostAlloc);
|
||||
|
||||
EXPECT_FALSE(mockDeviceUsmMemAllocPool->isInitialized());
|
||||
EXPECT_FALSE(mockHostUsmMemAllocPool->isInitialized());
|
||||
EXPECT_TRUE(mockHostUsmMemAllocPool->isInitialized());
|
||||
mockContext->devices.pop_back();
|
||||
}
|
||||
|
||||
TEST_F(UsmPoolTest, givenTwoContextsWhenHostAllocationIsFreedInFirstContextThenItIsReusedInSecondContext) {
|
||||
DebugManagerStateRestore restorer;
|
||||
debugManager.flags.EnableHostUsmAllocationPool.set(3);
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
void *pooledHostAlloc1 = clHostMemAllocINTEL(mockContext.get(), nullptr, poolAllocationThreshold, 0, &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_NE(nullptr, pooledHostAlloc1);
|
||||
|
||||
EXPECT_TRUE(mockHostUsmMemAllocPool->isInitialized());
|
||||
EXPECT_EQ(3 * MemoryConstants::megaByte, mockHostUsmMemAllocPool->poolSize);
|
||||
|
||||
clMemFreeINTEL(mockContext.get(), pooledHostAlloc1);
|
||||
|
||||
cl_device_id deviceId = device;
|
||||
auto mockContext2 = std::unique_ptr<MockContext>(Context::create<MockContext>(nullptr, ClDeviceVector(&deviceId, 1), nullptr, nullptr, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
void *pooledHostAlloc2 = clHostMemAllocINTEL(mockContext2.get(), nullptr, poolAllocationThreshold, 0, &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_NE(nullptr, pooledHostAlloc2);
|
||||
|
||||
EXPECT_EQ(pooledHostAlloc1, pooledHostAlloc2);
|
||||
|
||||
clMemFreeINTEL(mockContext2.get(), pooledHostAlloc2);
|
||||
}
|
||||
@@ -847,7 +847,8 @@ TEST_F(ShareableUnifiedMemoryManagerPropertiesTest, givenShareableUnifiedPropert
|
||||
}
|
||||
|
||||
TEST(UnifiedSharedMemoryTransferCalls, givenHostUsmAllocationWhenPointerIsUsedForTransferCallsThenUSMAllocationIsReused) {
|
||||
MockContext mockContext;
|
||||
UltClDeviceFactoryWithPlatform deviceFactory{1, 0};
|
||||
MockContext mockContext(deviceFactory.rootDevices[0]);
|
||||
|
||||
cl_context clContext = &mockContext;
|
||||
|
||||
@@ -891,7 +892,8 @@ TEST(UnifiedSharedMemoryTransferCalls, givenHostUsmAllocationWhenPointerIsUsedFo
|
||||
}
|
||||
|
||||
TEST(UnifiedSharedMemoryTransferCalls, givenDeviceUsmAllocationWhenPtrIsUsedForTransferCallsThenUsmAllocationIsReused) {
|
||||
MockContext mockContext;
|
||||
UltClDeviceFactoryWithPlatform deviceFactory{1, 0};
|
||||
MockContext mockContext(deviceFactory.rootDevices[0]);
|
||||
cl_context clContext = &mockContext;
|
||||
|
||||
auto status = CL_INVALID_PLATFORM;
|
||||
@@ -933,7 +935,8 @@ TEST(UnifiedSharedMemoryTransferCalls, givenDeviceUsmAllocationWhenPtrIsUsedForT
|
||||
}
|
||||
|
||||
TEST(UnifiedSharedMemoryTransferCalls, givenDeviceUsmAllocationWhenPtrIsUsedForTransferCallsThenCPUPathIsNotChoosen) {
|
||||
MockContext mockContext;
|
||||
UltClDeviceFactoryWithPlatform deviceFactory{1, 0};
|
||||
MockContext mockContext(deviceFactory.rootDevices[0]);
|
||||
cl_context clContext = &mockContext;
|
||||
|
||||
auto status = CL_INVALID_PLATFORM;
|
||||
@@ -978,7 +981,8 @@ TEST(UnifiedSharedMemoryTransferCalls, givenHostUsmAllocationWhenPtrIsUsedForTra
|
||||
DebugManagerStateRestore restorer;
|
||||
debugManager.flags.EnableLocalMemory.set(false);
|
||||
debugManager.flags.ForceLocalMemoryAccessMode.set(static_cast<int32_t>(LocalMemoryAccessMode::defaultMode));
|
||||
MockContext mockContext;
|
||||
UltClDeviceFactoryWithPlatform deviceFactory{1, 0};
|
||||
MockContext mockContext(deviceFactory.rootDevices[0]);
|
||||
cl_context clContext = &mockContext;
|
||||
|
||||
if (mockContext.getDevice(0u)->getHardwareInfo().capabilityTable.supportsOcl21Features == false) {
|
||||
@@ -1022,7 +1026,8 @@ TEST(UnifiedSharedMemoryTransferCalls, givenHostUsmAllocationWhenPtrIsUsedForTra
|
||||
}
|
||||
|
||||
TEST(UnifiedSharedMemoryTransferCalls, givenHostAllocationThatIsSmallerThenTransferRequirementsThenErrorIsReturned) {
|
||||
MockContext mockContext;
|
||||
UltClDeviceFactoryWithPlatform deviceFactory{1, 0};
|
||||
MockContext mockContext(deviceFactory.rootDevices[0]);
|
||||
|
||||
cl_context clContext = &mockContext;
|
||||
|
||||
@@ -1056,7 +1061,8 @@ TEST(UnifiedSharedMemoryTransferCalls, givenSharedUsmAllocationWithoutLocalMemor
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.EnableLocalMemory.set(0);
|
||||
|
||||
MockContext mockContext;
|
||||
UltClDeviceFactoryWithPlatform deviceFactory{1, 0};
|
||||
MockContext mockContext(deviceFactory.rootDevices[0]);
|
||||
cl_context clContext = &mockContext;
|
||||
cl_device_id clDevice = mockContext.getDevice(0u);
|
||||
|
||||
@@ -1101,7 +1107,8 @@ TEST(UnifiedSharedMemoryTransferCalls, givenSharedUsmAllocationWithLocalMemoryWh
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.EnableLocalMemory.set(1);
|
||||
|
||||
MockContext mockContext;
|
||||
UltClDeviceFactoryWithPlatform deviceFactory{1, 0};
|
||||
MockContext mockContext(deviceFactory.rootDevices[0]);
|
||||
cl_context clContext = &mockContext;
|
||||
cl_device_id clDevice = mockContext.getDevice(0u);
|
||||
|
||||
@@ -1145,7 +1152,12 @@ TEST(UnifiedSharedMemoryTransferCalls, givenSharedUsmAllocationWithLocalMemoryWh
|
||||
|
||||
class UnifiedSharedMemoryHWTest : public testing::Test {
|
||||
public:
|
||||
MockContext mockContext;
|
||||
void SetUp() {
|
||||
mockContext = std::make_unique<MockContext>(deviceFactory.rootDevices[0]);
|
||||
}
|
||||
|
||||
UltClDeviceFactoryWithPlatform deviceFactory{1, 0};
|
||||
std::unique_ptr<MockContext> mockContext;
|
||||
};
|
||||
|
||||
template <typename GfxFamily>
|
||||
@@ -1174,93 +1186,93 @@ class TestCommandQueueHw : public CommandQueueHw<GfxFamily> {
|
||||
|
||||
HWTEST_F(UnifiedSharedMemoryHWTest, givenDeviceUsmAllocationWhenWriteBufferThenCpuPtrIsNotUsed) {
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1,
|
||||
mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields());
|
||||
unifiedMemoryProperties.device = &mockContext.getDevice(0)->getDevice();
|
||||
auto deviceMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
|
||||
auto svmAllocation = mockContext.getSVMAllocsManager()->getSVMAlloc(deviceMemory);
|
||||
GraphicsAllocation *gpuAllocation = svmAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex());
|
||||
mockContext->getRootDeviceIndices(), mockContext->getDeviceBitfields());
|
||||
unifiedMemoryProperties.device = &mockContext->getDevice(0)->getDevice();
|
||||
auto deviceMemory = mockContext->getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
|
||||
auto svmAllocation = mockContext->getSVMAllocsManager()->getSVMAlloc(deviceMemory);
|
||||
GraphicsAllocation *gpuAllocation = svmAllocation->gpuAllocations.getGraphicsAllocation(mockContext->getDevice(0)->getRootDeviceIndex());
|
||||
|
||||
char *cpuPtr = static_cast<char *>(gpuAllocation->getUnderlyingBuffer());
|
||||
auto gpuAddress = gpuAllocation->getGpuAddress();
|
||||
void *gpuPtr = reinterpret_cast<void *>(gpuAddress);
|
||||
auto gmmHelper = mockContext.getDevice(0)->getGmmHelper();
|
||||
auto gmmHelper = mockContext->getDevice(0)->getGmmHelper();
|
||||
|
||||
cl_mem_flags flags = 0;
|
||||
auto status = CL_INVALID_PLATFORM;
|
||||
auto buffer = Buffer::create(&mockContext, flags, 4096u, nullptr, status);
|
||||
auto buffer = Buffer::create(mockContext.get(), flags, 4096u, nullptr, status);
|
||||
ASSERT_EQ(CL_SUCCESS, status);
|
||||
|
||||
TestCommandQueueHw<FamilyType> myCmdQ(&mockContext, mockContext.getDevice(0u), 0);
|
||||
TestCommandQueueHw<FamilyType> myCmdQ(mockContext.get(), mockContext->getDevice(0u), 0);
|
||||
myCmdQ.enqueueWriteBuffer(buffer, false, 0u, 4096u, deviceMemory, nullptr, 0u, nullptr, nullptr);
|
||||
EXPECT_EQ(gpuPtr, myCmdQ.srcPtr);
|
||||
|
||||
auto canonizedGpuAddress = gmmHelper->canonize(gpuAddress);
|
||||
gpuAllocation->setCpuPtrAndGpuAddress(cpuPtr, canonizedGpuAddress);
|
||||
delete buffer;
|
||||
clMemFreeINTEL(&mockContext, deviceMemory);
|
||||
clMemFreeINTEL(mockContext.get(), deviceMemory);
|
||||
}
|
||||
|
||||
HWTEST_F(UnifiedSharedMemoryHWTest, givenDeviceUsmAllocationWhenReadBufferThenCpuPtrIsNotUsed) {
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::deviceUnifiedMemory, 1,
|
||||
mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields());
|
||||
unifiedMemoryProperties.device = &mockContext.getDevice(0)->getDevice();
|
||||
auto deviceMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
|
||||
auto svmAllocation = mockContext.getSVMAllocsManager()->getSVMAlloc(deviceMemory);
|
||||
GraphicsAllocation *gpuAllocation = svmAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex());
|
||||
mockContext->getRootDeviceIndices(), mockContext->getDeviceBitfields());
|
||||
unifiedMemoryProperties.device = &mockContext->getDevice(0)->getDevice();
|
||||
auto deviceMemory = mockContext->getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
|
||||
auto svmAllocation = mockContext->getSVMAllocsManager()->getSVMAlloc(deviceMemory);
|
||||
GraphicsAllocation *gpuAllocation = svmAllocation->gpuAllocations.getGraphicsAllocation(mockContext->getDevice(0)->getRootDeviceIndex());
|
||||
|
||||
char *cpuPtr = static_cast<char *>(gpuAllocation->getUnderlyingBuffer());
|
||||
auto gpuAddress = gpuAllocation->getGpuAddress();
|
||||
void *gpuPtr = reinterpret_cast<void *>(gpuAddress);
|
||||
auto gmmHelper = mockContext.getDevice(0)->getGmmHelper();
|
||||
auto gmmHelper = mockContext->getDevice(0)->getGmmHelper();
|
||||
|
||||
cl_mem_flags flags = 0;
|
||||
auto status = CL_INVALID_PLATFORM;
|
||||
auto buffer = Buffer::create(&mockContext, flags, 4096u, nullptr, status);
|
||||
auto buffer = Buffer::create(mockContext.get(), flags, 4096u, nullptr, status);
|
||||
ASSERT_EQ(CL_SUCCESS, status);
|
||||
|
||||
TestCommandQueueHw<FamilyType> myCmdQ(&mockContext, mockContext.getDevice(0u), 0);
|
||||
TestCommandQueueHw<FamilyType> myCmdQ(mockContext.get(), mockContext->getDevice(0u), 0);
|
||||
myCmdQ.enqueueReadBuffer(buffer, false, 0u, 4096u, deviceMemory, nullptr, 0u, nullptr, nullptr);
|
||||
EXPECT_EQ(gpuPtr, myCmdQ.dstPtr);
|
||||
|
||||
auto canonizedGpuAddress = gmmHelper->canonize(gpuAddress);
|
||||
gpuAllocation->setCpuPtrAndGpuAddress(cpuPtr, canonizedGpuAddress);
|
||||
delete buffer;
|
||||
clMemFreeINTEL(&mockContext, deviceMemory);
|
||||
clMemFreeINTEL(mockContext.get(), deviceMemory);
|
||||
}
|
||||
|
||||
HWTEST_F(UnifiedSharedMemoryHWTest, givenSharedUsmAllocationWhenWriteBufferThenCpuPtrIsNotUsed) {
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1,
|
||||
mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields());
|
||||
auto sharedMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
|
||||
auto svmAllocation = mockContext.getSVMAllocsManager()->getSVMAlloc(sharedMemory);
|
||||
GraphicsAllocation *gpuAllocation = svmAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex());
|
||||
mockContext->getRootDeviceIndices(), mockContext->getDeviceBitfields());
|
||||
auto sharedMemory = mockContext->getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
|
||||
auto svmAllocation = mockContext->getSVMAllocsManager()->getSVMAlloc(sharedMemory);
|
||||
GraphicsAllocation *gpuAllocation = svmAllocation->gpuAllocations.getGraphicsAllocation(mockContext->getDevice(0)->getRootDeviceIndex());
|
||||
|
||||
char *cpuPtr = static_cast<char *>(gpuAllocation->getUnderlyingBuffer());
|
||||
auto gpuAddress = gpuAllocation->getGpuAddress();
|
||||
void *gpuPtr = reinterpret_cast<void *>(gpuAddress);
|
||||
auto gmmHelper = mockContext.getDevice(0)->getGmmHelper();
|
||||
auto gmmHelper = mockContext->getDevice(0)->getGmmHelper();
|
||||
|
||||
cl_mem_flags flags = 0;
|
||||
auto status = CL_INVALID_PLATFORM;
|
||||
auto buffer = Buffer::create(&mockContext, flags, 4096u, nullptr, status);
|
||||
auto buffer = Buffer::create(mockContext.get(), flags, 4096u, nullptr, status);
|
||||
ASSERT_EQ(CL_SUCCESS, status);
|
||||
|
||||
TestCommandQueueHw<FamilyType> myCmdQ(&mockContext, mockContext.getDevice(0u), 0);
|
||||
TestCommandQueueHw<FamilyType> myCmdQ(mockContext.get(), mockContext->getDevice(0u), 0);
|
||||
myCmdQ.enqueueWriteBuffer(buffer, false, 0u, 4096u, sharedMemory, nullptr, 0u, nullptr, nullptr);
|
||||
EXPECT_EQ(gpuPtr, myCmdQ.srcPtr);
|
||||
|
||||
auto canonizedGpuAddress = gmmHelper->canonize(gpuAddress);
|
||||
gpuAllocation->setCpuPtrAndGpuAddress(cpuPtr, canonizedGpuAddress);
|
||||
delete buffer;
|
||||
clMemFreeINTEL(&mockContext, sharedMemory);
|
||||
clMemFreeINTEL(mockContext.get(), sharedMemory);
|
||||
}
|
||||
|
||||
HWTEST_F(UnifiedSharedMemoryHWTest, givenSharedUsmAllocationWhenReadBufferThenCpuPtrIsNotUsed) {
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::sharedUnifiedMemory, 1,
|
||||
mockContext.getRootDeviceIndices(), mockContext.getDeviceBitfields());
|
||||
auto sharedMemory = mockContext.getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
|
||||
auto svmAllocation = mockContext.getSVMAllocsManager()->getSVMAlloc(sharedMemory);
|
||||
GraphicsAllocation *gpuAllocation = svmAllocation->gpuAllocations.getGraphicsAllocation(mockContext.getDevice(0)->getRootDeviceIndex());
|
||||
mockContext->getRootDeviceIndices(), mockContext->getDeviceBitfields());
|
||||
auto sharedMemory = mockContext->getSVMAllocsManager()->createUnifiedMemoryAllocation(4096u, unifiedMemoryProperties);
|
||||
auto svmAllocation = mockContext->getSVMAllocsManager()->getSVMAlloc(sharedMemory);
|
||||
GraphicsAllocation *gpuAllocation = svmAllocation->gpuAllocations.getGraphicsAllocation(mockContext->getDevice(0)->getRootDeviceIndex());
|
||||
|
||||
char *cpuPtr = static_cast<char *>(gpuAllocation->getUnderlyingBuffer());
|
||||
auto gpuAddress = gpuAllocation->getGpuAddress();
|
||||
@@ -1268,18 +1280,18 @@ HWTEST_F(UnifiedSharedMemoryHWTest, givenSharedUsmAllocationWhenReadBufferThenCp
|
||||
|
||||
cl_mem_flags flags = 0;
|
||||
auto status = CL_INVALID_PLATFORM;
|
||||
auto buffer = Buffer::create(&mockContext, flags, 4096u, nullptr, status);
|
||||
auto buffer = Buffer::create(mockContext.get(), flags, 4096u, nullptr, status);
|
||||
ASSERT_EQ(CL_SUCCESS, status);
|
||||
|
||||
TestCommandQueueHw<FamilyType> myCmdQ(&mockContext, mockContext.getDevice(0u), 0);
|
||||
TestCommandQueueHw<FamilyType> myCmdQ(mockContext.get(), mockContext->getDevice(0u), 0);
|
||||
myCmdQ.enqueueReadBuffer(buffer, false, 0u, 4096u, sharedMemory, nullptr, 0u, nullptr, nullptr);
|
||||
EXPECT_EQ(gpuPtr, myCmdQ.dstPtr);
|
||||
|
||||
auto gmmHelper = mockContext.getDevice(0)->getGmmHelper();
|
||||
auto gmmHelper = mockContext->getDevice(0)->getGmmHelper();
|
||||
auto canonizedGpuAddress = gmmHelper->canonize(gpuAddress);
|
||||
gpuAllocation->setCpuPtrAndGpuAddress(cpuPtr, canonizedGpuAddress);
|
||||
delete buffer;
|
||||
clMemFreeINTEL(&mockContext, sharedMemory);
|
||||
clMemFreeINTEL(mockContext.get(), sharedMemory);
|
||||
}
|
||||
|
||||
TEST(UnifiedMemoryManagerTest, givenEnableStatelessCompressionWhenDeviceAllocationIsCreatedThenAllocationTypeIsBufferCompressed) {
|
||||
@@ -1287,12 +1299,14 @@ TEST(UnifiedMemoryManagerTest, givenEnableStatelessCompressionWhenDeviceAllocati
|
||||
debugManager.flags.RenderCompressedBuffersEnabled.set(1);
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
MockContext mockContext;
|
||||
|
||||
auto device = mockContext.getDevice(0u);
|
||||
auto allocationsManager = mockContext.getSVMAllocsManager();
|
||||
|
||||
for (auto enable : {-1, 0, 1}) {
|
||||
UltClDeviceFactoryWithPlatform deviceFactory{1, 0};
|
||||
MockContext mockContext(deviceFactory.rootDevices[0]);
|
||||
|
||||
auto device = mockContext.getDevice(0u);
|
||||
auto allocationsManager = mockContext.getSVMAllocsManager();
|
||||
|
||||
debugManager.flags.EnableStatelessCompression.set(enable);
|
||||
|
||||
auto deviceMemAllocPtr = clDeviceMemAllocINTEL(&mockContext, device, nullptr, 2048, 0, &retVal);
|
||||
|
||||
@@ -61,7 +61,7 @@ MockContext::~MockContext() {
|
||||
stagingBufferManager = nullptr;
|
||||
}
|
||||
if (!platformManagersInitialized && svmAllocsManager) {
|
||||
cleanupUsmAllocationPools();
|
||||
usmDeviceMemAllocPool.cleanup();
|
||||
svmAllocsManager->cleanupUSMAllocCaches();
|
||||
delete svmAllocsManager;
|
||||
svmAllocsManager = nullptr;
|
||||
@@ -73,7 +73,6 @@ MockContext::MockContext() {
|
||||
cl_device_id deviceId = pDevice;
|
||||
initializeWithDevices(ClDeviceVector{&deviceId, 1}, false);
|
||||
pDevice->decRefInternal();
|
||||
this->usmPoolInitialized = true;
|
||||
}
|
||||
|
||||
void MockContext::setSharingFunctions(SharingFunctions *sharingFunctions) {
|
||||
@@ -214,7 +213,6 @@ BcsMockContext::BcsMockContext(ClDevice *device) : MockContext(device) {
|
||||
return BlitOperationResult::success;
|
||||
};
|
||||
blitMemoryToAllocationFuncBackup = mockBlitMemoryToAllocation;
|
||||
this->usmPoolInitialized = true;
|
||||
}
|
||||
BcsMockContext::~BcsMockContext() = default;
|
||||
} // namespace NEO
|
||||
|
||||
@@ -34,7 +34,6 @@ class MockContext : public Context {
|
||||
using Context::devices;
|
||||
using Context::driverDiagnostics;
|
||||
using Context::getUsmDevicePoolParams;
|
||||
using Context::getUsmHostPoolParams;
|
||||
using Context::maxRootDeviceIndex;
|
||||
using Context::memoryManager;
|
||||
using Context::preferD3dSharedResources;
|
||||
@@ -46,7 +45,6 @@ class MockContext : public Context {
|
||||
using Context::specialQueues;
|
||||
using Context::svmAllocsManager;
|
||||
using Context::usmPoolInitialized;
|
||||
using Context::UsmPoolParams;
|
||||
|
||||
MockContext(ClDevice *pDevice, bool noSpecialQueue = false);
|
||||
MockContext(const ClDeviceVector &clDeviceVector, bool noSpecialQueue = true);
|
||||
|
||||
@@ -33,6 +33,18 @@ bool MockPlatform::initializeWithNewDevices() {
|
||||
return Platform::initialize(DeviceFactory::createDevices(executionEnvironment));
|
||||
}
|
||||
|
||||
bool MockPlatform::initializeAsMockClDevices(std::vector<std::unique_ptr<Device>> devices) {
|
||||
bool success = Platform::initialize(std::move(devices));
|
||||
if (success) {
|
||||
for (size_t i = 0; i < clDevices.size(); i++) {
|
||||
auto mockClDevice = new MockClDevice(static_cast<MockDevice *>(&clDevices[i]->getDevice()));
|
||||
delete clDevices[i];
|
||||
clDevices[i] = mockClDevice;
|
||||
}
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
Platform *platform() {
|
||||
if (platformsImpl->empty()) {
|
||||
return nullptr;
|
||||
@@ -53,29 +65,29 @@ static std::mutex mutex;
|
||||
|
||||
bool initPlatform() {
|
||||
std::unique_lock<std::mutex> lock(mutex);
|
||||
auto pPlatform = platform();
|
||||
return pPlatform->initialize(DeviceFactory::createDevices(*pPlatform->peekExecutionEnvironment()));
|
||||
auto pPlatform = static_cast<MockPlatform *>(platform());
|
||||
return pPlatform->initializeAsMockClDevices(DeviceFactory::createDevices(*pPlatform->peekExecutionEnvironment()));
|
||||
}
|
||||
|
||||
bool initPlatform(std::vector<MockClDevice *> clDeviceVector) {
|
||||
bool initPlatform(std::vector<MockDevice *> deviceVector) {
|
||||
std::unique_lock<std::mutex> lock(mutex);
|
||||
auto device = clDeviceVector[0];
|
||||
auto pPlatform = platform(device->getExecutionEnvironment());
|
||||
auto device = deviceVector[0];
|
||||
auto pPlatform = static_cast<MockPlatform *>(platform(device->getExecutionEnvironment()));
|
||||
|
||||
if (pPlatform->isInitialized()) {
|
||||
return true;
|
||||
}
|
||||
std::vector<std::unique_ptr<Device>> devices;
|
||||
for (auto &pClDevice : clDeviceVector) {
|
||||
devices.push_back(std::unique_ptr<Device>(&pClDevice->getDevice()));
|
||||
for (auto &device : deviceVector) {
|
||||
devices.push_back(std::unique_ptr<Device>(device));
|
||||
}
|
||||
return pPlatform->initialize(std::move(devices));
|
||||
return pPlatform->initializeAsMockClDevices(std::move(devices));
|
||||
}
|
||||
|
||||
Platform *constructPlatform() {
|
||||
std::unique_lock<std::mutex> lock(mutex);
|
||||
if (platformsImpl->empty()) {
|
||||
platformsImpl->push_back(std::make_unique<Platform>(*(new MockClExecutionEnvironment())));
|
||||
platformsImpl->push_back(std::make_unique<MockPlatform>(*(new MockClExecutionEnvironment())));
|
||||
}
|
||||
return (*platformsImpl)[0].get();
|
||||
}
|
||||
@@ -87,7 +99,7 @@ Platform *constructPlatform(ExecutionEnvironment *executionEnvironment) {
|
||||
return platform.get();
|
||||
}
|
||||
}
|
||||
platformsImpl->push_back(std::make_unique<Platform>(*executionEnvironment));
|
||||
platformsImpl->push_back(std::make_unique<MockPlatform>(*executionEnvironment));
|
||||
return platformsImpl->back().get();
|
||||
}
|
||||
|
||||
|
||||
@@ -12,12 +12,15 @@
|
||||
|
||||
namespace NEO {
|
||||
class MockClDevice;
|
||||
class MockDevice;
|
||||
class MockPlatform : public Platform {
|
||||
public:
|
||||
using Platform::fillGlobalDispatchTable;
|
||||
using Platform::usmPoolInitialized;
|
||||
MockPlatform() : MockPlatform(*(new ExecutionEnvironment())) {}
|
||||
MockPlatform(ExecutionEnvironment &executionEnvironment) : Platform(executionEnvironment) {}
|
||||
bool initializeWithNewDevices();
|
||||
bool initializeAsMockClDevices(std::vector<std::unique_ptr<Device>> devices);
|
||||
};
|
||||
|
||||
Platform *platform();
|
||||
@@ -30,7 +33,7 @@ Platform *constructPlatform();
|
||||
|
||||
Platform *constructPlatform(ExecutionEnvironment *executionEnvironment);
|
||||
|
||||
bool initPlatform(std::vector<MockClDevice *> clDeviceVector);
|
||||
bool initPlatform(std::vector<MockDevice *> deviceVector);
|
||||
|
||||
bool initPlatform();
|
||||
} // namespace NEO
|
||||
|
||||
@@ -14,27 +14,18 @@
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
UltClDeviceFactory::UltClDeviceFactory(){};
|
||||
|
||||
UltClDeviceFactory::UltClDeviceFactory(uint32_t rootDevicesCount, uint32_t subDevicesCount) {
|
||||
initialize(rootDevicesCount, subDevicesCount, new ClExecutionEnvironment(), nullptr);
|
||||
initialize(rootDevicesCount, subDevicesCount, new ClExecutionEnvironment());
|
||||
}
|
||||
|
||||
UltClDeviceFactory::UltClDeviceFactory(uint32_t rootDevicesCount, uint32_t subDevicesCount, ClExecutionEnvironment *clExecutionEnvironment) {
|
||||
initialize(rootDevicesCount, subDevicesCount, clExecutionEnvironment, nullptr);
|
||||
initialize(rootDevicesCount, subDevicesCount, clExecutionEnvironment);
|
||||
}
|
||||
|
||||
UltClDeviceFactory::UltClDeviceFactory(uint32_t rootDevicesCount, uint32_t subDevicesCount, MemoryManager *memoryManager) {
|
||||
initialize(rootDevicesCount, subDevicesCount, new ClExecutionEnvironment(), memoryManager);
|
||||
}
|
||||
|
||||
void UltClDeviceFactory::initialize(uint32_t rootDevicesCount, uint32_t subDevicesCount, ClExecutionEnvironment *clExecutionEnvironment, MemoryManager *memoryManager) {
|
||||
void UltClDeviceFactory::initialize(uint32_t rootDevicesCount, uint32_t subDevicesCount, ClExecutionEnvironment *clExecutionEnvironment) {
|
||||
pUltDeviceFactory = std::make_unique<UltDeviceFactory>(rootDevicesCount, subDevicesCount, *clExecutionEnvironment);
|
||||
for (auto &pRootDevice : pUltDeviceFactory->rootDevices) {
|
||||
auto pRootClDevice = new MockClDevice{pRootDevice};
|
||||
if (memoryManager != nullptr) {
|
||||
pRootClDevice->injectMemoryManager(memoryManager);
|
||||
}
|
||||
for (auto &pClSubDevice : pRootClDevice->subDevices) {
|
||||
subDevices.push_back(pClSubDevice.get());
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ struct UltDeviceFactory;
|
||||
struct UltClDeviceFactory {
|
||||
public:
|
||||
UltClDeviceFactory(uint32_t rootDevicesCount, uint32_t subDevicesCount);
|
||||
UltClDeviceFactory(uint32_t rootDevicesCount, uint32_t subDevicesCount, MemoryManager *memoryManager);
|
||||
UltClDeviceFactory(uint32_t rootDevicesCount, uint32_t subDevicesCount, ClExecutionEnvironment *clExecutionEnvironment);
|
||||
~UltClDeviceFactory();
|
||||
|
||||
@@ -31,8 +30,7 @@ struct UltClDeviceFactory {
|
||||
std::vector<ClDevice *> subDevices;
|
||||
|
||||
protected:
|
||||
UltClDeviceFactory();
|
||||
void initialize(uint32_t rootDevicesCount, uint32_t subDevicesCount, ClExecutionEnvironment *clExecutionEnvironment, MemoryManager *memoryManager);
|
||||
void initialize(uint32_t rootDevicesCount, uint32_t subDevicesCount, ClExecutionEnvironment *clExecutionEnvironment);
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -28,13 +28,27 @@ UltClDeviceFactoryWithPlatform::UltClDeviceFactoryWithPlatform(uint32_t rootDevi
|
||||
}
|
||||
|
||||
void UltClDeviceFactoryWithPlatform::initialize(uint32_t rootDevicesCount, uint32_t subDevicesCount, ClExecutionEnvironment *clExecutionEnvironment, MemoryManager *memoryManager) {
|
||||
if (!NEO::platform(clExecutionEnvironment)) {
|
||||
NEO::constructPlatform(clExecutionEnvironment);
|
||||
auto platform = NEO::platform(clExecutionEnvironment);
|
||||
if (!platform) {
|
||||
platform = NEO::constructPlatform(clExecutionEnvironment);
|
||||
cleanupPlatformOnDestruction = true;
|
||||
}
|
||||
|
||||
UltClDeviceFactory::initialize(rootDevicesCount, subDevicesCount, clExecutionEnvironment, memoryManager);
|
||||
NEO::initPlatform(rootDevices);
|
||||
pUltDeviceFactory = std::make_unique<UltDeviceFactory>(rootDevicesCount, subDevicesCount, *clExecutionEnvironment);
|
||||
if (memoryManager != nullptr) {
|
||||
for (auto device : pUltDeviceFactory->rootDevices) {
|
||||
device->injectMemoryManager(memoryManager);
|
||||
}
|
||||
}
|
||||
NEO::initPlatform(pUltDeviceFactory->rootDevices);
|
||||
auto clDevices = platform->getClDevices();
|
||||
for (size_t i = 0; i < platform->getNumDevices(); i++) {
|
||||
auto clDevice = static_cast<MockClDevice *>(clDevices[i]);
|
||||
for (auto &clSubDevice : clDevice->subDevices) {
|
||||
subDevices.push_back(clSubDevice.get());
|
||||
}
|
||||
rootDevices.push_back(clDevice);
|
||||
}
|
||||
}
|
||||
|
||||
UltClDeviceFactoryWithPlatform::~UltClDeviceFactoryWithPlatform() {
|
||||
|
||||
@@ -12,15 +12,19 @@ namespace NEO {
|
||||
class ClExecutionEnvironment;
|
||||
class MemoryManager;
|
||||
|
||||
class UltClDeviceFactoryWithPlatform : public UltClDeviceFactory {
|
||||
class UltClDeviceFactoryWithPlatform {
|
||||
public:
|
||||
UltClDeviceFactoryWithPlatform(uint32_t rootDevicesCount, uint32_t subDevicesCount);
|
||||
UltClDeviceFactoryWithPlatform(uint32_t rootDevicesCount, uint32_t subDevicesCount, MemoryManager *memoryManager);
|
||||
UltClDeviceFactoryWithPlatform(uint32_t rootDevicesCount, uint32_t subDevicesCount, ClExecutionEnvironment *clExecutionEnvironment);
|
||||
~UltClDeviceFactoryWithPlatform();
|
||||
bool cleanupPlatformOnDestruction = false;
|
||||
|
||||
std::unique_ptr<UltDeviceFactory> pUltDeviceFactory;
|
||||
std::vector<MockClDevice *> rootDevices;
|
||||
std::vector<ClDevice *> subDevices;
|
||||
|
||||
protected:
|
||||
bool cleanupPlatformOnDestruction = false;
|
||||
void initialize(uint32_t rootDevicesCount, uint32_t subDevicesCount, ClExecutionEnvironment *clExecutionEnvironment, MemoryManager *memoryManager);
|
||||
};
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ using namespace NEO;
|
||||
|
||||
void applyWorkarounds() {
|
||||
platformsImpl = new std::vector<std::unique_ptr<Platform>>;
|
||||
platformsImpl->reserve(1);
|
||||
platformsImpl->reserve(8);
|
||||
}
|
||||
|
||||
void cleanTestHelpers() {
|
||||
|
||||
@@ -598,8 +598,6 @@ XE2_HPG_CORETEST_F(Xe2BcsTests, givenBufferInDeviceMemoryWhenStatelessCompressio
|
||||
*bltCmd = Xe2HpgCoreFamily::cmdInitXyCopyBlt;
|
||||
|
||||
debugManager.flags.EnableStatelessCompressionWithUnifiedMemory.set(true);
|
||||
platformsImpl->clear();
|
||||
EXPECT_EQ(platform(), nullptr);
|
||||
|
||||
BlitCommandsHelper<Xe2HpgCoreFamily>::appendBlitCommandsForBuffer<MEM_COPY>(blitProperties, *bltCmd, context->getDevice(0)->getRootDeviceEnvironment());
|
||||
|
||||
|
||||
@@ -369,8 +369,6 @@ XE3_CORETEST_F(Xe3BcsTests, givenBufferInDeviceMemoryWhenStatelessCompressionIsE
|
||||
*bltCmd = Xe3CoreFamily::cmdInitXyCopyBlt;
|
||||
|
||||
debugManager.flags.EnableStatelessCompressionWithUnifiedMemory.set(true);
|
||||
platformsImpl->clear();
|
||||
EXPECT_EQ(platform(), nullptr);
|
||||
|
||||
BlitCommandsHelper<Xe3CoreFamily>::appendBlitCommandsForBuffer<MEM_COPY>(blitProperties, *bltCmd, context->getDevice(0)->getRootDeviceEnvironment());
|
||||
|
||||
|
||||
@@ -143,9 +143,6 @@ PVCTEST_F(PVcBcsTests, givenCompressibleBuffersWhenStatefulCompressionIsEnabledT
|
||||
auto bltCmd = stream.getSpaceForCmd<MEM_COPY>();
|
||||
*bltCmd = FamilyType::cmdInitXyCopyBlt;
|
||||
|
||||
platformsImpl->clear();
|
||||
EXPECT_EQ(platform(), nullptr);
|
||||
|
||||
const auto &rootDeviceEnvironment = context->getDevice(0)->getRootDeviceEnvironment();
|
||||
BlitCommandsHelper<FamilyType>::appendBlitCommandsForBuffer(blitProperties, *bltCmd, rootDeviceEnvironment);
|
||||
|
||||
@@ -177,8 +174,6 @@ PVCTEST_F(PVcBcsTests, givenBufferInDeviceMemoryWhenStatelessCompressionIsEnable
|
||||
*bltCmd = FamilyType::cmdInitXyCopyBlt;
|
||||
|
||||
debugManager.flags.EnableStatelessCompressionWithUnifiedMemory.set(true);
|
||||
platformsImpl->clear();
|
||||
EXPECT_EQ(platform(), nullptr);
|
||||
|
||||
BlitCommandsHelper<FamilyType>::appendBlitCommandsForBuffer(blitProperties, *bltCmd, context->getDevice(0)->getRootDeviceEnvironment());
|
||||
|
||||
@@ -206,8 +201,6 @@ PVCTEST_F(PVcBcsTests, givenBufferInSystemMemoryWhenStatelessCompressionIsEnable
|
||||
*bltCmd = FamilyType::cmdInitXyCopyBlt;
|
||||
|
||||
debugManager.flags.EnableStatelessCompressionWithUnifiedMemory.set(true);
|
||||
platformsImpl->clear();
|
||||
EXPECT_EQ(platform(), nullptr);
|
||||
|
||||
BlitCommandsHelper<FamilyType>::appendBlitCommandsForBuffer(blitProperties, *bltCmd, context->getDevice(0)->getRootDeviceEnvironment());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user