Add specializedDevice pointer to Device
Related-To: NEO-3938 Change-Id: Ic3386580a22c41f34c67949ccb7f7c6957c8f60d Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
parent
5c4abe1261
commit
5495a4b458
|
@ -5352,7 +5352,8 @@ cl_int CL_API_CALL clEnqueueNDCountKernelINTEL(cl_command_queue commandQueue,
|
||||||
retVal = CL_INVALID_KERNEL;
|
retVal = CL_INVALID_KERNEL;
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
platform()->clDeviceMap[&pCommandQueue->getDevice()]->allocateSyncBufferHandler();
|
|
||||||
|
pCommandQueue->getDevice().getSpecializedDevice<ClDevice>()->allocateSyncBufferHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
TakeOwnershipWrapper<Kernel> kernelOwnership(*pKernel, gtpinIsGTPinInitialized());
|
TakeOwnershipWrapper<Kernel> kernelOwnership(*pKernel, gtpinIsGTPinInitialized());
|
||||||
|
|
|
@ -23,7 +23,7 @@ ClDevice::ClDevice(Device &device, Platform *platform) : device(device), platfor
|
||||||
if (numAvailableDevices > 1) {
|
if (numAvailableDevices > 1) {
|
||||||
for (uint32_t i = 0; i < numAvailableDevices; i++) {
|
for (uint32_t i = 0; i < numAvailableDevices; i++) {
|
||||||
subDevices.push_back(std::make_unique<ClDevice>(*device.getDeviceById(i), platform));
|
subDevices.push_back(std::make_unique<ClDevice>(*device.getDeviceById(i), platform));
|
||||||
platform->clDeviceMap.emplace(device.getDeviceById(i), subDevices[i].get());
|
device.getDeviceById(i)->setSpecializedDevice(subDevices[i].get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,14 @@ class Device : public ReferenceTrackedObject<Device> {
|
||||||
bool areSharedSystemAllocationsAllowed() const {
|
bool areSharedSystemAllocationsAllowed() const {
|
||||||
return this->deviceInfo.sharedSystemMemCapabilities != 0u;
|
return this->deviceInfo.sharedSystemMemCapabilities != 0u;
|
||||||
}
|
}
|
||||||
|
template <typename SpecializedDeviceT>
|
||||||
|
void setSpecializedDevice(SpecializedDeviceT *specializedDevice) {
|
||||||
|
this->specializedDevice = reinterpret_cast<uintptr_t>(specializedDevice);
|
||||||
|
}
|
||||||
|
template <typename SpecializedDeviceT>
|
||||||
|
SpecializedDeviceT *getSpecializedDevice() const {
|
||||||
|
return reinterpret_cast<SpecializedDeviceT *>(specializedDevice);
|
||||||
|
}
|
||||||
|
|
||||||
virtual uint32_t getRootDeviceIndex() const = 0;
|
virtual uint32_t getRootDeviceIndex() const = 0;
|
||||||
virtual uint32_t getNumAvailableDevices() const = 0;
|
virtual uint32_t getNumAvailableDevices() const = 0;
|
||||||
|
@ -106,6 +114,8 @@ class Device : public ReferenceTrackedObject<Device> {
|
||||||
PreemptionMode preemptionMode;
|
PreemptionMode preemptionMode;
|
||||||
ExecutionEnvironment *executionEnvironment = nullptr;
|
ExecutionEnvironment *executionEnvironment = nullptr;
|
||||||
uint32_t defaultEngineIndex = 0;
|
uint32_t defaultEngineIndex = 0;
|
||||||
|
|
||||||
|
uintptr_t specializedDevice = reinterpret_cast<uintptr_t>(nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline EngineControl &Device::getDefaultEngine() {
|
inline EngineControl &Device::getDefaultEngine() {
|
||||||
|
|
|
@ -8,8 +8,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "core/helpers/get_info.h"
|
#include "core/helpers/get_info.h"
|
||||||
#include "runtime/command_queue/command_queue.h"
|
#include "runtime/command_queue/command_queue.h"
|
||||||
|
#include "runtime/device/cl_device.h"
|
||||||
|
#include "runtime/device/device.h"
|
||||||
#include "runtime/device_queue/device_queue.h"
|
#include "runtime/device_queue/device_queue.h"
|
||||||
#include "runtime/platform/platform.h"
|
|
||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
|
|
||||||
|
@ -61,9 +62,11 @@ cl_int getQueueInfo(QueueType *queue,
|
||||||
case CL_QUEUE_CONTEXT:
|
case CL_QUEUE_CONTEXT:
|
||||||
getInfoHelper.set<cl_context>(&queue->getContext());
|
getInfoHelper.set<cl_context>(&queue->getContext());
|
||||||
break;
|
break;
|
||||||
case CL_QUEUE_DEVICE:
|
case CL_QUEUE_DEVICE: {
|
||||||
getInfoHelper.set<cl_device_id>(platform()->clDeviceMap[&queue->getDevice()]);
|
Device &device = queue->getDevice();
|
||||||
|
getInfoHelper.set<cl_device_id>(device.getSpecializedDevice<ClDevice>());
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case CL_QUEUE_REFERENCE_COUNT:
|
case CL_QUEUE_REFERENCE_COUNT:
|
||||||
getInfoHelper.set<cl_int>(queue->getReference());
|
getInfoHelper.set<cl_int>(queue->getReference());
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2279,7 +2279,7 @@ void Kernel::patchSyncBuffer(Device &device, GraphicsAllocation *gfxAllocation,
|
||||||
patchInfo.pAllocateSyncBuffer->SurfaceStateHeapOffset);
|
patchInfo.pAllocateSyncBuffer->SurfaceStateHeapOffset);
|
||||||
auto addressToPatch = gfxAllocation->getUnderlyingBuffer();
|
auto addressToPatch = gfxAllocation->getUnderlyingBuffer();
|
||||||
auto sizeToPatch = gfxAllocation->getUnderlyingBufferSize();
|
auto sizeToPatch = gfxAllocation->getUnderlyingBufferSize();
|
||||||
Buffer::setSurfaceState(platform()->clDeviceMap[&device], surfaceState, sizeToPatch, addressToPatch, 0, gfxAllocation, 0, 0);
|
Buffer::setSurfaceState(device.getSpecializedDevice<ClDevice>(), surfaceState, sizeToPatch, addressToPatch, 0, gfxAllocation, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,6 @@ Platform *constructPlatform() {
|
||||||
|
|
||||||
Platform::Platform() {
|
Platform::Platform() {
|
||||||
clDevices.reserve(4);
|
clDevices.reserve(4);
|
||||||
clDeviceMap.reserve(20);
|
|
||||||
setAsyncEventsHandler(std::unique_ptr<AsyncEventsHandler>(new AsyncEventsHandler()));
|
setAsyncEventsHandler(std::unique_ptr<AsyncEventsHandler>(new AsyncEventsHandler()));
|
||||||
executionEnvironment = new ExecutionEnvironment;
|
executionEnvironment = new ExecutionEnvironment;
|
||||||
executionEnvironment->incRefInternal();
|
executionEnvironment->incRefInternal();
|
||||||
|
@ -161,7 +160,7 @@ bool Platform::initialize() {
|
||||||
DEBUG_BREAK_IF(!pClDevice);
|
DEBUG_BREAK_IF(!pClDevice);
|
||||||
if (pClDevice) {
|
if (pClDevice) {
|
||||||
this->clDevices[deviceOrdinal] = pClDevice;
|
this->clDevices[deviceOrdinal] = pClDevice;
|
||||||
this->clDeviceMap.emplace(pDevice, pClDevice);
|
pDevice->setSpecializedDevice(pClDevice);
|
||||||
|
|
||||||
this->platformInfo->extensions = pDevice->getDeviceInfo().deviceExtensions;
|
this->platformInfo->extensions = pDevice->getDeviceInfo().deviceExtensions;
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,6 @@ class Platform : public BaseObject<_cl_platform_id> {
|
||||||
Device *getDevice(size_t deviceOrdinal);
|
Device *getDevice(size_t deviceOrdinal);
|
||||||
ClDevice **getClDevices();
|
ClDevice **getClDevices();
|
||||||
ClDevice *getClDevice(size_t deviceOrdinal);
|
ClDevice *getClDevice(size_t deviceOrdinal);
|
||||||
std::unordered_map<const Device *, ClDevice *> clDeviceMap;
|
|
||||||
|
|
||||||
const PlatformInfo &getPlatformInfo() const;
|
const PlatformInfo &getPlatformInfo() const;
|
||||||
AsyncEventsHandler *getAsyncEventsHandler();
|
AsyncEventsHandler *getAsyncEventsHandler();
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "core/compiler_interface/compiler_interface.h"
|
#include "core/compiler_interface/compiler_interface.h"
|
||||||
#include "core/utilities/time_measure_wrapper.h"
|
#include "core/utilities/time_measure_wrapper.h"
|
||||||
#include "runtime/device/cl_device.h"
|
#include "runtime/device/cl_device.h"
|
||||||
|
#include "runtime/device/device.h"
|
||||||
#include "runtime/execution_environment/execution_environment.h"
|
#include "runtime/execution_environment/execution_environment.h"
|
||||||
#include "runtime/gtpin/gtpin_notify.h"
|
#include "runtime/gtpin/gtpin_notify.h"
|
||||||
#include "runtime/helpers/validators.h"
|
#include "runtime/helpers/validators.h"
|
||||||
|
@ -186,7 +187,7 @@ void Program::notifyDebuggerWithSourceCode(std::string &filename) {
|
||||||
|
|
||||||
cl_int Program::build(const Device *pDevice, const char *buildOptions, bool enableCaching,
|
cl_int Program::build(const Device *pDevice, const char *buildOptions, bool enableCaching,
|
||||||
std::unordered_map<std::string, BuiltinDispatchInfoBuilder *> &builtinsMap) {
|
std::unordered_map<std::string, BuiltinDispatchInfoBuilder *> &builtinsMap) {
|
||||||
cl_device_id deviceId = platform()->clDeviceMap[pDevice];
|
cl_device_id deviceId = pDevice->getSpecializedDevice<ClDevice>();
|
||||||
auto ret = this->build(1, &deviceId, buildOptions, nullptr, nullptr, enableCaching);
|
auto ret = this->build(1, &deviceId, buildOptions, nullptr, nullptr, enableCaching);
|
||||||
if (ret != CL_SUCCESS) {
|
if (ret != CL_SUCCESS) {
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "core/memory_manager/memory_constants.h"
|
#include "core/memory_manager/memory_constants.h"
|
||||||
#include "runtime/context/context.h"
|
#include "runtime/context/context.h"
|
||||||
#include "runtime/device/cl_device.h"
|
#include "runtime/device/cl_device.h"
|
||||||
|
#include "runtime/device/device.h"
|
||||||
#include "runtime/helpers/string_helpers.h"
|
#include "runtime/helpers/string_helpers.h"
|
||||||
#include "runtime/platform/platform.h"
|
#include "runtime/platform/platform.h"
|
||||||
#include "runtime/program/program.h"
|
#include "runtime/program/program.h"
|
||||||
|
@ -122,7 +123,7 @@ T *Program::create(
|
||||||
Device &device,
|
Device &device,
|
||||||
bool isBuiltIn,
|
bool isBuiltIn,
|
||||||
cl_int *errcodeRet) {
|
cl_int *errcodeRet) {
|
||||||
return Program::create<T>(nullTerminatedString, context, *platform()->clDeviceMap[&device], isBuiltIn, errcodeRet);
|
return Program::create<T>(nullTerminatedString, context, *device.getSpecializedDevice<ClDevice>(), isBuiltIn, errcodeRet);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|
|
@ -287,7 +287,7 @@ bool Program::isValidLlvmBinary(
|
||||||
}
|
}
|
||||||
|
|
||||||
void Program::setDevice(Device *device) {
|
void Program::setDevice(Device *device) {
|
||||||
this->pDevice = platform()->clDeviceMap[device];
|
this->pDevice = device->getSpecializedDevice<ClDevice>();
|
||||||
}
|
}
|
||||||
|
|
||||||
cl_int Program::getSource(std::string &binary) const {
|
cl_int Program::getSource(std::string &binary) const {
|
||||||
|
|
|
@ -32,7 +32,7 @@ struct CopyBufferHw
|
||||||
typedef CopyBufferHw AUBCopyBuffer;
|
typedef CopyBufferHw AUBCopyBuffer;
|
||||||
|
|
||||||
HWTEST_P(AUBCopyBuffer, simple) {
|
HWTEST_P(AUBCopyBuffer, simple) {
|
||||||
MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]);
|
MockContext context(pCmdQ->getDevice().getSpecializedDevice<ClDevice>());
|
||||||
|
|
||||||
cl_float srcMemory[] = {1.0f, 2.0f, 3.0f, 4.0f};
|
cl_float srcMemory[] = {1.0f, 2.0f, 3.0f, 4.0f};
|
||||||
cl_float dstMemory[] = {0.0f, 0.0f, 0.0f, 0.0f};
|
cl_float dstMemory[] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||||
|
|
|
@ -35,7 +35,7 @@ typedef FillBufferHw AUBFillBuffer;
|
||||||
HWTEST_P(AUBFillBuffer, simple) {
|
HWTEST_P(AUBFillBuffer, simple) {
|
||||||
cl_float destMemory[] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
|
cl_float destMemory[] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
|
||||||
auto pDestMemory = &destMemory[0];
|
auto pDestMemory = &destMemory[0];
|
||||||
MockContext context(platform()->clDeviceMap[&this->pCmdQ->getDevice()]);
|
MockContext context(this->pCmdQ->getDevice().getSpecializedDevice<ClDevice>());
|
||||||
auto retVal = CL_INVALID_VALUE;
|
auto retVal = CL_INVALID_VALUE;
|
||||||
auto destBuffer = Buffer::create(
|
auto destBuffer = Buffer::create(
|
||||||
&context,
|
&context,
|
||||||
|
@ -97,7 +97,7 @@ HWTEST_F(AUBFillBuffer, givenFillBufferWhenSeveralSubmissionsWithoutPollForCompl
|
||||||
|
|
||||||
cl_float destMemory[] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
|
cl_float destMemory[] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
|
||||||
auto pDestMemory = &destMemory[0];
|
auto pDestMemory = &destMemory[0];
|
||||||
MockContext context(platform()->clDeviceMap[&this->pCmdQ->getDevice()]);
|
MockContext context(this->pCmdQ->getDevice().getSpecializedDevice<ClDevice>());
|
||||||
auto retVal = CL_INVALID_VALUE;
|
auto retVal = CL_INVALID_VALUE;
|
||||||
std::unique_ptr<Buffer> destBuffer(Buffer::create(
|
std::unique_ptr<Buffer> destBuffer(Buffer::create(
|
||||||
&context,
|
&context,
|
||||||
|
|
|
@ -26,7 +26,7 @@ struct AUBMapBuffer
|
||||||
};
|
};
|
||||||
|
|
||||||
HWTEST_F(AUBMapBuffer, MapUpdateUnmapVerify) {
|
HWTEST_F(AUBMapBuffer, MapUpdateUnmapVerify) {
|
||||||
MockContext context(platform()->clDeviceMap[&this->pCmdQ->getDevice()]);
|
MockContext context(this->pCmdQ->getDevice().getSpecializedDevice<ClDevice>());
|
||||||
auto retVal = CL_INVALID_VALUE;
|
auto retVal = CL_INVALID_VALUE;
|
||||||
size_t bufferSize = 10;
|
size_t bufferSize = 10;
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,7 @@ struct AUBReadBufferUnaligned
|
||||||
|
|
||||||
template <typename FamilyType>
|
template <typename FamilyType>
|
||||||
void testReadBufferUnaligned(size_t offset, size_t size) {
|
void testReadBufferUnaligned(size_t offset, size_t size) {
|
||||||
MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]);
|
MockContext context(pCmdQ->getDevice().getSpecializedDevice<ClDevice>());
|
||||||
|
|
||||||
char srcMemory[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
char srcMemory[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
const auto bufferSize = sizeof(srcMemory);
|
const auto bufferSize = sizeof(srcMemory);
|
||||||
|
|
|
@ -127,7 +127,7 @@ struct AUBReadBufferRectUnaligned
|
||||||
|
|
||||||
template <typename FamilyType>
|
template <typename FamilyType>
|
||||||
void testReadBufferUnaligned(size_t offset, size_t size) {
|
void testReadBufferUnaligned(size_t offset, size_t size) {
|
||||||
MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]);
|
MockContext context(pCmdQ->getDevice().getSpecializedDevice<ClDevice>());
|
||||||
|
|
||||||
char srcMemory[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
char srcMemory[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
const auto bufferSize = sizeof(srcMemory);
|
const auto bufferSize = sizeof(srcMemory);
|
||||||
|
|
|
@ -32,7 +32,7 @@ struct AUBImageUnaligned
|
||||||
|
|
||||||
template <typename FamilyType>
|
template <typename FamilyType>
|
||||||
void testReadImageUnaligned(size_t offset, size_t size, size_t pixelSize) {
|
void testReadImageUnaligned(size_t offset, size_t size, size_t pixelSize) {
|
||||||
MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]);
|
MockContext context(pCmdQ->getDevice().getSpecializedDevice<ClDevice>());
|
||||||
|
|
||||||
char srcMemory[] = "_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnoprstuwxyz";
|
char srcMemory[] = "_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnoprstuwxyz";
|
||||||
const auto bufferSize = sizeof(srcMemory) - 1;
|
const auto bufferSize = sizeof(srcMemory) - 1;
|
||||||
|
@ -128,7 +128,7 @@ struct AUBImageUnaligned
|
||||||
void testWriteImageUnaligned(size_t offset, size_t size, size_t pixelSize) {
|
void testWriteImageUnaligned(size_t offset, size_t size, size_t pixelSize) {
|
||||||
DebugManagerStateRestore restorer;
|
DebugManagerStateRestore restorer;
|
||||||
DebugManager.flags.ForceLinearImages.set(true);
|
DebugManager.flags.ForceLinearImages.set(true);
|
||||||
MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]);
|
MockContext context(pCmdQ->getDevice().getSpecializedDevice<ClDevice>());
|
||||||
|
|
||||||
char srcMemory[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnoprstuwxyz";
|
char srcMemory[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnoprstuwxyz";
|
||||||
const auto bufferSize = sizeof(srcMemory);
|
const auto bufferSize = sizeof(srcMemory);
|
||||||
|
|
|
@ -76,7 +76,7 @@ HWTEST_P(VerifyMemoryBufferHw, givenDifferentBuffersWhenValidatingMemoryThenSucc
|
||||||
invalidContent2.get()[offset + itemOffset] = pTestItemWrong2[itemOffset];
|
invalidContent2.get()[offset + itemOffset] = pTestItemWrong2[itemOffset];
|
||||||
}
|
}
|
||||||
|
|
||||||
MockContext context(platform()->clDeviceMap[&this->pCmdQ->getDevice()]);
|
MockContext context(this->pCmdQ->getDevice().getSpecializedDevice<ClDevice>());
|
||||||
cl_int retVal = CL_INVALID_VALUE;
|
cl_int retVal = CL_INVALID_VALUE;
|
||||||
|
|
||||||
std::unique_ptr<Buffer> buffer(Buffer::create(
|
std::unique_ptr<Buffer> buffer(Buffer::create(
|
||||||
|
|
|
@ -29,7 +29,7 @@ struct TimestampPacketAubTests : public CommandEnqueueAUBFixture, public ::testi
|
||||||
};
|
};
|
||||||
|
|
||||||
HWTEST_F(TimestampPacketAubTests, givenTwoBatchedEnqueuesWhenDependencyIsResolvedThenDecrementCounterOnGpu) {
|
HWTEST_F(TimestampPacketAubTests, givenTwoBatchedEnqueuesWhenDependencyIsResolvedThenDecrementCounterOnGpu) {
|
||||||
MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]);
|
MockContext context(pCmdQ->getDevice().getSpecializedDevice<ClDevice>());
|
||||||
pCommandStreamReceiver->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
|
pCommandStreamReceiver->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
|
||||||
|
|
||||||
const size_t bufferSize = 1024;
|
const size_t bufferSize = 1024;
|
||||||
|
@ -70,7 +70,7 @@ HWTEST_F(TimestampPacketAubTests, givenTwoBatchedEnqueuesWhenDependencyIsResolve
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(TimestampPacketAubTests, givenMultipleWalkersWhenEnqueueingThenWriteAllTimestamps) {
|
HWTEST_F(TimestampPacketAubTests, givenMultipleWalkersWhenEnqueueingThenWriteAllTimestamps) {
|
||||||
MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]);
|
MockContext context(pCmdQ->getDevice().getSpecializedDevice<ClDevice>());
|
||||||
const size_t bufferSize = 70;
|
const size_t bufferSize = 70;
|
||||||
const size_t writeSize = bufferSize - 2;
|
const size_t writeSize = bufferSize - 2;
|
||||||
uint8_t writeData[writeSize] = {};
|
uint8_t writeData[writeSize] = {};
|
||||||
|
|
|
@ -33,7 +33,7 @@ struct WriteBufferHw
|
||||||
typedef WriteBufferHw AUBWriteBuffer;
|
typedef WriteBufferHw AUBWriteBuffer;
|
||||||
|
|
||||||
HWTEST_P(AUBWriteBuffer, simple) {
|
HWTEST_P(AUBWriteBuffer, simple) {
|
||||||
MockContext context(platform()->clDeviceMap[&this->pCmdQ->getDevice()]);
|
MockContext context(this->pCmdQ->getDevice().getSpecializedDevice<ClDevice>());
|
||||||
|
|
||||||
cl_float *srcMemory = new float[1024];
|
cl_float *srcMemory = new float[1024];
|
||||||
cl_float *destMemory = new float[1024];
|
cl_float *destMemory = new float[1024];
|
||||||
|
@ -124,7 +124,7 @@ struct AUBWriteBufferUnaligned
|
||||||
|
|
||||||
template <typename FamilyType>
|
template <typename FamilyType>
|
||||||
void testWriteBufferUnaligned(size_t offset, size_t size) {
|
void testWriteBufferUnaligned(size_t offset, size_t size) {
|
||||||
MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]);
|
MockContext context(pCmdQ->getDevice().getSpecializedDevice<ClDevice>());
|
||||||
|
|
||||||
char srcMemory[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
char srcMemory[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
const auto bufferSize = sizeof(srcMemory);
|
const auto bufferSize = sizeof(srcMemory);
|
||||||
|
|
|
@ -126,7 +126,7 @@ struct AUBWriteBufferRectUnaligned
|
||||||
|
|
||||||
template <typename FamilyType>
|
template <typename FamilyType>
|
||||||
void testWriteBufferUnaligned(size_t offset, size_t size) {
|
void testWriteBufferUnaligned(size_t offset, size_t size) {
|
||||||
MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]);
|
MockContext context(pCmdQ->getDevice().getSpecializedDevice<ClDevice>());
|
||||||
|
|
||||||
char srcMemory[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
char srcMemory[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
const auto bufferSize = sizeof(srcMemory);
|
const auto bufferSize = sizeof(srcMemory);
|
||||||
|
|
|
@ -291,7 +291,7 @@ HWTEST_F(CommandQueueHwTest, GivenNonEmptyQueueOnBlockingMapBufferWillWaitForPre
|
||||||
bool finishWasCalled;
|
bool finishWasCalled;
|
||||||
};
|
};
|
||||||
|
|
||||||
MockCmdQ cmdQ(context, platform()->clDeviceMap[&pCmdQ->getDevice()]);
|
MockCmdQ cmdQ(context, pCmdQ->getDevice().getSpecializedDevice<ClDevice>());
|
||||||
|
|
||||||
auto b1 = clCreateBuffer(context, CL_MEM_READ_WRITE, 20, nullptr, nullptr);
|
auto b1 = clCreateBuffer(context, CL_MEM_READ_WRITE, 20, nullptr, nullptr);
|
||||||
auto b2 = clCreateBuffer(context, CL_MEM_READ_WRITE, 20, nullptr, nullptr);
|
auto b2 = clCreateBuffer(context, CL_MEM_READ_WRITE, 20, nullptr, nullptr);
|
||||||
|
|
|
@ -26,7 +26,7 @@ struct EnqueueReadBufferRectTest : public CommandEnqueueFixture,
|
||||||
|
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
CommandEnqueueFixture::SetUp();
|
CommandEnqueueFixture::SetUp();
|
||||||
context.reset(new MockContext(platform()->clDeviceMap[&pCmdQ->getDevice()]));
|
context.reset(new MockContext(pCmdQ->getDevice().getSpecializedDevice<ClDevice>()));
|
||||||
BufferDefaults::context = context.get();
|
BufferDefaults::context = context.get();
|
||||||
|
|
||||||
//For 3D
|
//For 3D
|
||||||
|
|
|
@ -33,7 +33,7 @@ class CommandStreamReceiverMock : public UltCommandStreamReceiver<FamilyType> {
|
||||||
size_t expectedToFreeCount = (size_t)-1;
|
size_t expectedToFreeCount = (size_t)-1;
|
||||||
CommandStreamReceiverMock(Device *pDevice) : UltCommandStreamReceiver<FamilyType>(*pDevice->getExecutionEnvironment(), pDevice->getRootDeviceIndex()) {
|
CommandStreamReceiverMock(Device *pDevice) : UltCommandStreamReceiver<FamilyType>(*pDevice->getExecutionEnvironment(), pDevice->getRootDeviceIndex()) {
|
||||||
this->pDevice = pDevice;
|
this->pDevice = pDevice;
|
||||||
this->pClDevice = platform()->clDeviceMap[pDevice];
|
this->pClDevice = pDevice->getSpecializedDevice<ClDevice>();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override {
|
bool flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override {
|
||||||
|
|
|
@ -28,9 +28,9 @@ MockClDevice::MockClDevice(MockDevice *pMockDevice)
|
||||||
executionEnvironment(pMockDevice->executionEnvironment),
|
executionEnvironment(pMockDevice->executionEnvironment),
|
||||||
subdevices(pMockDevice->subdevices), mockMemoryManager(pMockDevice->mockMemoryManager), engines(pMockDevice->engines) {
|
subdevices(pMockDevice->subdevices), mockMemoryManager(pMockDevice->mockMemoryManager), engines(pMockDevice->engines) {
|
||||||
|
|
||||||
platform()->clDeviceMap.emplace(pMockDevice, this);
|
pMockDevice->setSpecializedDevice(static_cast<ClDevice *>(this));
|
||||||
for (uint32_t i = 0; i < getNumAvailableDevices(); i++) {
|
for (uint32_t i = 0; i < getNumAvailableDevices(); i++) {
|
||||||
platform()->clDeviceMap.emplace(pMockDevice->getDeviceById(i), this->getDeviceById(i));
|
pMockDevice->getDeviceById(i)->setSpecializedDevice(this->getDeviceById(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,15 +45,6 @@ MockDevice::MockDevice()
|
||||||
initializeCaps();
|
initializeCaps();
|
||||||
}
|
}
|
||||||
|
|
||||||
MockClDevice::~MockClDevice() {
|
|
||||||
if (platform()) {
|
|
||||||
platform()->clDeviceMap.erase(&device);
|
|
||||||
for (uint32_t i = 0; i < getNumAvailableDevices(); i++) {
|
|
||||||
platform()->clDeviceMap.erase(device.getDeviceById(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *MockDevice::getProductAbbrev() const {
|
const char *MockDevice::getProductAbbrev() const {
|
||||||
return hardwarePrefix[getHardwareInfo().platform.eProductFamily];
|
return hardwarePrefix[getHardwareInfo().platform.eProductFamily];
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,6 @@ class MockClDevice : public ClDevice {
|
||||||
using ClDevice::simultaneousInterops;
|
using ClDevice::simultaneousInterops;
|
||||||
|
|
||||||
explicit MockClDevice(MockDevice *pMockDevice);
|
explicit MockClDevice(MockDevice *pMockDevice);
|
||||||
~MockClDevice();
|
|
||||||
|
|
||||||
bool createEngines() { return device.createEngines(); }
|
bool createEngines() { return device.createEngines(); }
|
||||||
void setOSTime(OSTime *osTime) { device.setOSTime(osTime); }
|
void setOSTime(OSTime *osTime) { device.setOSTime(osTime); }
|
||||||
|
|
|
@ -117,7 +117,7 @@ class MockKernel : public Kernel {
|
||||||
static KernelType *create(Device &device, Program *program, uint32_t grfNumber) {
|
static KernelType *create(Device &device, Program *program, uint32_t grfNumber) {
|
||||||
auto info = new KernelInfo();
|
auto info = new KernelInfo();
|
||||||
const size_t crossThreadSize = 160;
|
const size_t crossThreadSize = 160;
|
||||||
auto pClDevice = platform()->clDeviceMap[&device];
|
auto pClDevice = device.getSpecializedDevice<ClDevice>();
|
||||||
|
|
||||||
SKernelBinaryHeaderCommon *header = new SKernelBinaryHeaderCommon;
|
SKernelBinaryHeaderCommon *header = new SKernelBinaryHeaderCommon;
|
||||||
header->DynamicStateHeapSize = 0;
|
header->DynamicStateHeapSize = 0;
|
||||||
|
|
Loading…
Reference in New Issue