Add ClDevice

Decouple cl_device_id from Device class.

Related-To: NEO-3938

Change-Id: I68543a753aea562f3b47ba0d23a059ff3cffa906
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski
2020-01-14 14:32:11 +01:00
parent b982fb058c
commit 8fcff2241f
333 changed files with 2482 additions and 2149 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -312,7 +312,7 @@ TEST(CompilerInterfaceCachedTests, wasCached) {
}
TEST(CompilerInterfaceCachedTests, givenKernelWithoutIncludesAndBinaryInCacheWhenCompilationRequestedThenFCLIsNotCalled) {
MockDevice device;
MockClDevice device{new MockDevice};
MockContext context(&device, true);
MockProgram program(*device.getExecutionEnvironment(), &context, false);
TranslationInput inputArgs{IGC::CodeType::oclC, IGC::CodeType::oclGenBin};
@@ -337,7 +337,7 @@ TEST(CompilerInterfaceCachedTests, givenKernelWithoutIncludesAndBinaryInCacheWhe
auto compilerInterface = std::unique_ptr<CompilerInterface>(CompilerInterface::createInstance(std::move(cache), true));
TranslationOutput translationOutput;
inputArgs.allowCaching = true;
auto retVal = compilerInterface->build(device, inputArgs, translationOutput);
auto retVal = compilerInterface->build(device.getDevice(), inputArgs, translationOutput);
EXPECT_EQ(TranslationOutput::ErrorCode::Success, retVal);
gEnvironment->fclPopDebugVars();
@@ -345,7 +345,7 @@ TEST(CompilerInterfaceCachedTests, givenKernelWithoutIncludesAndBinaryInCacheWhe
}
TEST(CompilerInterfaceCachedTests, givenKernelWithIncludesAndBinaryInCacheWhenCompilationRequestedThenFCLIsCalled) {
MockDevice device;
MockClDevice device{new MockDevice};
MockContext context(&device, true);
MockProgram program(*device.getExecutionEnvironment(), &context, false);
TranslationInput inputArgs{IGC::CodeType::oclC, IGC::CodeType::oclGenBin};
@@ -363,7 +363,7 @@ TEST(CompilerInterfaceCachedTests, givenKernelWithIncludesAndBinaryInCacheWhenCo
auto compilerInterface = std::unique_ptr<CompilerInterface>(CompilerInterface::createInstance(std::move(cache), true));
TranslationOutput translationOutput;
inputArgs.allowCaching = true;
auto retVal = compilerInterface->build(device, inputArgs, translationOutput);
auto retVal = compilerInterface->build(device.getDevice(), inputArgs, translationOutput);
EXPECT_EQ(TranslationOutput::ErrorCode::BuildFailure, retVal);
gEnvironment->fclPopDebugVars();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -35,7 +35,7 @@ void DevicePreemptionTests::SetUp() {
}
const cl_queue_properties properties[3] = {CL_QUEUE_PROPERTIES, 0, 0};
kernelInfo = std::make_unique<KernelInfo>();
device.reset(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
context.reset(new MockContext(device.get()));
cmdQ.reset(new MockCommandQueue(context.get(), device.get(), properties));
executionEnvironment.reset(new SPatchExecutionEnvironment);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -49,7 +49,7 @@ class DevicePreemptionTests : public ::testing::Test {
std::unique_ptr<NEO::DispatchInfo> dispatchInfo;
std::unique_ptr<NEO::MockKernel> kernel;
std::unique_ptr<NEO::MockCommandQueue> cmdQ;
std::unique_ptr<NEO::MockDevice> device;
std::unique_ptr<NEO::MockClDevice> device;
std::unique_ptr<NEO::MockContext> context;
std::unique_ptr<DebugManagerStateRestore> dbgRestore;
std::unique_ptr<iOpenCL::SPatchExecutionEnvironment> executionEnvironment;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -31,11 +31,11 @@ PreemptionTestHwDetails GetPreemptionTestHwDetails<ICLFamily>() {
GEN11TEST_F(Gen11PreemptionTests, whenMidThreadPreemptionIsNotAvailableThenDoesNotProgramStateSip) {
device->setPreemptionMode(PreemptionMode::ThreadGroup);
size_t requiredSize = PreemptionHelper::getRequiredPreambleSize<FamilyType>(*device);
size_t requiredSize = PreemptionHelper::getRequiredPreambleSize<FamilyType>(device->getDevice());
EXPECT_EQ(0U, requiredSize);
LinearStream cmdStream{nullptr, 0};
PreemptionHelper::getRequiredStateSipCmdSize<FamilyType>(*device);
PreemptionHelper::getRequiredStateSipCmdSize<FamilyType>(device->getDevice());
EXPECT_EQ(0U, cmdStream.getUsed());
}
@@ -45,7 +45,7 @@ GEN11TEST_F(Gen11PreemptionTests, whenMidThreadPreemptionIsAvailableThenStateSip
device->setPreemptionMode(PreemptionMode::MidThread);
executionEnvironment->DisableMidThreadPreemption = 0;
size_t requiredCmdStreamSize = PreemptionHelper::getRequiredStateSipCmdSize<FamilyType>(*device);
size_t requiredCmdStreamSize = PreemptionHelper::getRequiredStateSipCmdSize<FamilyType>(device->getDevice());
size_t expectedPreambleSize = sizeof(STATE_SIP);
EXPECT_EQ(expectedPreambleSize, requiredCmdStreamSize);
@@ -53,28 +53,28 @@ GEN11TEST_F(Gen11PreemptionTests, whenMidThreadPreemptionIsAvailableThenStateSip
ASSERT_LE(requiredCmdStreamSize, streamStorage.size());
LinearStream cmdStream{streamStorage.begin(), streamStorage.size()};
PreemptionHelper::programStateSip<FamilyType>(cmdStream, *device);
PreemptionHelper::programStateSip<FamilyType>(cmdStream, device->getDevice());
HardwareParse hwParsePreamble;
hwParsePreamble.parseCommands<FamilyType>(cmdStream);
auto stateSipCmd = hwParsePreamble.getCommand<STATE_SIP>();
ASSERT_NE(nullptr, stateSipCmd);
EXPECT_EQ(device->getExecutionEnvironment()->getBuiltIns()->getSipKernel(SipKernelType::Csr, *device).getSipAllocation()->getGpuAddressToPatch(), stateSipCmd->getSystemInstructionPointer());
EXPECT_EQ(device->getExecutionEnvironment()->getBuiltIns()->getSipKernel(SipKernelType::Csr, device->getDevice()).getSipAllocation()->getGpuAddressToPatch(), stateSipCmd->getSystemInstructionPointer());
}
GEN11TEST_F(Gen11PreemptionTests, getRequiredCmdQSize) {
size_t expectedSize = 0;
EXPECT_EQ(expectedSize, PreemptionHelper::getPreemptionWaCsSize<FamilyType>(*device));
EXPECT_EQ(expectedSize, PreemptionHelper::getPreemptionWaCsSize<FamilyType>(device->getDevice()));
}
GEN11TEST_F(Gen11PreemptionTests, applyPreemptionWaCmds) {
size_t usedSize = 0;
auto &cmdStream = cmdQ->getCS(0);
PreemptionHelper::applyPreemptionWaCmdsBegin<FamilyType>(&cmdStream, *device);
PreemptionHelper::applyPreemptionWaCmdsBegin<FamilyType>(&cmdStream, device->getDevice());
EXPECT_EQ(usedSize, cmdStream.getUsed());
PreemptionHelper::applyPreemptionWaCmdsEnd<FamilyType>(&cmdStream, *device);
PreemptionHelper::applyPreemptionWaCmdsEnd<FamilyType>(&cmdStream, device->getDevice());
EXPECT_EQ(usedSize, cmdStream.getUsed());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 Intel Corporation
* Copyright (C) 2019-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -26,26 +26,26 @@ PreemptionTestHwDetails GetPreemptionTestHwDetails<TGLLPFamily>() {
}
GEN12LPTEST_F(Gen12LpPreemptionTests, whenProgramStateSipIsCalledThenStateSipCmdIsNotAddedToStream) {
size_t requiredSize = PreemptionHelper::getRequiredStateSipCmdSize<FamilyType>(*device);
size_t requiredSize = PreemptionHelper::getRequiredStateSipCmdSize<FamilyType>(device->getDevice());
EXPECT_EQ(0U, requiredSize);
LinearStream cmdStream{nullptr, 0};
PreemptionHelper::programStateSip<FamilyType>(cmdStream, *device);
PreemptionHelper::programStateSip<FamilyType>(cmdStream, device->getDevice());
EXPECT_EQ(0U, cmdStream.getUsed());
}
GEN12LPTEST_F(Gen12LpPreemptionTests, getRequiredCmdQSize) {
size_t expectedSize = 0;
EXPECT_EQ(expectedSize, PreemptionHelper::getPreemptionWaCsSize<FamilyType>(*device));
EXPECT_EQ(expectedSize, PreemptionHelper::getPreemptionWaCsSize<FamilyType>(device->getDevice()));
}
GEN12LPTEST_F(Gen12LpPreemptionTests, applyPreemptionWaCmds) {
size_t usedSize = 0;
auto &cmdStream = cmdQ->getCS(0);
PreemptionHelper::applyPreemptionWaCmdsBegin<FamilyType>(&cmdStream, *device);
PreemptionHelper::applyPreemptionWaCmdsBegin<FamilyType>(&cmdStream, device->getDevice());
EXPECT_EQ(usedSize, cmdStream.getUsed());
PreemptionHelper::applyPreemptionWaCmdsEnd<FamilyType>(&cmdStream, *device);
PreemptionHelper::applyPreemptionWaCmdsEnd<FamilyType>(&cmdStream, device->getDevice());
EXPECT_EQ(usedSize, cmdStream.getUsed());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -33,16 +33,16 @@ PreemptionTestHwDetails GetPreemptionTestHwDetails<BDWFamily>() {
GEN8TEST_F(Gen8PreemptionTests, allowThreadGroupPreemptionReturnsTrue) {
PreemptionFlags flags = {};
PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get());
PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get());
EXPECT_TRUE(PreemptionHelper::allowThreadGroupPreemption(flags));
}
GEN8TEST_F(Gen8PreemptionTests, whenProgramStateSipIsCalledThenNoCmdsAreProgrammed) {
size_t requiredSize = PreemptionHelper::getRequiredStateSipCmdSize<FamilyType>(*device);
size_t requiredSize = PreemptionHelper::getRequiredStateSipCmdSize<FamilyType>(device->getDevice());
EXPECT_EQ(0U, requiredSize);
LinearStream cmdStream{nullptr, 0};
PreemptionHelper::programStateSip<FamilyType>(cmdStream, *device);
PreemptionHelper::programStateSip<FamilyType>(cmdStream, device->getDevice());
EXPECT_EQ(0U, cmdStream.getUsed());
}
@@ -54,7 +54,7 @@ GEN8TEST_F(Gen8PreemptionEnqueueKernelTest, givenSecondEnqueueWithTheSamePreempt
size_t off[3] = {0, 0, 0};
size_t gws[3] = {1, 1, 1};
MockKernelWithInternals mockKernel(*pDevice);
MockKernelWithInternals mockKernel(*pClDevice);
HardwareParse hwParser;
pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, off, gws, nullptr, 0, nullptr, nullptr);
@@ -73,7 +73,7 @@ GEN8TEST_F(Gen8PreemptionEnqueueKernelTest, givenValidKernelForPreemptionWhenEnq
auto mockCsr = new MockCsrHw2<FamilyType>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
pDevice->resetCommandStreamReceiver(mockCsr);
MockKernelWithInternals mockKernel(*pDevice);
MockKernelWithInternals mockKernel(*pClDevice);
PreemptionFlags flags = {};
MultiDispatchInfo multiDispatch(mockKernel.mockKernel);
EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(*pDevice, multiDispatch));
@@ -91,7 +91,7 @@ GEN8TEST_F(Gen8PreemptionEnqueueKernelTest, givenValidKernelForPreemptionWhenEnq
auto mockCsr = new MockCsrHw2<FamilyType>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
pDevice->resetCommandStreamReceiver(mockCsr);
MockKernelWithInternals mockKernel(*pDevice);
MockKernelWithInternals mockKernel(*pClDevice);
PreemptionFlags flags = {};
PreemptionHelper::setPreemptionLevelFlags(flags, *pDevice, mockKernel.mockKernel);
EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(pDevice->getPreemptionMode(), flags));
@@ -114,7 +114,7 @@ GEN8TEST_F(Gen8PreemptionEnqueueKernelTest, givenDisabledPreemptionWhenEnqueueKe
auto mockCsr = new MockCsrHw2<FamilyType>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
pDevice->resetCommandStreamReceiver(mockCsr);
MockKernelWithInternals mockKernel(*pDevice);
MockKernelWithInternals mockKernel(*pClDevice);
PreemptionFlags flags = {};
PreemptionHelper::setPreemptionLevelFlags(flags, *pDevice, mockKernel.mockKernel);
EXPECT_EQ(PreemptionMode::Disabled, PreemptionHelper::taskPreemptionMode(pDevice->getPreemptionMode(), flags));
@@ -130,7 +130,7 @@ GEN8TEST_F(Gen8PreemptionEnqueueKernelTest, givenDisabledPreemptionWhenEnqueueKe
GEN8TEST_F(Gen8PreemptionTests, getPreemptionWaCsSizeMidBatch) {
size_t expectedSize = 0;
device->setPreemptionMode(PreemptionMode::MidBatch);
size_t size = PreemptionHelper::getPreemptionWaCsSize<FamilyType>(*device);
size_t size = PreemptionHelper::getPreemptionWaCsSize<FamilyType>(device->getDevice());
EXPECT_EQ(expectedSize, size);
}
@@ -138,7 +138,7 @@ GEN8TEST_F(Gen8PreemptionTests, getPreemptionWaCsSizeThreadGroupNoWa) {
size_t expectedSize = 0;
device->setPreemptionMode(PreemptionMode::ThreadGroup);
device->getExecutionEnvironment()->getMutableHardwareInfo()->workaroundTable.waModifyVFEStateAfterGPGPUPreemption = false;
size_t size = PreemptionHelper::getPreemptionWaCsSize<FamilyType>(*device);
size_t size = PreemptionHelper::getPreemptionWaCsSize<FamilyType>(device->getDevice());
EXPECT_EQ(expectedSize, size);
}
@@ -147,7 +147,7 @@ GEN8TEST_F(Gen8PreemptionTests, getPreemptionWaCsSizeThreadGroupWa) {
size_t expectedSize = 2 * sizeof(MI_LOAD_REGISTER_IMM);
device->setPreemptionMode(PreemptionMode::ThreadGroup);
device->getExecutionEnvironment()->getMutableHardwareInfo()->workaroundTable.waModifyVFEStateAfterGPGPUPreemption = true;
size_t size = PreemptionHelper::getPreemptionWaCsSize<FamilyType>(*device);
size_t size = PreemptionHelper::getPreemptionWaCsSize<FamilyType>(device->getDevice());
EXPECT_EQ(expectedSize, size);
}
@@ -155,7 +155,7 @@ GEN8TEST_F(Gen8PreemptionTests, getPreemptionWaCsSizeMidThreadNoWa) {
size_t expectedSize = 0;
device->setPreemptionMode(PreemptionMode::MidThread);
device->getExecutionEnvironment()->getMutableHardwareInfo()->workaroundTable.waModifyVFEStateAfterGPGPUPreemption = false;
size_t size = PreemptionHelper::getPreemptionWaCsSize<FamilyType>(*device);
size_t size = PreemptionHelper::getPreemptionWaCsSize<FamilyType>(device->getDevice());
EXPECT_EQ(expectedSize, size);
}
@@ -164,7 +164,7 @@ GEN8TEST_F(Gen8PreemptionTests, getPreemptionWaCsSizeMidThreadWa) {
size_t expectedSize = 2 * sizeof(MI_LOAD_REGISTER_IMM);
device->setPreemptionMode(PreemptionMode::MidThread);
device->getExecutionEnvironment()->getMutableHardwareInfo()->workaroundTable.waModifyVFEStateAfterGPGPUPreemption = true;
size_t size = PreemptionHelper::getPreemptionWaCsSize<FamilyType>(*device);
size_t size = PreemptionHelper::getPreemptionWaCsSize<FamilyType>(device->getDevice());
EXPECT_EQ(expectedSize, size);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -49,11 +49,11 @@ PreemptionTestHwDetails GetPreemptionTestHwDetails<SKLFamily>() {
GEN9TEST_F(Gen9PreemptionTests, whenMidThreadPreemptionIsNotAvailableThenDoesNotProgramPreamble) {
device->setPreemptionMode(PreemptionMode::ThreadGroup);
size_t requiredSize = PreemptionHelper::getRequiredStateSipCmdSize<FamilyType>(*device);
size_t requiredSize = PreemptionHelper::getRequiredStateSipCmdSize<FamilyType>(device->getDevice());
EXPECT_EQ(0U, requiredSize);
LinearStream cmdStream{nullptr, 0};
PreemptionHelper::programStateSip<FamilyType>(cmdStream, *device);
PreemptionHelper::programStateSip<FamilyType>(cmdStream, device->getDevice());
EXPECT_EQ(0U, cmdStream.getUsed());
}
@@ -67,7 +67,7 @@ GEN9TEST_F(Gen9PreemptionTests, whenMidThreadPreemptionIsAvailableThenStateSipIs
uint64_t minCsrAlignment = 2 * 256 * MemoryConstants::kiloByte;
MockGraphicsAllocation csrSurface((void *)minCsrAlignment, minCsrSize);
size_t requiredCmdStreamSize = PreemptionHelper::getRequiredStateSipCmdSize<FamilyType>(*device);
size_t requiredCmdStreamSize = PreemptionHelper::getRequiredStateSipCmdSize<FamilyType>(device->getDevice());
size_t expectedPreambleSize = sizeof(STATE_SIP);
EXPECT_EQ(expectedPreambleSize, requiredCmdStreamSize);
@@ -75,14 +75,14 @@ GEN9TEST_F(Gen9PreemptionTests, whenMidThreadPreemptionIsAvailableThenStateSipIs
ASSERT_LE(requiredCmdStreamSize, streamStorage.size());
LinearStream cmdStream{streamStorage.begin(), streamStorage.size()};
PreemptionHelper::programStateSip<FamilyType>(cmdStream, *device);
PreemptionHelper::programStateSip<FamilyType>(cmdStream, device->getDevice());
HardwareParse hwParsePreamble;
hwParsePreamble.parseCommands<FamilyType>(cmdStream);
auto stateSipCmd = hwParsePreamble.getCommand<STATE_SIP>();
ASSERT_NE(nullptr, stateSipCmd);
EXPECT_EQ(device->getExecutionEnvironment()->getBuiltIns()->getSipKernel(SipKernelType::Csr, *device).getSipAllocation()->getGpuAddressToPatch(), stateSipCmd->getSystemInstructionPointer());
EXPECT_EQ(device->getExecutionEnvironment()->getBuiltIns()->getSipKernel(SipKernelType::Csr, device->getDevice()).getSipAllocation()->getGpuAddressToPatch(), stateSipCmd->getSystemInstructionPointer());
}
GEN9TEST_F(Gen9ThreadGroupPreemptionEnqueueKernelTest, givenSecondEnqueueWithTheSamePreemptionRequestThenDontReprogramThreadGroupNoWa) {
@@ -97,7 +97,7 @@ GEN9TEST_F(Gen9ThreadGroupPreemptionEnqueueKernelTest, givenSecondEnqueueWithThe
size_t off[3] = {0, 0, 0};
size_t gws[3] = {1, 1, 1};
MockKernelWithInternals mockKernel(*pDevice);
MockKernelWithInternals mockKernel(*pClDevice);
HardwareParse hwParserCsr;
HardwareParse hwParserCmdQ;
@@ -131,7 +131,7 @@ GEN9TEST_F(Gen9ThreadGroupPreemptionEnqueueKernelTest, givenSecondEnqueueWithThe
size_t off[3] = {0, 0, 0};
size_t gws[3] = {1, 1, 1};
MockKernelWithInternals mockKernel(*pDevice);
MockKernelWithInternals mockKernel(*pClDevice);
pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, off, gws, nullptr, 0, nullptr, nullptr);
hwCsrParser.parseCommands<FamilyType>(csr.commandStream);
@@ -212,7 +212,7 @@ GEN9TEST_F(Gen9PreemptionEnqueueKernelTest, givenValidKernelForPreemptionWhenEnq
auto mockCsr = new MockCsrHw2<FamilyType>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
pDevice->resetCommandStreamReceiver(mockCsr);
MockKernelWithInternals mockKernel(*pDevice);
MockKernelWithInternals mockKernel(*pClDevice);
MultiDispatchInfo multiDispatch(mockKernel.mockKernel);
EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(*pDevice, multiDispatch));
@@ -230,7 +230,7 @@ GEN9TEST_F(Gen9PreemptionEnqueueKernelTest, givenValidKernelForPreemptionWhenEnq
auto mockCsr = new MockCsrHw2<FamilyType>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
pDevice->resetCommandStreamReceiver(mockCsr);
MockKernelWithInternals mockKernel(*pDevice);
MockKernelWithInternals mockKernel(*pClDevice);
MultiDispatchInfo multiDispatch(mockKernel.mockKernel);
EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(*pDevice, multiDispatch));
@@ -263,7 +263,7 @@ GEN9TEST_F(Gen9MidThreadPreemptionEnqueueKernelTest, givenSecondEnqueueWithTheSa
size_t off[3] = {0, 0, 0};
size_t gws[3] = {1, 1, 1};
MockKernelWithInternals mockKernel(*pDevice);
MockKernelWithInternals mockKernel(*pClDevice);
pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, off, gws, nullptr, 0, nullptr, nullptr);
hwCsrParser.parseCommands<FamilyType>(csr.commandStream);
@@ -340,7 +340,7 @@ GEN9TEST_F(Gen9MidThreadPreemptionEnqueueKernelTest, givenSecondEnqueueWithTheSa
size_t off[3] = {0, 0, 0};
size_t gws[3] = {1, 1, 1};
MockKernelWithInternals mockKernel(*pDevice);
MockKernelWithInternals mockKernel(*pClDevice);
pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, off, gws, nullptr, 0, nullptr, nullptr);
hwCsrParser.parseCommands<FamilyType>(csr.commandStream);
@@ -431,7 +431,7 @@ GEN9TEST_F(Gen9PreemptionEnqueueKernelTest, givenDisabledPreemptionWhenEnqueueKe
auto mockCsr = new MockCsrHw2<FamilyType>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
pDevice->resetCommandStreamReceiver(mockCsr);
MockKernelWithInternals mockKernel(*pDevice);
MockKernelWithInternals mockKernel(*pClDevice);
MultiDispatchInfo multiDispatch(mockKernel.mockKernel);
EXPECT_EQ(PreemptionMode::Disabled, PreemptionHelper::taskPreemptionMode(*pDevice, multiDispatch));
@@ -446,7 +446,7 @@ GEN9TEST_F(Gen9PreemptionEnqueueKernelTest, givenDisabledPreemptionWhenEnqueueKe
GEN9TEST_F(Gen9PreemptionTests, getPreemptionWaCsSizeMidBatch) {
size_t expectedSize = 0;
device->setPreemptionMode(PreemptionMode::MidBatch);
size_t size = PreemptionHelper::getPreemptionWaCsSize<FamilyType>(*device);
size_t size = PreemptionHelper::getPreemptionWaCsSize<FamilyType>(device->getDevice());
EXPECT_EQ(expectedSize, size);
}
@@ -454,7 +454,7 @@ GEN9TEST_F(Gen9PreemptionTests, getPreemptionWaCsSizeThreadGroupNoWa) {
size_t expectedSize = 0;
device->setPreemptionMode(PreemptionMode::ThreadGroup);
device->getExecutionEnvironment()->getMutableHardwareInfo()->workaroundTable.waModifyVFEStateAfterGPGPUPreemption = false;
size_t size = PreemptionHelper::getPreemptionWaCsSize<FamilyType>(*device);
size_t size = PreemptionHelper::getPreemptionWaCsSize<FamilyType>(device->getDevice());
EXPECT_EQ(expectedSize, size);
}
@@ -463,7 +463,7 @@ GEN9TEST_F(Gen9PreemptionTests, getPreemptionWaCsSizeThreadGroupWa) {
size_t expectedSize = 2 * sizeof(MI_LOAD_REGISTER_IMM);
device->setPreemptionMode(PreemptionMode::ThreadGroup);
device->getExecutionEnvironment()->getMutableHardwareInfo()->workaroundTable.waModifyVFEStateAfterGPGPUPreemption = true;
size_t size = PreemptionHelper::getPreemptionWaCsSize<FamilyType>(*device);
size_t size = PreemptionHelper::getPreemptionWaCsSize<FamilyType>(device->getDevice());
EXPECT_EQ(expectedSize, size);
}
@@ -471,7 +471,7 @@ GEN9TEST_F(Gen9PreemptionTests, getPreemptionWaCsSizeMidThreadNoWa) {
size_t expectedSize = 0;
device->setPreemptionMode(PreemptionMode::MidThread);
device->getExecutionEnvironment()->getMutableHardwareInfo()->workaroundTable.waModifyVFEStateAfterGPGPUPreemption = false;
size_t size = PreemptionHelper::getPreemptionWaCsSize<FamilyType>(*device);
size_t size = PreemptionHelper::getPreemptionWaCsSize<FamilyType>(device->getDevice());
EXPECT_EQ(expectedSize, size);
}
@@ -480,7 +480,7 @@ GEN9TEST_F(Gen9PreemptionTests, getPreemptionWaCsSizeMidThreadWa) {
size_t expectedSize = 2 * sizeof(MI_LOAD_REGISTER_IMM);
device->setPreemptionMode(PreemptionMode::MidThread);
device->getExecutionEnvironment()->getMutableHardwareInfo()->workaroundTable.waModifyVFEStateAfterGPGPUPreemption = true;
size_t size = PreemptionHelper::getPreemptionWaCsSize<FamilyType>(*device);
size_t size = PreemptionHelper::getPreemptionWaCsSize<FamilyType>(device->getDevice());
EXPECT_EQ(expectedSize, size);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -45,7 +45,7 @@ class MidThreadPreemptionTests : public DevicePreemptionTests {
TEST_F(ThreadGroupPreemptionTests, disallowByKMD) {
PreemptionFlags flags = {};
waTable->waDisablePerCtxtPreemptionGranularityControl = 1;
PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get());
PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get());
EXPECT_FALSE(PreemptionHelper::allowThreadGroupPreemption(flags));
EXPECT_EQ(PreemptionMode::MidBatch, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags));
}
@@ -53,7 +53,7 @@ TEST_F(ThreadGroupPreemptionTests, disallowByKMD) {
TEST_F(ThreadGroupPreemptionTests, disallowByDevice) {
PreemptionFlags flags = {};
device->setPreemptionMode(PreemptionMode::MidThread);
PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get());
PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get());
EXPECT_TRUE(PreemptionHelper::allowThreadGroupPreemption(flags));
EXPECT_EQ(PreemptionMode::MidThread, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags));
}
@@ -62,7 +62,7 @@ TEST_F(ThreadGroupPreemptionTests, disallowByReadWriteFencesWA) {
PreemptionFlags flags = {};
executionEnvironment->UsesFencesForReadWriteImages = 1u;
waTable->waDisableLSQCROPERFforOCL = 1;
PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get());
PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get());
EXPECT_FALSE(PreemptionHelper::allowThreadGroupPreemption(flags));
EXPECT_EQ(PreemptionMode::MidBatch, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags));
}
@@ -70,7 +70,7 @@ TEST_F(ThreadGroupPreemptionTests, disallowByReadWriteFencesWA) {
TEST_F(ThreadGroupPreemptionTests, disallowBySchedulerKernel) {
PreemptionFlags flags = {};
kernel.reset(new MockKernel(program.get(), *kernelInfo, *device, true));
PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get());
PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get());
EXPECT_FALSE(PreemptionHelper::allowThreadGroupPreemption(flags));
EXPECT_EQ(PreemptionMode::MidBatch, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags));
}
@@ -79,7 +79,7 @@ TEST_F(ThreadGroupPreemptionTests, disallowByVmeKernel) {
PreemptionFlags flags = {};
kernelInfo->isVmeWorkload = true;
kernel.reset(new MockKernel(program.get(), *kernelInfo, *device));
PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get());
PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get());
EXPECT_FALSE(PreemptionHelper::allowThreadGroupPreemption(flags));
EXPECT_EQ(PreemptionMode::MidBatch, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags));
}
@@ -92,7 +92,7 @@ TEST_F(ThreadGroupPreemptionTests, simpleAllow) {
TEST_F(ThreadGroupPreemptionTests, allowDefaultModeForNonKernelRequest) {
PreemptionFlags flags = {};
PreemptionHelper::setPreemptionLevelFlags(flags, *device, nullptr);
PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), nullptr);
EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags));
}
@@ -100,7 +100,7 @@ TEST_F(ThreadGroupPreemptionTests, givenKernelWithNoEnvironmentPatchSetWhenLSQCW
PreemptionFlags flags = {};
kernelInfo.get()->patchInfo.executionEnvironment = nullptr;
waTable->waDisableLSQCROPERFforOCL = 1;
PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get());
PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get());
EXPECT_TRUE(PreemptionHelper::allowThreadGroupPreemption(flags));
EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags));
}
@@ -109,7 +109,7 @@ TEST_F(ThreadGroupPreemptionTests, givenKernelWithEnvironmentPatchSetWhenLSQCWaI
PreemptionFlags flags = {};
executionEnvironment.get()->UsesFencesForReadWriteImages = 0;
waTable->waDisableLSQCROPERFforOCL = 1;
PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get());
PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get());
EXPECT_TRUE(PreemptionHelper::allowThreadGroupPreemption(flags));
EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags));
}
@@ -118,7 +118,7 @@ TEST_F(ThreadGroupPreemptionTests, givenKernelWithEnvironmentPatchSetWhenLSQCWaI
PreemptionFlags flags = {};
executionEnvironment.get()->UsesFencesForReadWriteImages = 1;
waTable->waDisableLSQCROPERFforOCL = 0;
PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get());
PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get());
EXPECT_TRUE(PreemptionHelper::allowThreadGroupPreemption(flags));
EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags));
}
@@ -126,27 +126,27 @@ TEST_F(ThreadGroupPreemptionTests, givenKernelWithEnvironmentPatchSetWhenLSQCWaI
TEST_F(ThreadGroupPreemptionTests, allowMidBatch) {
PreemptionFlags flags = {};
device->setPreemptionMode(PreemptionMode::MidBatch);
PreemptionHelper::setPreemptionLevelFlags(flags, *device, nullptr);
PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), nullptr);
EXPECT_EQ(PreemptionMode::MidBatch, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags));
}
TEST_F(ThreadGroupPreemptionTests, disallowWhenAdjustedDisabled) {
PreemptionFlags flags = {};
device->setPreemptionMode(PreemptionMode::Disabled);
PreemptionHelper::setPreemptionLevelFlags(flags, *device, nullptr);
PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), nullptr);
EXPECT_EQ(PreemptionMode::Disabled, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags));
}
TEST_F(ThreadGroupPreemptionTests, returnDefaultDeviceModeForZeroSizedMdi) {
MultiDispatchInfo multiDispatchInfo;
EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(*device, multiDispatchInfo));
EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(device->getDevice(), multiDispatchInfo));
}
TEST_F(ThreadGroupPreemptionTests, returnDefaultDeviceModeForValidKernelsInMdi) {
MultiDispatchInfo multiDispatchInfo;
multiDispatchInfo.push(*dispatchInfo);
multiDispatchInfo.push(*dispatchInfo);
EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(*device, multiDispatchInfo));
EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(device->getDevice(), multiDispatchInfo));
}
TEST_F(ThreadGroupPreemptionTests, disallowDefaultDeviceModeForValidKernelsInMdiAndDisabledPremption) {
@@ -154,7 +154,7 @@ TEST_F(ThreadGroupPreemptionTests, disallowDefaultDeviceModeForValidKernelsInMdi
MultiDispatchInfo multiDispatchInfo;
multiDispatchInfo.push(*dispatchInfo);
multiDispatchInfo.push(*dispatchInfo);
EXPECT_EQ(PreemptionMode::Disabled, PreemptionHelper::taskPreemptionMode(*device, multiDispatchInfo));
EXPECT_EQ(PreemptionMode::Disabled, PreemptionHelper::taskPreemptionMode(device->getDevice(), multiDispatchInfo));
}
TEST_F(ThreadGroupPreemptionTests, disallowDefaultDeviceModeWhenAtLeastOneInvalidKernelInMdi) {
@@ -162,7 +162,7 @@ TEST_F(ThreadGroupPreemptionTests, disallowDefaultDeviceModeWhenAtLeastOneInvali
DispatchInfo schedulerDispatchInfo(&schedulerKernel, 1, Vec3<size_t>(1, 1, 1), Vec3<size_t>(1, 1, 1), Vec3<size_t>(0, 0, 0));
PreemptionFlags flags = {};
PreemptionHelper::setPreemptionLevelFlags(flags, *device, &schedulerKernel);
PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), &schedulerKernel);
EXPECT_EQ(PreemptionMode::MidBatch, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags));
MultiDispatchInfo multiDispatchInfo;
@@ -170,21 +170,21 @@ TEST_F(ThreadGroupPreemptionTests, disallowDefaultDeviceModeWhenAtLeastOneInvali
multiDispatchInfo.push(schedulerDispatchInfo);
multiDispatchInfo.push(*dispatchInfo);
EXPECT_EQ(PreemptionMode::MidBatch, PreemptionHelper::taskPreemptionMode(*device, multiDispatchInfo));
EXPECT_EQ(PreemptionMode::MidBatch, PreemptionHelper::taskPreemptionMode(device->getDevice(), multiDispatchInfo));
}
TEST_F(MidThreadPreemptionTests, allowMidThreadPreemption) {
PreemptionFlags flags = {};
device->setPreemptionMode(PreemptionMode::MidThread);
executionEnvironment->DisableMidThreadPreemption = 0;
PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get());
PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get());
EXPECT_TRUE(PreemptionHelper::allowMidThreadPreemption(flags));
}
TEST_F(MidThreadPreemptionTests, allowMidThreadPreemptionNullKernel) {
PreemptionFlags flags = {};
device->setPreemptionMode(PreemptionMode::MidThread);
PreemptionHelper::setPreemptionLevelFlags(flags, *device, nullptr);
PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), nullptr);
EXPECT_TRUE(PreemptionHelper::allowMidThreadPreemption(flags));
}
@@ -194,7 +194,7 @@ TEST_F(MidThreadPreemptionTests, allowMidThreadPreemptionDeviceSupportPreemption
device->deviceInfo.vmeAvcSupportsPreemption = true;
kernelInfo->isVmeWorkload = true;
kernel.reset(new MockKernel(program.get(), *kernelInfo, *device));
PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get());
PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get());
EXPECT_TRUE(PreemptionHelper::allowMidThreadPreemption(flags));
}
@@ -202,7 +202,7 @@ TEST_F(MidThreadPreemptionTests, disallowMidThreadPreemptionByDevice) {
PreemptionFlags flags = {};
device->setPreemptionMode(PreemptionMode::ThreadGroup);
executionEnvironment->DisableMidThreadPreemption = 0;
PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get());
PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get());
EXPECT_TRUE(PreemptionHelper::allowMidThreadPreemption(flags));
EXPECT_EQ(PreemptionMode::ThreadGroup, PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags));
}
@@ -211,7 +211,7 @@ TEST_F(MidThreadPreemptionTests, disallowMidThreadPreemptionByKernel) {
PreemptionFlags flags = {};
device->setPreemptionMode(PreemptionMode::MidThread);
executionEnvironment->DisableMidThreadPreemption = 1;
PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get());
PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get());
EXPECT_FALSE(PreemptionHelper::allowMidThreadPreemption(flags));
}
@@ -221,7 +221,7 @@ TEST_F(MidThreadPreemptionTests, disallowMidThreadPreemptionByVmeKernel) {
device->deviceInfo.vmeAvcSupportsPreemption = false;
kernelInfo->isVmeWorkload = true;
kernel.reset(new MockKernel(program.get(), *kernelInfo, *device));
PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get());
PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get());
EXPECT_FALSE(PreemptionHelper::allowMidThreadPreemption(flags));
}
@@ -229,7 +229,7 @@ TEST_F(MidThreadPreemptionTests, taskPreemptionDisallowMidThreadByDevice) {
PreemptionFlags flags = {};
executionEnvironment->DisableMidThreadPreemption = 0;
device->setPreemptionMode(PreemptionMode::ThreadGroup);
PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get());
PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get());
PreemptionMode outMode = PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags);
EXPECT_EQ(PreemptionMode::ThreadGroup, outMode);
}
@@ -238,7 +238,7 @@ TEST_F(MidThreadPreemptionTests, taskPreemptionDisallowMidThreadByKernel) {
PreemptionFlags flags = {};
executionEnvironment->DisableMidThreadPreemption = 1;
device->setPreemptionMode(PreemptionMode::MidThread);
PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get());
PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get());
PreemptionMode outMode = PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags);
EXPECT_EQ(PreemptionMode::ThreadGroup, outMode);
}
@@ -249,7 +249,7 @@ TEST_F(MidThreadPreemptionTests, taskPreemptionDisallowMidThreadByVmeKernel) {
device->deviceInfo.vmeAvcSupportsPreemption = false;
kernel.reset(new MockKernel(program.get(), *kernelInfo, *device));
device->setPreemptionMode(PreemptionMode::MidThread);
PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get());
PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get());
PreemptionMode outMode = PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags);
//VME disables mid thread and thread group when device does not support it
EXPECT_EQ(PreemptionMode::MidBatch, outMode);
@@ -259,7 +259,7 @@ TEST_F(MidThreadPreemptionTests, taskPreemptionAllow) {
PreemptionFlags flags = {};
executionEnvironment->DisableMidThreadPreemption = 0;
device->setPreemptionMode(PreemptionMode::MidThread);
PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get());
PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get());
PreemptionMode outMode = PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags);
EXPECT_EQ(PreemptionMode::MidThread, outMode);
}
@@ -271,7 +271,7 @@ TEST_F(MidThreadPreemptionTests, taskPreemptionAllowDeviceSupportsPreemptionOnVm
kernel.reset(new MockKernel(program.get(), *kernelInfo, *device));
device->deviceInfo.vmeAvcSupportsPreemption = true;
device->setPreemptionMode(PreemptionMode::MidThread);
PreemptionHelper::setPreemptionLevelFlags(flags, *device, kernel.get());
PreemptionHelper::setPreemptionLevelFlags(flags, device->getDevice(), kernel.get());
PreemptionMode outMode = PreemptionHelper::taskPreemptionMode(device->getPreemptionMode(), flags);
EXPECT_EQ(PreemptionMode::MidThread, outMode);
}

View File

@@ -207,7 +207,7 @@ cl_int CL_API_CALL clGetDeviceIDs(cl_platform_id platform,
cl_uint retNum = 0;
for (auto rootDeviceIndex = 0u; rootDeviceIndex < numDev; rootDeviceIndex++) {
Device *device = pPlatform->getDevice(rootDeviceIndex);
ClDevice *device = pPlatform->getClDevice(rootDeviceIndex);
DEBUG_BREAK_IF(device == nullptr);
if (deviceType & device->getDeviceInfo().deviceType) {
@@ -243,7 +243,7 @@ cl_int CL_API_CALL clGetDeviceInfo(cl_device_id device,
API_ENTER(&retVal);
DBG_LOG_INPUTS("clDevice", device, "paramName", paramName, "paramValueSize", paramValueSize, "paramValue", NEO::FileLoggerInstance().infoPointerToString(paramValue, paramValueSize), "paramValueSizeRet", paramValueSizeRet);
Device *pDevice = castToObject<Device>(device);
ClDevice *pDevice = castToObject<ClDevice>(device);
if (pDevice != nullptr) {
retVal = pDevice->getDeviceInfo(paramName, paramValueSize,
paramValue, paramValueSizeRet);
@@ -258,7 +258,7 @@ cl_int CL_API_CALL clCreateSubDevices(cl_device_id inDevice,
cl_device_id *outDevices,
cl_uint *numDevicesRet) {
Device *pInDevice = castToObject<Device>(inDevice);
ClDevice *pInDevice = castToObject<ClDevice>(inDevice);
if (pInDevice == nullptr) {
return CL_INVALID_DEVICE;
}
@@ -295,9 +295,9 @@ cl_int CL_API_CALL clRetainDevice(cl_device_id device) {
cl_int retVal = CL_INVALID_DEVICE;
API_ENTER(&retVal);
DBG_LOG_INPUTS("device", device);
auto pDevice = castToObject<Device>(device);
auto pDevice = castToObject<ClDevice>(device);
if (pDevice) {
pDevice->retain();
pDevice->retainApi();
retVal = CL_SUCCESS;
}
@@ -310,9 +310,9 @@ cl_int CL_API_CALL clReleaseDevice(cl_device_id device) {
cl_int retVal = CL_INVALID_DEVICE;
API_ENTER(&retVal);
DBG_LOG_INPUTS("device", device);
auto pDevice = castToObject<Device>(device);
auto pDevice = castToObject<ClDevice>(device);
if (pDevice) {
pDevice->release();
pDevice->releaseApi();
retVal = CL_SUCCESS;
}
@@ -351,7 +351,7 @@ cl_context CL_API_CALL clCreateContext(const cl_context_properties *properties,
break;
}
DeviceVector allDevs(devices, numDevices);
ClDeviceVector allDevs(devices, numDevices);
context = Context::create<Context>(properties, allDevs, funcNotify, userData, retVal);
if (context != nullptr) {
gtpinNotifyContextCreate(context);
@@ -397,7 +397,7 @@ cl_context CL_API_CALL clCreateContextFromType(const cl_context_properties *prop
retVal = clGetDeviceIDs(nullptr, deviceType, numDevices, supportedDevs.begin(), nullptr);
DEBUG_BREAK_IF(retVal != CL_SUCCESS);
DeviceVector allDevs(supportedDevs.begin(), numDevices);
ClDeviceVector allDevs(supportedDevs.begin(), numDevices);
pContext = Context::create<Context>(properties, allDevs, funcNotify, userData, retVal);
if (pContext != nullptr) {
gtpinNotifyContextCreate((cl_context)pContext);
@@ -488,7 +488,7 @@ cl_command_queue CL_API_CALL clCreateCommandQueue(cl_context context,
}
Context *pContext = nullptr;
Device *pDevice = nullptr;
ClDevice *pDevice = nullptr;
retVal = validateObjects(
WithCastToInternal(context, &pContext),
@@ -999,9 +999,9 @@ cl_int CL_API_CALL clGetSupportedImageFormats(cl_context context,
"numImageFormats", numImageFormats);
auto pContext = castToObject<Context>(context);
if (pContext) {
auto pDevice = pContext->getDevice(0);
if (pDevice->getHardwareInfo().capabilityTable.supportsImages) {
retVal = pContext->getSupportedImageFormats(pDevice, flags, imageType, numEntries,
auto pClDevice = pContext->getDevice(0);
if (pClDevice->getHardwareInfo().capabilityTable.supportsImages) {
retVal = pContext->getSupportedImageFormats(&pClDevice->getDevice(), flags, imageType, numEntries,
imageFormats, numImageFormats);
} else {
retVal = CL_INVALID_VALUE;
@@ -1346,12 +1346,12 @@ cl_program CL_API_CALL clCreateProgramWithBuiltInKernels(cl_context context,
for (cl_uint i = 0; i < numDevices; i++) {
auto pContext = castToObject<Context>(context);
validateObject(pContext);
auto pDev = castToObject<Device>(*deviceList);
validateObject(pDev);
auto pDevice = castToObject<ClDevice>(*deviceList);
validateObject(pDevice);
program = pDev->getExecutionEnvironment()->getBuiltIns()->createBuiltInProgram(
program = pDevice->getExecutionEnvironment()->getBuiltIns()->createBuiltInProgram(
*pContext,
*pDev,
pDevice->getDevice(),
kernelNames,
retVal);
if (program && retVal == CL_SUCCESS) {
@@ -3382,12 +3382,13 @@ clCreatePerfCountersCommandQueueINTEL(
cl_command_queue commandQueue = nullptr;
ErrorCodeHelper err(errcodeRet, CL_SUCCESS);
Device *pDevice = nullptr;
ClDevice *pDevice = nullptr;
WithCastToInternal(device, &pDevice);
if (pDevice == nullptr) {
err.set(CL_INVALID_DEVICE);
return commandQueue;
}
if (!pDevice->getHardwareInfo().capabilityTable.instrumentationEnabled) {
err.set(CL_INVALID_DEVICE);
return commandQueue;
@@ -3477,7 +3478,7 @@ void *clDeviceMemAllocINTEL(
cl_uint alignment,
cl_int *errcodeRet) {
Context *neoContext = nullptr;
Device *neoDevice = nullptr;
ClDevice *neoDevice = nullptr;
ErrorCodeHelper err(errcodeRet, CL_SUCCESS);
@@ -3516,7 +3517,7 @@ void *clSharedMemAllocINTEL(
cl_uint alignment,
cl_int *errcodeRet) {
Context *neoContext = nullptr;
Device *neoDevice = nullptr;
ClDevice *neoDevice = nullptr;
ErrorCodeHelper err(errcodeRet, CL_SUCCESS);
@@ -4593,7 +4594,7 @@ cl_command_queue CL_API_CALL clCreateCommandQueueWithProperties(cl_context conte
ErrorCodeHelper err(errcodeRet, CL_SUCCESS);
Context *pContext = nullptr;
Device *pDevice = nullptr;
ClDevice *pDevice = nullptr;
retVal = validateObjects(
WithCastToInternal(context, &pContext),
@@ -4814,7 +4815,7 @@ cl_int CL_API_CALL clGetDeviceAndHostTimer(cl_device_id device,
"deviceTimestamp", deviceTimestamp,
"hostTimestamp", hostTimestamp);
do {
Device *pDevice = castToObject<Device>(device);
ClDevice *pDevice = castToObject<ClDevice>(device);
if (pDevice == nullptr) {
retVal = CL_INVALID_DEVICE;
break;
@@ -4842,7 +4843,7 @@ cl_int CL_API_CALL clGetHostTimer(cl_device_id device,
"hostTimestamp", hostTimestamp);
do {
Device *pDevice = castToObject<Device>(device);
ClDevice *pDevice = castToObject<ClDevice>(device);
if (pDevice == nullptr) {
retVal = CL_INVALID_DEVICE;
break;
@@ -5090,7 +5091,7 @@ cl_int CL_API_CALL clAddCommentINTEL(cl_device_id device, const char *comment) {
API_ENTER(&retVal);
DBG_LOG_INPUTS("device", device, "comment", comment);
Device *pDevice = nullptr;
ClDevice *pDevice = nullptr;
retVal = validateObjects(WithCastToInternal(device, &pDevice));
if (retVal != CL_SUCCESS) {
return retVal;
@@ -5290,7 +5291,7 @@ cl_int CL_API_CALL clEnqueueNDRangeKernelINTEL(cl_command_queue commandQueue,
gtpinNotifyKernelSubmit(kernel, pCommandQueue);
}
pCommandQueue->getDevice().allocateSyncBufferHandler();
platform()->clDeviceMap[&pCommandQueue->getDevice()]->allocateSyncBufferHandler();
retVal = pCommandQueue->enqueueKernel(
kernel,

View File

@@ -47,7 +47,7 @@ SchedulerKernel &BuiltIns::getSchedulerKernel(Context &context) {
auto initializeSchedulerProgramAndKernel = [&] {
cl_int retVal = CL_SUCCESS;
auto src = context.getDevice(0)->getExecutionEnvironment()->getBuiltIns()->builtinsLib->getBuiltinCode(EBuiltInOps::Scheduler, BuiltinCode::ECodeType::Any, *context.getDevice(0));
auto src = context.getDevice(0)->getExecutionEnvironment()->getBuiltIns()->builtinsLib->getBuiltinCode(EBuiltInOps::Scheduler, BuiltinCode::ECodeType::Any, context.getDevice(0)->getDevice());
auto program = Program::createFromGenBinary(*context.getDevice(0)->getExecutionEnvironment(),
&context,
@@ -179,9 +179,8 @@ Program *BuiltIns::createBuiltInProgram(
&device.getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(EBuiltInOps::VmeBlockAdvancedMotionEstimateCheckIntel, context, device);
builtinsBuilders["block_advanced_motion_estimate_bidirectional_check_intel"] =
&device.getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(EBuiltInOps::VmeBlockAdvancedMotionEstimateBidirectionalCheckIntel, context, device);
const cl_device_id clDevice = &device;
errcodeRet = pBuiltInProgram->build(
clDevice,
&device,
mediaKernelsBuildOptions,
enableCacheing,
builtinsBuilders);

View File

@@ -44,7 +44,7 @@ namespace NEO {
CommandQueueCreateFunc commandQueueFactory[IGFX_MAX_CORE] = {};
CommandQueue *CommandQueue::create(Context *context,
Device *device,
ClDevice *device,
const cl_queue_properties *properties,
cl_int &retVal) {
retVal = CL_SUCCESS;
@@ -58,8 +58,8 @@ CommandQueue *CommandQueue::create(Context *context,
CommandQueue::CommandQueue() : CommandQueue(nullptr, nullptr, 0) {
}
CommandQueue::CommandQueue(Context *context, Device *deviceId, const cl_queue_properties *properties)
: context(context), device(deviceId) {
CommandQueue::CommandQueue(Context *context, ClDevice *device, const cl_queue_properties *properties)
: context(context), device(device) {
if (context) {
context->incRefInternal();
}
@@ -119,6 +119,10 @@ CommandStreamReceiver *CommandQueue::getBcsCommandStreamReceiver() const {
return nullptr;
}
Device &CommandQueue::getDevice() const noexcept {
return device->getDevice();
}
uint32_t CommandQueue::getHwTag() const {
uint32_t tag = *getHwTagAddress();
return tag;
@@ -414,7 +418,6 @@ void *CommandQueue::enqueueMapBuffer(Buffer *buffer, cl_bool blockingMap,
size_t size, cl_uint numEventsInWaitList,
const cl_event *eventWaitList, cl_event *event,
cl_int &errcodeRet) {
TransferProperties transferProperties(buffer, CL_COMMAND_MAP_BUFFER, mapFlags, blockingMap != CL_FALSE, &offset, &size, nullptr, false);
EventsRequest eventsRequest(numEventsInWaitList, eventWaitList, event);
@@ -454,7 +457,6 @@ void *CommandQueue::enqueueMapImage(Image *image, cl_bool blockingMap,
}
cl_int CommandQueue::enqueueUnmapMemObject(MemObj *memObj, void *mappedPtr, cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) {
TransferProperties transferProperties(memObj, CL_COMMAND_UNMAP_MEM_OBJECT, 0, false, nullptr, nullptr, mappedPtr, false);
EventsRequest eventsRequest(numEventsInWaitList, eventWaitList, event);

View File

@@ -19,6 +19,7 @@ namespace NEO {
class BarrierCommand;
class Buffer;
class LinearStream;
class ClDevice;
class Context;
class Device;
class Event;
@@ -55,13 +56,13 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
public:
static const cl_ulong objectMagic = 0x1234567890987654LL;
static CommandQueue *create(Context *context, Device *device,
static CommandQueue *create(Context *context, ClDevice *device,
const cl_queue_properties *properties,
cl_int &errcodeRet);
CommandQueue();
CommandQueue(Context *context, Device *device,
CommandQueue(Context *context, ClDevice *device,
const cl_queue_properties *properties);
CommandQueue &operator=(const CommandQueue &) = delete;
@@ -336,7 +337,7 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
MOCKABLE_VIRTUAL CommandStreamReceiver &getGpgpuCommandStreamReceiver() const;
CommandStreamReceiver *getBcsCommandStreamReceiver() const;
Device &getDevice() const { return *device; }
Device &getDevice() const noexcept;
Context &getContext() const { return *context; }
Context *getContextPtr() const { return context; }
EngineControl &getGpgpuEngine() const { return *gpgpuEngine; }
@@ -445,7 +446,7 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
void aubCaptureHook(bool &blocking, bool &clearAllDependencies, const MultiDispatchInfo &multiDispatchInfo);
Context *context = nullptr;
Device *device = nullptr;
ClDevice *device = nullptr;
EngineControl *gpgpuEngine = nullptr;
EngineControl *bcsEngine = nullptr;
@@ -467,6 +468,6 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
};
typedef CommandQueue *(*CommandQueueCreateFunc)(
Context *context, Device *device, const cl_queue_properties *properties);
Context *context, ClDevice *device, const cl_queue_properties *properties);
} // namespace NEO

View File

@@ -32,7 +32,7 @@ class CommandQueueHw : public CommandQueue {
public:
CommandQueueHw(Context *context,
Device *device,
ClDevice *device,
const cl_queue_properties *properties) : BaseClass(context, device, properties) {
auto clPriority = getCmdQueueProperties<cl_queue_priority_khr>(properties, CL_QUEUE_PRIORITY_KHR);
@@ -68,7 +68,7 @@ class CommandQueueHw : public CommandQueue {
}
static CommandQueue *create(Context *context,
Device *device,
ClDevice *device,
const cl_queue_properties *properties) {
return new CommandQueueHw<GfxFamily>(context, device, properties);
}

View File

@@ -557,7 +557,7 @@ void CommandQueueHw<GfxFamily>::processDeviceEnqueue(DeviceQueueHw<GfxFamily> *d
this->getIndirectHeap(IndirectHeap::SURFACE_STATE, 0u).getGraphicsAllocation(),
devQueueHw->getDebugQueue());
auto preemptionMode = PreemptionHelper::taskPreemptionMode(*device, multiDispatchInfo);
auto preemptionMode = PreemptionHelper::taskPreemptionMode(getDevice(), multiDispatchInfo);
GpgpuWalkerHelper<GfxFamily>::dispatchScheduler(
*this->commandStream,
*devQueueHw,
@@ -731,7 +731,7 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueNonBlocked(
{}, //pipelineSelectArgs
this->flushStamp->getStampReference(), //flushStampReference
getThrottle(), //throttle
PreemptionHelper::taskPreemptionMode(*device, multiDispatchInfo), //preemptionMode
PreemptionHelper::taskPreemptionMode(getDevice(), multiDispatchInfo), //preemptionMode
numGrfRequired, //numGrfRequired
L3CachingSettings::l3CacheOn, //l3CacheSettings
kernel->getThreadArbitrationPolicy(), //threadArbitrationPolicy
@@ -786,7 +786,7 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueNonBlocked(
getIndirectHeap(IndirectHeap::SURFACE_STATE, 0u),
taskLevel,
dispatchFlags,
*device);
getDevice());
return completionStamp;
}
@@ -859,7 +859,7 @@ void CommandQueueHw<GfxFamily>::enqueueBlocked(
allSurfaces.push_back(surface->duplicate());
}
PreemptionMode preemptionMode = PreemptionHelper::taskPreemptionMode(*device, multiDispatchInfo);
PreemptionMode preemptionMode = PreemptionHelper::taskPreemptionMode(getDevice(), multiDispatchInfo);
bool slmUsed = multiDispatchInfo.usesSlm() || multiDispatchInfo.peekParentKernel();
command = std::make_unique<CommandComputeKernel>(*this,
blockedCommandsData,
@@ -955,7 +955,7 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueCommandWithoutKernel(
getIndirectHeap(IndirectHeap::SURFACE_STATE, 0u),
taskLevel,
dispatchFlags,
*device);
getDevice());
return completionStamp;
}

View File

@@ -95,7 +95,7 @@ bool Context::areMultiStorageAllocationsPreferred() {
}
bool Context::createImpl(const cl_context_properties *properties,
const DeviceVector &inputDevices,
const ClDeviceVector &inputDevices,
void(CL_CALLBACK *funcNotify)(const char *, const void *, size_t, void *),
void *data, cl_int &errcodeRet) {
@@ -257,8 +257,8 @@ size_t Context::getTotalNumDevices() const {
return numAvailableDevices;
}
Device *Context::getDevice(size_t deviceOrdinal) {
return (Device *)devices[deviceOrdinal];
ClDevice *Context::getDevice(size_t deviceOrdinal) {
return (ClDevice *)devices[deviceOrdinal];
}
cl_int Context::getSupportedImageFormats(

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -41,13 +41,13 @@ class Context : public BaseObject<_cl_context> {
static const cl_ulong objectMagic = 0xA4234321DC002130LL;
bool createImpl(const cl_context_properties *properties,
const DeviceVector &devices,
const ClDeviceVector &devices,
void(CL_CALLBACK *pfnNotify)(const char *, const void *, size_t, void *),
void *userData, cl_int &errcodeRet);
template <typename T>
static T *create(const cl_context_properties *properties,
const DeviceVector &devices,
const ClDeviceVector &devices,
void(CL_CALLBACK *funcNotify)(const char *, const void *, size_t, void *),
void *data, cl_int &errcodeRet) {
@@ -75,7 +75,7 @@ class Context : public BaseObject<_cl_context> {
size_t getNumDevices() const;
size_t getTotalNumDevices() const;
Device *getDevice(size_t deviceOrdinal);
ClDevice *getDevice(size_t deviceOrdinal);
MemoryManager *getMemoryManager() {
return memoryManager;
@@ -150,7 +150,7 @@ class Context : public BaseObject<_cl_context> {
void(CL_CALLBACK *contextCallback)(const char *, const void *, size_t, void *);
void *userData;
DeviceVector devices;
ClDeviceVector devices;
MemoryManager *memoryManager;
SVMAllocsManager *svmAllocsManager = nullptr;
CommandQueue *specialQueue;

View File

@@ -19,6 +19,7 @@
#include "runtime/memory_manager/memory_manager.h"
#include "runtime/os_interface/os_interface.h"
#include "runtime/os_interface/os_time.h"
#include "runtime/platform/platform.h"
#include "runtime/source_level_debugger/source_level_debugger.h"
namespace NEO {
@@ -26,14 +27,96 @@ namespace NEO {
decltype(&PerformanceCounters::create) Device::createPerformanceCountersFunc = PerformanceCounters::create;
extern CommandStreamReceiver *createCommandStream(ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex);
DeviceVector::DeviceVector(const cl_device_id *devices,
cl_uint numDevices) {
for (cl_uint i = 0; i < numDevices; i++) {
this->push_back(castToObject<Device>(devices[i]));
ClDevice::ClDevice(Device &device) : device(device), platformId(platform()) {
device.incRefInternal();
initializeCaps();
auto numAvailableDevices = device.getNumAvailableDevices();
if (numAvailableDevices > 1) {
for (uint32_t i = 0; i < numAvailableDevices; i++) {
subDevices.push_back(std::make_unique<ClDevice>(*device.getDeviceById(i)));
platform()->clDeviceMap.emplace(device.getDeviceById(i), subDevices[i].get());
}
}
}
void DeviceVector::toDeviceIDs(std::vector<cl_device_id> &devIDs) {
ClDevice::~ClDevice() {
syncBufferHandler.reset();
for (auto &subDevice : subDevices) {
subDevice.reset();
}
device.decRefInternal();
}
void ClDevice::allocateSyncBufferHandler() {
TakeOwnershipWrapper<ClDevice> lock(*this);
if (syncBufferHandler.get() == nullptr) {
syncBufferHandler = std::make_unique<SyncBufferHandler>(this->getDevice());
UNRECOVERABLE_IF(syncBufferHandler.get() == nullptr);
}
}
unsigned int ClDevice::getEnabledClVersion() const { return device.getEnabledClVersion(); }
unsigned int ClDevice::getSupportedClVersion() const { return device.getSupportedClVersion(); }
void ClDevice::retainApi() {
if (!device.isReleasable()) {
DEBUG_BREAK_IF(true);
} else {
platform()->getClDevice(device.getRootDeviceIndex())->incRefInternal();
this->incRefApi();
}
};
unique_ptr_if_unused<ClDevice> ClDevice::releaseApi() {
if (!device.isReleasable()) {
DEBUG_BREAK_IF(true);
return unique_ptr_if_unused<ClDevice>(this, false);
}
platform()->getClDevice(device.getRootDeviceIndex())->decRefInternal();
return this->decRefApi();
}
ClDevice *ClDevice::getDeviceById(uint32_t deviceId) {
UNRECOVERABLE_IF(deviceId >= getNumAvailableDevices());
if (subDevices.empty()) {
return this;
}
return subDevices[deviceId].get();
}
bool ClDevice::getDeviceAndHostTimer(uint64_t *deviceTimestamp, uint64_t *hostTimestamp) const { return device.getDeviceAndHostTimer(deviceTimestamp, hostTimestamp); }
bool ClDevice::getHostTimer(uint64_t *hostTimestamp) const { return device.getHostTimer(hostTimestamp); }
const HardwareInfo &ClDevice::getHardwareInfo() const { return device.getHardwareInfo(); }
const DeviceInfo &ClDevice::getDeviceInfo() const { return device.getDeviceInfo(); }
EngineControl &ClDevice::getEngine(aub_stream::EngineType engineType, bool lowPriority) { return device.getEngine(engineType, lowPriority); }
EngineControl &ClDevice::getDefaultEngine() { return device.getDefaultEngine(); }
MemoryManager *ClDevice::getMemoryManager() const { return device.getMemoryManager(); }
GmmHelper *ClDevice::getGmmHelper() const { return device.getGmmHelper(); }
double ClDevice::getProfilingTimerResolution() { return device.getProfilingTimerResolution(); }
double ClDevice::getPlatformHostTimerResolution() const { return device.getPlatformHostTimerResolution(); }
bool ClDevice::isSimulation() const { return device.isSimulation(); }
GFXCORE_FAMILY ClDevice::getRenderCoreFamily() const { return device.getRenderCoreFamily(); }
PerformanceCounters *ClDevice::getPerformanceCounters() { return device.getPerformanceCounters(); }
PreemptionMode ClDevice::getPreemptionMode() const { return device.getPreemptionMode(); }
bool ClDevice::isSourceLevelDebuggerActive() const { return device.isSourceLevelDebuggerActive(); }
SourceLevelDebugger *ClDevice::getSourceLevelDebugger() { return device.getSourceLevelDebugger(); }
ExecutionEnvironment *ClDevice::getExecutionEnvironment() const { return device.getExecutionEnvironment(); }
const RootDeviceEnvironment &ClDevice::getRootDeviceEnvironment() const { return device.getRootDeviceEnvironment(); }
const HardwareCapabilities &ClDevice::getHardwareCapabilities() const { return device.getHardwareCapabilities(); }
bool ClDevice::isFullRangeSvm() const { return device.isFullRangeSvm(); }
bool ClDevice::areSharedSystemAllocationsAllowed() const { return device.areSharedSystemAllocationsAllowed(); }
uint32_t ClDevice::getRootDeviceIndex() const { return device.getRootDeviceIndex(); }
uint32_t ClDevice::getNumAvailableDevices() const { return device.getNumAvailableDevices(); }
ClDeviceVector::ClDeviceVector(const cl_device_id *devices,
cl_uint numDevices) {
for (cl_uint i = 0; i < numDevices; i++) {
auto pClDevice = castToObject<ClDevice>(devices[i]);
this->push_back(pClDevice);
}
}
void ClDeviceVector::toDeviceIDs(std::vector<cl_device_id> &devIDs) {
int i = 0;
devIDs.resize(this->size());
@@ -61,7 +144,6 @@ Device::Device(ExecutionEnvironment *executionEnvironment)
Device::~Device() {
DEBUG_BREAK_IF(nullptr == executionEnvironment->memoryManager.get());
syncBufferHandler.reset();
if (performanceCounters) {
performanceCounters->shutdown();
}
@@ -206,14 +288,6 @@ double Device::getPlatformHostTimerResolution() const {
return 0.0;
}
void Device::allocateSyncBufferHandler() {
TakeOwnershipWrapper<Device> lock(*this);
if (syncBufferHandler.get() == nullptr) {
syncBufferHandler = std::make_unique<SyncBufferHandler>(*this);
UNRECOVERABLE_IF(syncBufferHandler.get() == nullptr);
}
}
GFXCORE_FAMILY Device::getRenderCoreFamily() const {
return this->getHardwareInfo().platform.eRenderCoreFamily;
}

View File

@@ -18,22 +18,56 @@
#include "engine_node.h"
namespace NEO {
class Device;
class DriverInfo;
class OSTime;
class SyncBufferHandler;
template <>
struct OpenCLObjectMapper<_cl_device_id> {
typedef class Device DerivedType;
typedef class ClDevice DerivedType;
};
class Device : public BaseObject<_cl_device_id> {
class ClDevice : public BaseObject<_cl_device_id> {
public:
static const cl_ulong objectMagic = 0x8055832341AC8D08LL;
Device &operator=(const Device &) = delete;
Device(const Device &) = delete;
~Device() override;
ClDevice &operator=(const ClDevice &) = delete;
ClDevice(const ClDevice &) = delete;
explicit ClDevice(Device &device);
~ClDevice() override;
unsigned int getEnabledClVersion() const; //CL
unsigned int getSupportedClVersion() const;
void retainApi();
unique_ptr_if_unused<ClDevice> releaseApi();
bool getDeviceAndHostTimer(uint64_t *deviceTimestamp, uint64_t *hostTimestamp) const;
bool getHostTimer(uint64_t *hostTimestamp) const;
const HardwareInfo &getHardwareInfo() const;
const DeviceInfo &getDeviceInfo() const;
EngineControl &getEngine(aub_stream::EngineType engineType, bool lowPriority);
EngineControl &getDefaultEngine();
MemoryManager *getMemoryManager() const;
GmmHelper *getGmmHelper() const;
double getProfilingTimerResolution();
double getPlatformHostTimerResolution() const;
bool isSimulation() const;
GFXCORE_FAMILY getRenderCoreFamily() const;
void allocateSyncBufferHandler();
PerformanceCounters *getPerformanceCounters();
PreemptionMode getPreemptionMode() const;
bool isSourceLevelDebuggerActive() const;
SourceLevelDebugger *getSourceLevelDebugger();
ExecutionEnvironment *getExecutionEnvironment() const;
const RootDeviceEnvironment &getRootDeviceEnvironment() const;
const HardwareCapabilities &getHardwareCapabilities() const;
bool isFullRangeSvm() const;
bool areSharedSystemAllocationsAllowed() const;
uint32_t getRootDeviceIndex() const;
uint32_t getNumAvailableDevices() const;
// API entry points
cl_int getDeviceInfo(cl_device_info paramName,
@@ -56,8 +90,30 @@ class Device : public BaseObject<_cl_device_id> {
void getStr(const void *&src,
size_t &size,
size_t &retSize);
constexpr Device &getDevice() const noexcept { return device; }
ClDevice *getDeviceById(uint32_t deviceId);
void initializeCaps();
std::unique_ptr<SyncBufferHandler> syncBufferHandler;
protected:
Device &device;
std::vector<std::unique_ptr<ClDevice>> subDevices;
cl_platform_id platformId;
std::vector<unsigned int> simultaneousInterops = {0};
void appendOSExtensions(std::string &deviceExtensions);
};
class Device : public ReferenceTrackedObject<Device> {
public:
Device &operator=(const Device &) = delete;
Device(const Device &) = delete;
~Device() override;
unsigned int getEnabledClVersion() const { return enabledClVersion; };
unsigned int getSupportedClVersion() const;
void appendOSExtensions(const std::string &newExtensions);
template <typename DeviceT, typename... ArgsT>
static DeviceT *create(ArgsT &&... args) {
@@ -65,6 +121,8 @@ class Device : public BaseObject<_cl_device_id> {
return createDeviceInternals(device);
}
virtual bool isReleasable() = 0;
bool getDeviceAndHostTimer(uint64_t *deviceTimestamp, uint64_t *hostTimestamp) const;
bool getHostTimer(uint64_t *hostTimestamp) const;
const HardwareInfo &getHardwareInfo() const;
@@ -78,7 +136,6 @@ class Device : public BaseObject<_cl_device_id> {
double getPlatformHostTimerResolution() const;
bool isSimulation() const;
GFXCORE_FAMILY getRenderCoreFamily() const;
void allocateSyncBufferHandler();
PerformanceCounters *getPerformanceCounters() { return performanceCounters.get(); }
PreemptionMode getPreemptionMode() const { return preemptionMode; }
MOCKABLE_VIRTUAL bool isSourceLevelDebuggerActive() const;
@@ -99,7 +156,6 @@ class Device : public BaseObject<_cl_device_id> {
virtual DeviceBitfield getDeviceBitfield() const = 0;
static decltype(&PerformanceCounters::create) createPerformanceCountersFunc;
std::unique_ptr<SyncBufferHandler> syncBufferHandler;
protected:
Device() = delete;
@@ -107,7 +163,6 @@ class Device : public BaseObject<_cl_device_id> {
MOCKABLE_VIRTUAL void initializeCaps();
void setupFp64Flags();
void appendOSExtensions(std::string &deviceExtensions);
template <typename T>
static T *createDeviceInternals(T *device) {
@@ -123,7 +178,6 @@ class Device : public BaseObject<_cl_device_id> {
bool createEngine(uint32_t deviceCsrIndex, aub_stream::EngineType engineType);
MOCKABLE_VIRTUAL std::unique_ptr<CommandStreamReceiver> createCommandStreamReceiver() const;
std::vector<unsigned int> simultaneousInterops;
unsigned int enabledClVersion = 0u;
std::string deviceExtensions;
std::string exposedBuiltinKernels = "";
@@ -143,10 +197,10 @@ class Device : public BaseObject<_cl_device_id> {
};
template <cl_device_info Param>
inline void Device::getCap(const void *&src,
size_t &size,
size_t &retSize) {
src = &DeviceInfoTable::Map<Param>::getValue(deviceInfo);
inline void ClDevice::getCap(const void *&src,
size_t &size,
size_t &retSize) {
src = &DeviceInfoTable::Map<Param>::getValue(device.getDeviceInfo());
retSize = size = DeviceInfoTable::Map<Param>::size;
}

View File

@@ -183,9 +183,6 @@ void Device::initializeCaps() {
deviceExtensions += sharingFactory.getExtensions();
simultaneousInterops = {0};
appendOSExtensions(deviceExtensions);
deviceExtensions += hwHelper.getExtensions();
deviceInfo.deviceExtensions = deviceExtensions.c_str();
@@ -385,4 +382,10 @@ void Device::initializeCaps() {
}
}
}
void Device::appendOSExtensions(const std::string &newExtensions) {
deviceExtensions += newExtensions;
deviceInfo.deviceExtensions = deviceExtensions.c_str();
}
} // namespace NEO

View File

@@ -20,53 +20,50 @@ using DeviceInfoTable::Map;
namespace NEO {
template <cl_device_info Param>
inline void Device::getStr(const void *&src,
size_t &size,
size_t &retSize) {
src = Map<Param>::getValue(deviceInfo);
retSize = size = strlen(Map<Param>::getValue(deviceInfo)) + 1;
inline void ClDevice::getStr(const void *&src,
size_t &size,
size_t &retSize) {
src = Map<Param>::getValue(device.getDeviceInfo());
retSize = size = strlen(Map<Param>::getValue(device.getDeviceInfo())) + 1;
}
template <>
inline void Device::getCap<CL_DEVICE_MAX_WORK_ITEM_SIZES>(const void *&src,
size_t &size,
size_t &retSize) {
src = deviceInfo.maxWorkItemSizes;
retSize = size = sizeof(deviceInfo.maxWorkItemSizes);
inline void ClDevice::getCap<CL_DEVICE_MAX_WORK_ITEM_SIZES>(const void *&src,
size_t &size,
size_t &retSize) {
src = device.getDeviceInfo().maxWorkItemSizes;
retSize = size = sizeof(device.getDeviceInfo().maxWorkItemSizes);
}
template <>
inline void Device::getCap<CL_DEVICE_PARTITION_PROPERTIES>(const void *&src,
size_t &size,
size_t &retSize) {
inline void ClDevice::getCap<CL_DEVICE_PARTITION_PROPERTIES>(const void *&src,
size_t &size,
size_t &retSize) {
static cl_device_partition_property property = 0;
src = &property;
retSize = size = sizeof(cl_device_partition_property *);
}
template <>
inline void Device::getCap<CL_DEVICE_PLATFORM>(const void *&src,
size_t &size,
size_t &retSize) {
// This isn't referenced externally but because we're passing a pointer to a pointer,
// we need a persistent location
static cl_platform_id pPlatform = platform();
src = &pPlatform;
inline void ClDevice::getCap<CL_DEVICE_PLATFORM>(const void *&src,
size_t &size,
size_t &retSize) {
src = &platformId;
retSize = size = sizeof(cl_platform_id);
}
template <>
inline void Device::getCap<CL_DEVICE_SUB_GROUP_SIZES_INTEL>(const void *&src,
size_t &size,
size_t &retSize) {
src = deviceInfo.maxSubGroups;
retSize = size = sizeof(deviceInfo.maxSubGroups);
inline void ClDevice::getCap<CL_DEVICE_SUB_GROUP_SIZES_INTEL>(const void *&src,
size_t &size,
size_t &retSize) {
src = device.getDeviceInfo().maxSubGroups;
retSize = size = sizeof(device.getDeviceInfo().maxSubGroups);
}
cl_int Device::getDeviceInfo(cl_device_info paramName,
size_t paramValueSize,
void *paramValue,
size_t *paramValueSizeRet) {
cl_int ClDevice::getDeviceInfo(cl_device_info paramName,
size_t paramValueSize,
void *paramValue,
size_t *paramValueSizeRet) {
cl_int retVal = CL_INVALID_VALUE;
size_t srcSize = 0;
size_t retSize = 0;
@@ -192,10 +189,10 @@ cl_int Device::getDeviceInfo(cl_device_info paramName,
break;
}
default:
if (deviceInfo.imageSupport && getDeviceInfoForImage(paramName, src, srcSize, retSize)) {
if (device.getDeviceInfo().imageSupport && getDeviceInfoForImage(paramName, src, srcSize, retSize)) {
break;
}
DeviceHelper::getExtraDeviceInfo(getHardwareInfo(), paramName, param, src, srcSize, retSize);
DeviceHelper::getExtraDeviceInfo(device.getHardwareInfo(), paramName, param, src, srcSize, retSize);
}
retVal = ::getInfo(paramValue, paramValueSize, src, srcSize);
@@ -207,10 +204,10 @@ cl_int Device::getDeviceInfo(cl_device_info paramName,
return retVal;
}
bool Device::getDeviceInfoForImage(cl_device_info paramName,
const void *&src,
size_t &srcSize,
size_t &retSize) {
bool ClDevice::getDeviceInfoForImage(cl_device_info paramName,
const void *&src,
size_t &srcSize,
size_t &retSize) {
switch (paramName) {
case CL_DEVICE_MAX_READ_IMAGE_ARGS:
getCap<CL_DEVICE_MAX_READ_IMAGE_ARGS>(src, srcSize, retSize);
@@ -249,11 +246,11 @@ bool Device::getDeviceInfoForImage(cl_device_info paramName,
getCap<CL_DEVICE_IMAGE_PITCH_ALIGNMENT>(src, srcSize, retSize);
break;
case CL_DEVICE_PLANAR_YUV_MAX_WIDTH_INTEL:
if (deviceInfo.nv12Extension)
if (getDeviceInfo().nv12Extension)
getCap<CL_DEVICE_PLANAR_YUV_MAX_WIDTH_INTEL>(src, srcSize, retSize);
break;
case CL_DEVICE_PLANAR_YUV_MAX_HEIGHT_INTEL:
if (deviceInfo.nv12Extension)
if (getDeviceInfo().nv12Extension)
getCap<CL_DEVICE_PLANAR_YUV_MAX_HEIGHT_INTEL>(src, srcSize, retSize);
break;
default:

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -11,14 +11,15 @@
#include <vector>
namespace NEO {
class Device;
class DeviceVector : public std::vector<Device *> {
class ClDevice;
class ClDeviceVector : public std::vector<ClDevice *> {
public:
DeviceVector() = default;
DeviceVector(const DeviceVector &) = default;
DeviceVector &operator=(const DeviceVector &) = default;
DeviceVector(const cl_device_id *devices,
cl_uint numDevices);
ClDeviceVector() = default;
ClDeviceVector(const ClDeviceVector &) = default;
ClDeviceVector &operator=(const ClDeviceVector &) = default;
ClDeviceVector(const cl_device_id *devices,
cl_uint numDevices);
void toDeviceIDs(std::vector<cl_device_id> &devIDs);
};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 Intel Corporation
* Copyright (C) 2019-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -14,7 +14,13 @@
namespace NEO {
RootDevice::RootDevice(ExecutionEnvironment *executionEnvironment, uint32_t rootDeviceIndex) : Device(executionEnvironment), rootDeviceIndex(rootDeviceIndex) {}
RootDevice::~RootDevice() = default;
RootDevice::~RootDevice() {
for (auto subdevice : subdevices) {
if (subdevice) {
subdevice->decRefInternal();
}
}
}
uint32_t RootDevice::getNumSubDevices() const {
return static_cast<uint32_t>(subdevices.size());
@@ -36,7 +42,7 @@ Device *RootDevice::getDeviceById(uint32_t deviceId) const {
if (subdevices.empty()) {
return const_cast<RootDevice *>(this);
}
return subdevices[deviceId].get();
return subdevices[deviceId];
};
SubDevice *RootDevice::createSubDevice(uint32_t subDeviceIndex) {
@@ -48,14 +54,16 @@ bool RootDevice::createDeviceImpl() {
if (numSubDevices == 1) {
numSubDevices = 0;
}
subdevices.resize(numSubDevices);
UNRECOVERABLE_IF(!subdevices.empty());
subdevices.resize(numSubDevices, nullptr);
for (auto i = 0u; i < numSubDevices; i++) {
auto subDevice = createSubDevice(i);
if (!subDevice) {
return false;
}
subdevices[i].reset(subDevice);
subDevice->incRefInternal();
subdevices[i] = subDevice;
}
auto status = Device::createDeviceImpl();
if (!status) {
@@ -63,16 +71,9 @@ bool RootDevice::createDeviceImpl() {
}
return true;
}
/* We hide the retain and release function of BaseObject. */
void RootDevice::retain() {
DEBUG_BREAK_IF(!isValid());
}
unique_ptr_if_unused<Device> RootDevice::release() {
DEBUG_BREAK_IF(!isValid());
return unique_ptr_if_unused<Device>(this, false);
}
bool RootDevice::isReleasable() {
return false;
};
DeviceBitfield RootDevice::getDeviceBitfield() const {
DeviceBitfield deviceBitfield{static_cast<uint32_t>(maxNBitValue(getNumAvailableDevices()))};
return deviceBitfield;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 Intel Corporation
* Copyright (C) 2019-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -20,9 +20,7 @@ class RootDevice : public Device {
uint32_t getNumAvailableDevices() const override;
uint32_t getRootDeviceIndex() const override;
Device *getDeviceById(uint32_t deviceId) const override;
/* We hide the retain and release function of BaseObject. */
void retain() override;
unique_ptr_if_unused<Device> release() override;
bool isReleasable() override;
uint32_t getNumSubDevices() const;
@@ -33,7 +31,7 @@ class RootDevice : public Device {
MOCKABLE_VIRTUAL bool initializeRootCommandStreamReceiver();
MOCKABLE_VIRTUAL SubDevice *createSubDevice(uint32_t subDeviceIndex);
std::vector<std::unique_ptr<SubDevice>> subdevices;
std::vector<SubDevice *> subdevices;
const uint32_t rootDeviceIndex;
};
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 Intel Corporation
* Copyright (C) 2019-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -12,20 +12,9 @@
namespace NEO {
SubDevice::SubDevice(ExecutionEnvironment *executionEnvironment, uint32_t subDeviceIndex, RootDevice &rootDevice) : Device(executionEnvironment), subDeviceIndex(subDeviceIndex), rootDevice(rootDevice) {}
void SubDevice::retain() {
rootDevice.incRefInternal();
Device::retain();
bool SubDevice::isReleasable() {
return true;
};
unique_ptr_if_unused<Device> SubDevice::release() {
rootDevice.decRefInternal();
return Device::release();
};
void SubDevice::retainInternal() {
rootDevice.incRefInternal();
}
void SubDevice::releaseInternal() {
rootDevice.decRefInternal();
}
DeviceBitfield SubDevice::getDeviceBitfield() const {
DeviceBitfield deviceBitfield;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 Intel Corporation
* Copyright (C) 2019-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -15,10 +15,7 @@ class SubDevice : public Device {
constexpr static uint32_t unspecifiedSubDeviceIndex = std::numeric_limits<uint32_t>::max();
SubDevice(ExecutionEnvironment *executionEnvironment, uint32_t subDeviceIndex, RootDevice &rootDevice);
void retain() override;
unique_ptr_if_unused<Device> release() override;
void retainInternal();
void releaseInternal();
bool isReleasable() override;
uint32_t getNumAvailableDevices() const override;
uint32_t getRootDeviceIndex() const override;
Device *getDeviceById(uint32_t deviceId) const override;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -20,7 +20,7 @@ DeviceQueueCreateFunc deviceQueueFactory[IGFX_MAX_CORE] = {};
const uint32_t DeviceQueue::numberOfDeviceEnqueues = 128;
DeviceQueue::DeviceQueue(Context *context,
Device *device,
ClDevice *device,
cl_queue_properties &properties) : DeviceQueue() {
this->context = context;
this->device = device;
@@ -40,7 +40,7 @@ DeviceQueue::DeviceQueue(Context *context,
initDeviceQueue();
}
DeviceQueue *DeviceQueue::create(Context *context, Device *device,
DeviceQueue *DeviceQueue::create(Context *context, ClDevice *device,
const cl_queue_properties &properties,
cl_int &errcodeRet) {
errcodeRet = CL_SUCCESS;
@@ -89,6 +89,10 @@ DeviceQueue::~DeviceQueue() {
}
}
Device &DeviceQueue::getDevice() {
return device->getDevice();
}
cl_int DeviceQueue::getCommandQueueInfo(cl_command_queue_info paramName,
size_t paramValueSize, void *paramValue,
size_t *paramValueSizeRet) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -14,6 +14,7 @@
#include "runtime/helpers/base_object.h"
namespace NEO {
class ClDevice;
class CommandQueue;
class Context;
class Device;
@@ -40,10 +41,10 @@ class DeviceQueue : public BaseObject<_device_queue> {
}
offsetDsh = 0;
}
DeviceQueue(Context *context, Device *device, cl_queue_properties &properties);
DeviceQueue(Context *context, ClDevice *device, cl_queue_properties &properties);
~DeviceQueue() override;
Device &getDevice() { return *device; }
Device &getDevice();
Context &getContext() { return *context; }
cl_uint getQueueSize() { return queueSize; }
cl_command_queue_properties getCommandQueueProperties() const { return commandQueueProperties; }
@@ -60,7 +61,7 @@ class DeviceQueue : public BaseObject<_device_queue> {
}
static DeviceQueue *create(Context *context,
Device *device,
ClDevice *device,
const cl_queue_properties &properties,
cl_int &errcodeRet);
@@ -111,7 +112,7 @@ class DeviceQueue : public BaseObject<_device_queue> {
void initDeviceQueue();
Context *context = nullptr;
Device *device = nullptr;
ClDevice *device = nullptr;
cl_command_queue_properties commandQueueProperties = 0;
cl_uint queueSize = 0;
@@ -130,5 +131,5 @@ class DeviceQueue : public BaseObject<_device_queue> {
};
typedef DeviceQueue *(*DeviceQueueCreateFunc)(
Context *context, Device *device, cl_queue_properties &properties);
Context *context, ClDevice *device, cl_queue_properties &properties);
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -34,7 +34,7 @@ class DeviceQueueHw : public DeviceQueue {
public:
DeviceQueueHw(Context *context,
Device *device,
ClDevice *device,
cl_queue_properties &properties) : BaseClass(context, device, properties) {
allocateSlbBuffer();
offsetDsh = colorCalcStateSize + (uint32_t)sizeof(INTERFACE_DESCRIPTOR_DATA) * interfaceDescriptorEntries * numberOfIDTables;
@@ -42,7 +42,7 @@ class DeviceQueueHw : public DeviceQueue {
}
static DeviceQueue *create(Context *context,
Device *device,
ClDevice *device,
cl_queue_properties &properties) {
return new (std::nothrow) DeviceQueueHw<GfxFamily>(context, device, properties);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -11,8 +11,8 @@
#include "runtime/program/program.h"
namespace NEO {
const SipKernel &initSipKernel(SipKernelType type, Device &device) {
return device.getExecutionEnvironment()->getBuiltIns()->getSipKernel(type, device);
const SipKernel &initSipKernel(SipKernelType type, ClDevice &device) {
return device.getExecutionEnvironment()->getBuiltIns()->getSipKernel(type, device.getDevice());
}
Program *createProgramForSip(ExecutionEnvironment &executionEnvironment,
Context *context,

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -10,8 +10,9 @@
#include "runtime/execution_environment/execution_environment.h"
namespace NEO {
class ClDevice;
const SipKernel &initSipKernel(SipKernelType type, Device &device);
const SipKernel &initSipKernel(SipKernelType type, ClDevice &device);
Program *createProgramForSip(ExecutionEnvironment &executionEnvironment,
Context *context,
std::vector<char> &binary,

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -12,7 +12,7 @@ bool isExtraToken(const cl_queue_properties *property) {
return false;
}
bool verifyExtraTokens(Device *&device, Context &context, const cl_queue_properties *properties) {
bool verifyExtraTokens(ClDevice *&device, Context &context, const cl_queue_properties *properties) {
return true;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -9,6 +9,7 @@
#include "runtime/command_queue/command_queue.h"
#include "runtime/device_queue/device_queue.h"
#include "runtime/helpers/get_info.h"
#include "runtime/platform/platform.h"
namespace NEO {
@@ -61,7 +62,7 @@ cl_int getQueueInfo(QueueType *queue,
getInfoHelper.set<cl_context>(&queue->getContext());
break;
case CL_QUEUE_DEVICE:
getInfoHelper.set<cl_device_id>(&queue->getDevice());
getInfoHelper.set<cl_device_id>(platform()->clDeviceMap[&queue->getDevice()]);
break;
case CL_QUEUE_REFERENCE_COUNT:
getInfoHelper.set<cl_int>(queue->getReference());
@@ -123,5 +124,5 @@ returnType getCmdQueueProperties(const cl_queue_properties *properties,
return retVal;
}
bool isExtraToken(const cl_queue_properties *property);
bool verifyExtraTokens(Device *&device, Context &context, const cl_queue_properties *properties);
bool verifyExtraTokens(ClDevice *&device, Context &context, const cl_queue_properties *properties);
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -33,7 +33,7 @@ cl_int validateObject(cl_context object) {
}
cl_int validateObject(cl_device_id object) {
return castToObject<Device>(object) != nullptr
return castToObject<ClDevice>(object) != nullptr
? CL_SUCCESS
: CL_INVALID_DEVICE;
}

View File

@@ -55,7 +55,7 @@ class Surface;
uint32_t Kernel::dummyPatchLocation = 0xbaddf00d;
Kernel::Kernel(Program *programArg, const KernelInfo &kernelInfoArg, const Device &deviceArg, bool schedulerKernel)
Kernel::Kernel(Program *programArg, const KernelInfo &kernelInfoArg, const ClDevice &deviceArg, bool schedulerKernel)
: globalWorkOffsetX(&Kernel::dummyPatchLocation),
globalWorkOffsetY(&Kernel::dummyPatchLocation),
globalWorkOffsetZ(&Kernel::dummyPatchLocation),
@@ -2231,7 +2231,7 @@ void Kernel::patchSyncBuffer(Device &device, GraphicsAllocation *gfxAllocation,
patchInfo.pAllocateSyncBuffer->SurfaceStateHeapOffset);
auto addressToPatch = gfxAllocation->getUnderlyingBuffer();
auto sizeToPatch = gfxAllocation->getUnderlyingBufferSize();
Buffer::setSurfaceState(&device, surfaceState, sizeToPatch, addressToPatch, gfxAllocation);
Buffer::setSurfaceState(platform()->clDeviceMap[&device], surfaceState, sizeToPatch, addressToPatch, gfxAllocation);
}
}

View File

@@ -190,7 +190,7 @@ class Kernel : public BaseObject<_cl_kernel> {
return kernelInfo;
}
const Device &getDevice() const {
const ClDevice &getDevice() const {
return device;
}
@@ -479,7 +479,7 @@ class Kernel : public BaseObject<_cl_kernel> {
void patchWithImplicitSurface(void *ptrToPatchInCrossThreadData, GraphicsAllocation &allocation, const PatchTokenT &patch);
void getParentObjectCounts(ObjectCounts &objectCount);
Kernel(Program *programArg, const KernelInfo &kernelInfoArg, const Device &deviceArg, bool schedulerKernel = false);
Kernel(Program *programArg, const KernelInfo &kernelInfoArg, const ClDevice &deviceArg, bool schedulerKernel = false);
void provideInitializationHints();
void patchBlocksCurbeWithConstantValues();
@@ -492,7 +492,7 @@ class Kernel : public BaseObject<_cl_kernel> {
bool allocationForCacheFlush(GraphicsAllocation *argAllocation) const;
Program *program;
Context *context;
const Device &device;
const ClDevice &device;
const KernelInfo &kernelInfo;
std::vector<SimpleKernelArgInfo> kernelArguments;

View File

@@ -526,7 +526,7 @@ Buffer *Buffer::createBufferHw(Context *context,
return pBuffer;
}
Buffer *Buffer::createBufferHwFromDevice(const Device *device,
Buffer *Buffer::createBufferHwFromDevice(const ClDevice *device,
cl_mem_flags flags,
cl_mem_flags_intel flagsIntel,
size_t size,
@@ -572,7 +572,7 @@ uint32_t Buffer::getMocsValue(bool disableL3Cache, bool isReadOnlyArgument) cons
}
}
void Buffer::setSurfaceState(const Device *device,
void Buffer::setSurfaceState(const ClDevice *device,
void *surfaceState,
size_t svmSize,
void *svmPtr,

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -17,7 +17,7 @@
namespace NEO {
class Buffer;
class Device;
class ClDevice;
class MemoryManager;
typedef Buffer *(*BufferCreatFunc)(Context *context,
@@ -87,7 +87,7 @@ class Buffer : public MemObj {
bool isHostPtrSVM,
bool isImageRedescribed);
static Buffer *createBufferHwFromDevice(const Device *device,
static Buffer *createBufferHwFromDevice(const ClDevice *device,
cl_mem_flags flags,
cl_mem_flags_intel flagsIntel,
size_t size,
@@ -103,7 +103,7 @@ class Buffer : public MemObj {
const cl_buffer_region *region,
cl_int &errcodeRet);
static void setSurfaceState(const Device *device,
static void setSurfaceState(const ClDevice *device,
void *surfaceState,
size_t svmSize,
void *svmPtr,

View File

@@ -28,6 +28,7 @@
#include "runtime/mem_obj/buffer.h"
#include "runtime/mem_obj/mem_obj_helper.h"
#include "runtime/memory_manager/memory_manager.h"
#include "runtime/platform/platform.h"
#include "igfxfmid.h"
@@ -442,7 +443,7 @@ cl_int Image::validate(Context *context,
const ClSurfaceFormatInfo *surfaceFormat,
const cl_image_desc *imageDesc,
const void *hostPtr) {
auto pDevice = context->getDevice(0);
auto pClDevice = context->getDevice(0);
size_t srcSize = 0;
size_t retSize = 0;
const size_t *maxWidth = nullptr;
@@ -456,15 +457,15 @@ cl_int Image::validate(Context *context,
Image *parentImage = castToObject<Image>(imageDesc->mem_object);
Buffer *parentBuffer = castToObject<Buffer>(imageDesc->mem_object);
if (imageDesc->image_type == CL_MEM_OBJECT_IMAGE2D) {
pDevice->getCap<CL_DEVICE_IMAGE2D_MAX_WIDTH>(reinterpret_cast<const void *&>(maxWidth), srcSize, retSize);
pDevice->getCap<CL_DEVICE_IMAGE2D_MAX_HEIGHT>(reinterpret_cast<const void *&>(maxHeight), srcSize, retSize);
pClDevice->getCap<CL_DEVICE_IMAGE2D_MAX_WIDTH>(reinterpret_cast<const void *&>(maxWidth), srcSize, retSize);
pClDevice->getCap<CL_DEVICE_IMAGE2D_MAX_HEIGHT>(reinterpret_cast<const void *&>(maxHeight), srcSize, retSize);
if (imageDesc->image_width > *maxWidth ||
imageDesc->image_height > *maxHeight) {
return CL_INVALID_IMAGE_SIZE;
}
if (parentBuffer) { // Image 2d from buffer
pDevice->getCap<CL_DEVICE_IMAGE_PITCH_ALIGNMENT>(reinterpret_cast<const void *&>(pitchAlignment), srcSize, retSize);
pDevice->getCap<CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT>(reinterpret_cast<const void *&>(baseAddressAlignment), srcSize, retSize);
pClDevice->getCap<CL_DEVICE_IMAGE_PITCH_ALIGNMENT>(reinterpret_cast<const void *&>(pitchAlignment), srcSize, retSize);
pClDevice->getCap<CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT>(reinterpret_cast<const void *&>(baseAddressAlignment), srcSize, retSize);
const auto rowSize = imageDesc->image_row_pitch != 0 ? imageDesc->image_row_pitch : alignUp(imageDesc->image_width * surfaceFormat->surfaceFormat.NumChannels * surfaceFormat->surfaceFormat.PerChannelSizeInBytes, *pitchAlignment);
const auto minimumBufferSize = imageDesc->image_height * rowSize;
@@ -538,7 +539,7 @@ cl_int Image::validatePlanarYUV(Context *context,
const cl_image_desc *imageDesc,
const void *hostPtr) {
cl_int errorCode = CL_SUCCESS;
auto pDevice = context->getDevice(0);
auto pClDevice = context->getDevice(0);
const size_t *maxWidth = nullptr;
const size_t *maxHeight = nullptr;
size_t srcSize = 0;
@@ -572,8 +573,8 @@ cl_int Image::validatePlanarYUV(Context *context,
}
}
pDevice->getCap<CL_DEVICE_PLANAR_YUV_MAX_WIDTH_INTEL>(reinterpret_cast<const void *&>(maxWidth), srcSize, retSize);
pDevice->getCap<CL_DEVICE_PLANAR_YUV_MAX_HEIGHT_INTEL>(reinterpret_cast<const void *&>(maxHeight), srcSize, retSize);
pClDevice->getCap<CL_DEVICE_PLANAR_YUV_MAX_WIDTH_INTEL>(reinterpret_cast<const void *&>(maxWidth), srcSize, retSize);
pClDevice->getCap<CL_DEVICE_PLANAR_YUV_MAX_HEIGHT_INTEL>(reinterpret_cast<const void *&>(maxHeight), srcSize, retSize);
if (imageDesc->image_width > *maxWidth || imageDesc->image_height > *maxHeight) {
errorCode = CL_INVALID_IMAGE_SIZE;
break;

View File

@@ -64,6 +64,6 @@ void DeviceFactory::releaseDevices() {
DeviceFactory::numDevices = 0;
}
void Device::appendOSExtensions(std::string &deviceExtensions) {
void ClDevice::initializeCaps() {
}
} // namespace NEO

View File

@@ -95,7 +95,7 @@ cl_int CL_API_CALL clGetDeviceIDsFromDX9INTEL(cl_platform_id platform, cl_dx9_de
if (retVal != CL_SUCCESS) {
return retVal;
}
cl_device_id device = platformInternal->getDevice(0);
cl_device_id device = platformInternal->getClDevice(0);
GetInfoHelper::set(devices, device);
GetInfoHelper::set(numDevices, 1u);
@@ -202,7 +202,7 @@ cl_int CL_API_CALL clGetDeviceIDsFromDX9MediaAdapterKHR(cl_platform_id platform,
if (retVal != CL_SUCCESS) {
return retVal;
}
cl_device_id device = platformInternal->getDevice(0);
cl_device_id device = platformInternal->getClDevice(0);
GetInfoHelper::set(devices, device);
GetInfoHelper::set(numDevices, 1u);
@@ -311,7 +311,7 @@ cl_int CL_API_CALL clGetDeviceIDsFromD3D10KHR(cl_platform_id platform, cl_d3d10_
sharingFcns.getDxgiDescFcn = (D3DSharingFunctions<D3DTypesHelper::D3D10>::GetDxgiDescFcn)DebugManager.injectFcn;
}
Device *device = platformInternal->getDevice(0);
ClDevice *device = platformInternal->getClDevice(0);
switch (d3dDeviceSource) {
case CL_D3D10_DEVICE_KHR:
@@ -518,7 +518,7 @@ cl_int CL_API_CALL clGetDeviceIDsFromD3D11KHR(cl_platform_id platform, cl_d3d11_
sharingFcns.getDxgiDescFcn = (D3DSharingFunctions<D3DTypesHelper::D3D11>::GetDxgiDescFcn)DebugManager.injectFcn;
}
Device *device = platformInternal->getDevice(0);
ClDevice *device = platformInternal->getClDevice(0);
switch (d3dDeviceSource) {
case CL_D3D11_DEVICE_KHR:

View File

@@ -53,8 +53,8 @@ void DeviceFactory::releaseDevices() {
DeviceFactory::numDevices = 0;
}
void Device::appendOSExtensions(std::string &deviceExtensions) {
deviceExtensions += "cl_intel_simultaneous_sharing ";
void ClDevice::initializeCaps() {
device.appendOSExtensions("cl_intel_simultaneous_sharing ");
simultaneousInterops = {CL_GL_CONTEXT_KHR,
CL_WGL_HDC_KHR,
@@ -68,6 +68,7 @@ void Device::appendOSExtensions(std::string &deviceExtensions) {
CL_CONTEXT_D3D11_DEVICE_KHR,
0};
}
} // namespace NEO
#endif

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -50,7 +50,8 @@ Platform *constructPlatform() {
}
Platform::Platform() {
devices.reserve(4);
clDevices.reserve(4);
clDeviceMap.reserve(20);
setAsyncEventsHandler(std::unique_ptr<AsyncEventsHandler>(new AsyncEventsHandler()));
executionEnvironment = new ExecutionEnvironment;
executionEnvironment->incRefInternal();
@@ -58,9 +59,9 @@ Platform::Platform() {
Platform::~Platform() {
asyncEventsHandler->closeThread();
for (auto dev : this->devices) {
if (dev) {
dev->decRefInternal();
for (auto clDevice : this->clDevices) {
if (clDevice) {
clDevice->decRefInternal();
}
}
@@ -79,7 +80,7 @@ cl_int Platform::getInfo(cl_platform_info paramName,
switch (paramName) {
case CL_PLATFORM_HOST_TIMER_RESOLUTION:
pVal = static_cast<uint64_t>(this->devices[0]->getPlatformHostTimerResolution());
pVal = static_cast<uint64_t>(this->clDevices[0]->getPlatformHostTimerResolution());
paramSize = sizeof(uint64_t);
retVal = ::getInfo(paramValue, paramValueSize, &pVal, paramSize);
break;
@@ -152,12 +153,18 @@ bool Platform::initialize() {
DEBUG_BREAK_IF(this->platformInfo);
this->platformInfo.reset(new PlatformInfo);
this->devices.resize(numDevicesReturned);
this->clDevices.resize(numDevicesReturned);
for (uint32_t deviceOrdinal = 0; deviceOrdinal < numDevicesReturned; ++deviceOrdinal) {
auto pDevice = createRootDevice(deviceOrdinal);
DEBUG_BREAK_IF(!pDevice);
ClDevice *pClDevice = nullptr;
if (pDevice) {
this->devices[deviceOrdinal] = pDevice;
pClDevice = new ClDevice{*pDevice};
}
DEBUG_BREAK_IF(!pClDevice);
if (pClDevice) {
this->clDevices[deviceOrdinal] = pClDevice;
this->clDeviceMap.emplace(pDevice, pClDevice);
this->platformInfo->extensions = pDevice->getDeviceInfo().deviceExtensions;
@@ -182,19 +189,19 @@ bool Platform::initialize() {
auto hwInfo = executionEnvironment->getHardwareInfo();
const bool sourceLevelDebuggerActive = executionEnvironment->sourceLevelDebugger && executionEnvironment->sourceLevelDebugger->isDebuggerActive();
if (devices[0]->getPreemptionMode() == PreemptionMode::MidThread || sourceLevelDebuggerActive) {
auto sipType = SipKernel::getSipKernelType(hwInfo->platform.eRenderCoreFamily, devices[0]->isSourceLevelDebuggerActive());
initSipKernel(sipType, *devices[0]);
if (clDevices[0]->getPreemptionMode() == PreemptionMode::MidThread || sourceLevelDebuggerActive) {
auto sipType = SipKernel::getSipKernelType(hwInfo->platform.eRenderCoreFamily, clDevices[0]->isSourceLevelDebuggerActive());
initSipKernel(sipType, *clDevices[0]);
}
CommandStreamReceiverType csrType = this->devices[0]->getDefaultEngine().commandStreamReceiver->getType();
CommandStreamReceiverType csrType = this->clDevices[0]->getDefaultEngine().commandStreamReceiver->getType();
if (csrType != CommandStreamReceiverType::CSR_HW) {
auto enableLocalMemory = HwHelper::get(hwInfo->platform.eRenderCoreFamily).getEnableLocalMemory(*hwInfo);
executionEnvironment->rootDeviceEnvironments[0]->initAubCenter(enableLocalMemory, "aubfile", csrType);
}
this->fillGlobalDispatchTable();
DEBUG_BREAK_IF(DebugManager.flags.CreateMultipleRootDevices.get() > 1 && !this->devices[0]->getDefaultEngine().commandStreamReceiver->peekTimestampPacketWriteEnabled());
DEBUG_BREAK_IF(DebugManager.flags.CreateMultipleRootDevices.get() > 1 && !this->clDevices[0]->getDefaultEngine().commandStreamReceiver->peekTimestampPacketWriteEnabled());
state = StateInited;
return true;
}
@@ -212,16 +219,29 @@ bool Platform::isInitialized() {
Device *Platform::getDevice(size_t deviceOrdinal) {
TakeOwnershipWrapper<Platform> platformOwnership(*this);
if (this->state != StateInited || deviceOrdinal >= devices.size()) {
if (this->state != StateInited || deviceOrdinal >= clDevices.size()) {
return nullptr;
}
auto pDevice = devices[deviceOrdinal];
auto pDevice = &clDevices[deviceOrdinal]->getDevice();
DEBUG_BREAK_IF(pDevice == nullptr);
return pDevice;
}
ClDevice *Platform::getClDevice(size_t deviceOrdinal) {
TakeOwnershipWrapper<Platform> platformOwnership(*this);
if (this->state != StateInited || deviceOrdinal >= clDevices.size()) {
return nullptr;
}
auto pClDevice = clDevices[deviceOrdinal];
DEBUG_BREAK_IF(pClDevice == nullptr);
return pClDevice;
}
size_t Platform::getNumDevices() const {
TakeOwnershipWrapper<const Platform> platformOwnership(*this);
@@ -229,17 +249,17 @@ size_t Platform::getNumDevices() const {
return 0;
}
return devices.size();
return clDevices.size();
}
Device **Platform::getDevices() {
ClDevice **Platform::getClDevices() {
TakeOwnershipWrapper<Platform> platformOwnership(*this);
if (this->state != StateInited) {
return nullptr;
}
return devices.data();
return clDevices.data();
}
const PlatformInfo &Platform::getPlatformInfo() const {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -13,6 +13,7 @@
#include "platform_info.h"
#include <condition_variable>
#include <unordered_map>
#include <vector>
namespace NEO {
@@ -52,8 +53,10 @@ class Platform : public BaseObject<_cl_platform_id> {
bool isInitialized();
size_t getNumDevices() const;
Device **getDevices();
Device *getDevice(size_t deviceOrdinal);
ClDevice **getClDevices();
ClDevice *getClDevice(size_t deviceOrdinal);
std::unordered_map<const Device *, ClDevice *> clDeviceMap;
const PlatformInfo &getPlatformInfo() const;
AsyncEventsHandler *getAsyncEventsHandler();
@@ -73,7 +76,7 @@ class Platform : public BaseObject<_cl_platform_id> {
MOCKABLE_VIRTUAL void initializationLoopHelper(){};
MOCKABLE_VIRTUAL RootDevice *createRootDevice(uint32_t rootDeviceIndex) const;
std::unique_ptr<PlatformInfo> platformInfo;
DeviceVector devices;
ClDeviceVector clDevices;
std::string compilerExtensions;
std::unique_ptr<AsyncEventsHandler> asyncEventsHandler;
ExecutionEnvironment *executionEnvironment = nullptr;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -111,7 +111,7 @@ cl_int Program::build(
"\nBuild Internal Options", inputArgs.internalOptions.begin());
inputArgs.allowCaching = enableCaching;
NEO::TranslationOutput compilerOuput = {};
auto compilerErr = pCompilerInterface->build(*this->pDevice, inputArgs, compilerOuput);
auto compilerErr = pCompilerInterface->build(this->pDevice->getDevice(), inputArgs, compilerOuput);
this->updateBuildLog(this->pDevice, compilerOuput.frontendCompilerLog.c_str(), compilerOuput.frontendCompilerLog.size());
this->updateBuildLog(this->pDevice, compilerOuput.backendCompilerLog.c_str(), compilerOuput.backendCompilerLog.size());
retVal = asClError(compilerErr);
@@ -183,9 +183,10 @@ void Program::notifyDebuggerWithSourceCode(std::string &filename) {
}
}
cl_int Program::build(const cl_device_id device, const char *buildOptions, bool enableCaching,
cl_int Program::build(const Device *pDevice, const char *buildOptions, bool enableCaching,
std::unordered_map<std::string, BuiltinDispatchInfoBuilder *> &builtinsMap) {
auto ret = this->build(1, &device, buildOptions, nullptr, nullptr, enableCaching);
cl_device_id deviceId = platform()->clDeviceMap[pDevice];
auto ret = this->build(1, &deviceId, buildOptions, nullptr, nullptr, enableCaching);
if (ret != CL_SUCCESS) {
return ret;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -154,7 +154,7 @@ cl_int Program::compile(
inputArgs.internalOptions = ArrayRef<const char>(internalOptions.c_str(), internalOptions.length());
TranslationOutput compilerOuput;
auto compilerErr = pCompilerInterface->compile(*this->pDevice, inputArgs, compilerOuput);
auto compilerErr = pCompilerInterface->compile(this->pDevice->getDevice(), inputArgs, compilerOuput);
this->updateBuildLog(this->pDevice, compilerOuput.frontendCompilerLog.c_str(), compilerOuput.frontendCompilerLog.size());
this->updateBuildLog(this->pDevice, compilerOuput.backendCompilerLog.c_str(), compilerOuput.backendCompilerLog.size());
retVal = asClError(compilerErr);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -12,6 +12,7 @@
namespace NEO {
template Program *Program::create<Program>(cl_context, cl_uint, const cl_device_id *, const size_t *, const unsigned char **, cl_int *, cl_int &);
template Program *Program::create<Program>(cl_context, cl_uint, const char **, const size_t *, cl_int &);
template Program *Program::create<Program>(const char *, Context *, ClDevice &, bool, cl_int *);
template Program *Program::create<Program>(const char *, Context *, Device &, bool, cl_int *);
template Program *Program::createFromIL<Program>(Context *, const void *, size_t length, cl_int &);
template Program *Program::createFromGenBinary<Program>(ExecutionEnvironment &executionEnvironment, Context *context, const void *binary, size_t size, bool isBuiltIn, cl_int *errcodeRet);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -9,6 +9,7 @@
#include "runtime/context/context.h"
#include "runtime/device/device.h"
#include "runtime/helpers/string_helpers.h"
#include "runtime/platform/platform.h"
#include "runtime/program/program.h"
#include "compiler_options.h"
@@ -81,7 +82,7 @@ template <typename T>
T *Program::create(
const char *nullTerminatedString,
Context *context,
Device &device,
ClDevice &device,
bool isBuiltIn,
cl_int *errcodeRet) {
cl_int retVal = CL_SUCCESS;
@@ -113,6 +114,16 @@ T *Program::create(
return program;
}
template <typename T>
T *Program::create(
const char *nullTerminatedString,
Context *context,
Device &device,
bool isBuiltIn,
cl_int *errcodeRet) {
return Program::create<T>(nullTerminatedString, context, *platform()->clDeviceMap[&device], isBuiltIn, errcodeRet);
}
template <typename T>
T *Program::createFromGenBinary(
ExecutionEnvironment &executionEnvironment,

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -166,7 +166,7 @@ cl_int Program::getBuildInfo(cl_device_id device, cl_program_build_info paramNam
return CL_INVALID_DEVICE;
}
auto pDev = castToObject<Device>(device);
auto pClDev = castToObject<ClDevice>(device);
switch (paramName) {
case CL_PROGRAM_BUILD_STATUS:
@@ -180,7 +180,7 @@ cl_int Program::getBuildInfo(cl_device_id device, cl_program_build_info paramNam
break;
case CL_PROGRAM_BUILD_LOG: {
const char *pBuildLog = getBuildLog(pDev);
const char *pBuildLog = getBuildLog(pClDev);
if (pBuildLog != nullptr) {
pSrc = pBuildLog;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -118,7 +118,7 @@ cl_int Program::link(
if (!isCreateLibrary) {
inputArgs.outType = IGC::CodeType::oclGenBin;
NEO::TranslationOutput compilerOuput = {};
auto compilerErr = pCompilerInterface->link(*this->pDevice, inputArgs, compilerOuput);
auto compilerErr = pCompilerInterface->link(this->pDevice->getDevice(), inputArgs, compilerOuput);
this->updateBuildLog(this->pDevice, compilerOuput.frontendCompilerLog.c_str(), compilerOuput.frontendCompilerLog.size());
this->updateBuildLog(this->pDevice, compilerOuput.backendCompilerLog.c_str(), compilerOuput.backendCompilerLog.size());
retVal = asClError(compilerErr);
@@ -146,7 +146,7 @@ cl_int Program::link(
} else {
inputArgs.outType = IGC::CodeType::llvmBc;
NEO::TranslationOutput compilerOuput = {};
auto compilerErr = pCompilerInterface->createLibrary(*this->pDevice, inputArgs, compilerOuput);
auto compilerErr = pCompilerInterface->createLibrary(this->pDevice->getDevice(), inputArgs, compilerOuput);
this->updateBuildLog(this->pDevice, compilerOuput.frontendCompilerLog.c_str(), compilerOuput.frontendCompilerLog.size());
this->updateBuildLog(this->pDevice, compilerOuput.backendCompilerLog.c_str(), compilerOuput.backendCompilerLog.size());
retVal = asClError(compilerErr);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -18,13 +18,13 @@
namespace NEO {
PrintfHandler::PrintfHandler(Device &deviceArg) : device(deviceArg) {}
PrintfHandler::PrintfHandler(ClDevice &deviceArg) : device(deviceArg) {}
PrintfHandler::~PrintfHandler() {
device.getMemoryManager()->freeGraphicsMemory(printfSurface);
}
PrintfHandler *PrintfHandler::create(const MultiDispatchInfo &multiDispatchInfo, Device &device) {
PrintfHandler *PrintfHandler::create(const MultiDispatchInfo &multiDispatchInfo, ClDevice &device) {
if (multiDispatchInfo.usesStatelessPrintfSurface()) {
return new PrintfHandler(device);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -12,11 +12,12 @@
namespace NEO {
class ClDevice;
struct MultiDispatchInfo;
class PrintfHandler {
public:
static PrintfHandler *create(const MultiDispatchInfo &multiDispatchInfo, Device &deviceArg);
static PrintfHandler *create(const MultiDispatchInfo &multiDispatchInfo, ClDevice &deviceArg);
~PrintfHandler();
@@ -29,10 +30,10 @@ class PrintfHandler {
}
protected:
PrintfHandler(Device &device);
PrintfHandler(ClDevice &device);
static const uint32_t printfSurfaceInitialDataSize = sizeof(uint32_t);
Device &device;
ClDevice &device;
Kernel *kernel = nullptr;
GraphicsAllocation *printfSurface = nullptr;
};

View File

@@ -141,7 +141,7 @@ inline uint64_t readMisalignedUint64(const uint64_t *address) {
return static_cast<uint64_t>(static_cast<uint64_t>(addressBits[1]) << 32) | addressBits[0];
}
GraphicsAllocation *allocateGlobalsSurface(NEO::Context *ctx, NEO::Device *device, size_t size, bool constant, bool globalsAreExported, const void *initData) {
GraphicsAllocation *allocateGlobalsSurface(NEO::Context *ctx, NEO::ClDevice *device, size_t size, bool constant, bool globalsAreExported, const void *initData) {
UNRECOVERABLE_IF(device == nullptr);
if (globalsAreExported && (ctx != nullptr) && (ctx->getSVMAllocsManager() != nullptr)) {
NEO::SVMAllocsManager::SvmAllocationProperties svmProps = {};

View File

@@ -18,6 +18,7 @@
#include "runtime/context/context.h"
#include "runtime/device/device.h"
#include "runtime/memory_manager/memory_manager.h"
#include "runtime/platform/platform.h"
#include "runtime/program/block_kernel_manager.h"
#include "runtime/program/kernel_info.h"
@@ -204,7 +205,7 @@ cl_int Program::rebuildProgramFromIr() {
inputArgs.internalOptions = ArrayRef<const char>(internalOptions);
TranslationOutput compilerOuput = {};
auto err = pCompilerInterface->link(*this->pDevice, inputArgs, compilerOuput);
auto err = pCompilerInterface->link(this->pDevice->getDevice(), inputArgs, compilerOuput);
this->updateBuildLog(this->pDevice, compilerOuput.frontendCompilerLog.c_str(), compilerOuput.frontendCompilerLog.size());
this->updateBuildLog(this->pDevice, compilerOuput.backendCompilerLog.c_str(), compilerOuput.backendCompilerLog.size());
if (TranslationOutput::ErrorCode::Success != err) {
@@ -243,7 +244,7 @@ cl_int Program::setProgramSpecializationConstant(cl_uint specId, size_t specSize
}
SpecConstantInfo specConstInfo;
auto retVal = pCompilerInterface->getSpecConstantsInfo(this->getDevice(0), ArrayRef<const char>(sourceCode), specConstInfo);
auto retVal = pCompilerInterface->getSpecConstantsInfo(this->getDevice(0).getDevice(), ArrayRef<const char>(sourceCode), specConstInfo);
if (retVal != TranslationOutput::ErrorCode::Success) {
return CL_INVALID_VALUE;
@@ -285,6 +286,10 @@ bool Program::isValidLlvmBinary(
return retVal;
}
void Program::setDevice(Device *device) {
this->pDevice = platform()->clDeviceMap[device];
}
cl_int Program::getSource(std::string &binary) const {
cl_int retVal = CL_INVALID_PROGRAM;
binary = {};
@@ -295,7 +300,7 @@ cl_int Program::getSource(std::string &binary) const {
return retVal;
}
void Program::updateBuildLog(const Device *pDevice, const char *pErrorString,
void Program::updateBuildLog(const ClDevice *pDevice, const char *pErrorString,
size_t errorStringSize) {
if ((pErrorString == nullptr) || (errorStringSize == 0) || (pErrorString[0] == '\0')) {
return;
@@ -316,7 +321,7 @@ void Program::updateBuildLog(const Device *pDevice, const char *pErrorString,
buildLog[pDevice].append(pErrorString, pErrorString + errorStringSize);
}
const char *Program::getBuildLog(const Device *pDevice) const {
const char *Program::getBuildLog(const ClDevice *pDevice) const {
const char *entry = nullptr;
auto it = buildLog.find(pDevice);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -27,8 +27,10 @@ struct ProgramFromPatchtokens;
class BlockKernelManager;
class BuiltinDispatchInfoBuilder;
class ClDevice;
class Context;
class CompilerInterface;
class Device;
class ExecutionEnvironment;
struct KernelInfo;
template <>
@@ -84,6 +86,14 @@ class Program : public BaseObject<_cl_program> {
const size_t *lengths,
cl_int &errcodeRet);
template <typename T = Program>
static T *create(
const char *nullTerminatedString,
Context *context,
ClDevice &device,
bool isBuiltIn,
cl_int *errcodeRet);
template <typename T = Program>
static T *create(
const char *nullTerminatedString,
@@ -117,7 +127,7 @@ class Program : public BaseObject<_cl_program> {
void(CL_CALLBACK *funcNotify)(cl_program program, void *userData),
void *userData, bool enableCaching);
cl_int build(const cl_device_id device, const char *buildOptions, bool enableCaching,
cl_int build(const Device *pDevice, const char *buildOptions, bool enableCaching,
std::unordered_map<std::string, BuiltinDispatchInfoBuilder *> &builtinsMap);
MOCKABLE_VIRTUAL cl_int processGenBinary();
@@ -161,12 +171,12 @@ class Program : public BaseObject<_cl_program> {
return executionEnvironment;
}
const Device &getDevice(cl_uint deviceOrdinal) const {
const ClDevice &getDevice(cl_uint deviceOrdinal) const {
UNRECOVERABLE_IF(pDevice == nullptr);
return *pDevice;
}
void setDevice(Device *device) { this->pDevice = device; }
void setDevice(Device *device);
MOCKABLE_VIRTUAL cl_int processElfBinary(const void *pBinary, size_t binarySize, uint32_t &binaryVersion);
cl_int processSpirBinary(const void *pBinary, size_t binarySize, bool isSpirV);
@@ -175,9 +185,9 @@ class Program : public BaseObject<_cl_program> {
void processDebugData();
void updateBuildLog(const Device *pDevice, const char *pErrorString, const size_t errorStringSize);
void updateBuildLog(const ClDevice *pDevice, const char *pErrorString, const size_t errorStringSize);
const char *getBuildLog(const Device *pDevice) const;
const char *getBuildLog(const ClDevice *pDevice) const;
cl_uint getProgramBinaryType() const {
return programBinaryType;
@@ -327,7 +337,7 @@ class Program : public BaseObject<_cl_program> {
std::unique_ptr<LinkerInput> linkerInput;
Linker::RelocatedSymbolsMap symbols;
std::map<const Device *, std::string> buildLog;
std::map<const ClDevice *, std::string> buildLog;
bool areSpecializationConstantsInitialized = false;
CIF::RAII::UPtr_t<CIF::Builtins::BufferSimple> specConstantsIds;
@@ -337,13 +347,13 @@ class Program : public BaseObject<_cl_program> {
BlockKernelManager *blockKernelManager;
ExecutionEnvironment &executionEnvironment;
Context *context;
Device *pDevice;
ClDevice *pDevice;
cl_uint numDevices;
bool isBuiltIn;
bool kernelDebugEnabled = false;
};
GraphicsAllocation *allocateGlobalsSurface(NEO::Context *ctx, NEO::Device *device, size_t size, bool constant, bool globalsAreExported, const void *initData);
GraphicsAllocation *allocateGlobalsSurface(NEO::Context *ctx, NEO::ClDevice *device, size_t size, bool constant, bool globalsAreExported, const void *initData);
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -52,7 +52,7 @@ class SchedulerKernel : public Kernel {
GraphicsAllocation *debugQueue = nullptr);
protected:
SchedulerKernel(Program *programArg, const KernelInfo &kernelInfoArg, const Device &deviceArg) : Kernel(programArg, kernelInfoArg, deviceArg, true), gws(0) {
SchedulerKernel(Program *programArg, const KernelInfo &kernelInfoArg, const ClDevice &deviceArg) : Kernel(programArg, kernelInfoArg, deviceArg, true), gws(0) {
computeGws();
};

View File

@@ -345,7 +345,7 @@ cl_int CL_API_CALL clGetGLContextInfoKHR(const cl_context_properties *properties
}
if (paramName == CL_DEVICES_FOR_GL_CONTEXT_KHR || paramName == CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR) {
info.set<cl_device_id>(::platform()->getDevice(0));
info.set<cl_device_id>(::platform()->getClDevice(0));
return retVal;
}

View File

@@ -70,7 +70,7 @@ clGetDeviceIDsFromVA_APIMediaAdapterINTEL(cl_platform_id platform, cl_va_api_dev
if (status != CL_SUCCESS) {
status = CL_INVALID_PLATFORM;
} else {
cl_device_id device = pPlatform->getDevice(0);
cl_device_id device = pPlatform->getClDevice(0);
GetInfoHelper::set(devices, device);
GetInfoHelper::set(numDevices, 1u);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -51,7 +51,7 @@ class MediaImageSetArgTest : public DeviceFixture,
pKernelInfo->kernelArgInfo[1].isImage = true;
pKernelInfo->kernelArgInfo[0].isImage = true;
pKernel = new MockKernel(program.get(), *pKernelInfo, *pDevice);
pKernel = new MockKernel(program.get(), *pKernelInfo, *pClDevice);
ASSERT_NE(nullptr, pKernel);
ASSERT_EQ(CL_SUCCESS, pKernel->initialize());
@@ -59,7 +59,7 @@ class MediaImageSetArgTest : public DeviceFixture,
pKernel->setKernelArgHandler(0, &Kernel::setArgImage);
pKernel->setKernelArgHandler(1, &Kernel::setArgImage);
context = new MockContext(pDevice);
context = new MockContext(pClDevice);
srcImage = Image2dHelper<>::create(context);
ASSERT_NE(nullptr, srcImage);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 Intel Corporation
* Copyright (C) 2019-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -27,7 +27,7 @@ struct clAddCommentToAubTest : api_tests {
api_tests::TearDown();
}
Device *pDevice = nullptr;
ClDevice *pDevice = nullptr;
};
TEST_F(clAddCommentToAubTest, givenProperCommentNullptrAubCenterWhenAddCommentToAubThenSuccessIsReturned) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -25,11 +25,11 @@ void ApiFixture::SetUp() {
EXPECT_LT(0u, testedRootDeviceIndex);
rootDeviceEnvironmentBackup.swap(pPlatform->peekExecutionEnvironment()->rootDeviceEnvironments[0]);
auto pDevice = pPlatform->getDevice(testedRootDeviceIndex);
auto pDevice = pPlatform->getClDevice(testedRootDeviceIndex);
ASSERT_NE(nullptr, pDevice);
testedClDevice = pDevice;
pContext = Context::create<MockContext>(nullptr, DeviceVector(&testedClDevice, 1), nullptr, nullptr, retVal);
pContext = Context::create<MockContext>(nullptr, ClDeviceVector(&testedClDevice, 1), nullptr, nullptr, retVal);
EXPECT_EQ(retVal, CL_SUCCESS);
pCommandQueue = new CommandQueue(pContext, pDevice, nullptr);
@@ -53,20 +53,19 @@ void api_fixture_using_aligned_memory_manager::SetUp() {
retVal = CL_SUCCESS;
retSize = 0;
device = MockDevice::createWithNewExecutionEnvironment<MockAlignedMallocManagerDevice>(*platformDevices);
Device *devPtr = reinterpret_cast<Device *>(device);
cl_device_id clDevice = devPtr;
device = new MockClDevice{MockDevice::createWithNewExecutionEnvironment<MockAlignedMallocManagerDevice>(*platformDevices)};
cl_device_id deviceId = device;
context = Context::create<MockContext>(nullptr, DeviceVector(&clDevice, 1), nullptr, nullptr, retVal);
context = Context::create<MockContext>(nullptr, ClDeviceVector(&deviceId, 1), nullptr, nullptr, retVal);
EXPECT_EQ(CL_SUCCESS, retVal);
Context *ctxPtr = reinterpret_cast<Context *>(context);
commandQueue = new CommandQueue(context, devPtr, 0);
commandQueue = new CommandQueue(context, device, 0);
program = new MockProgram(*device->getExecutionEnvironment(), ctxPtr, false);
Program *prgPtr = reinterpret_cast<Program *>(program);
kernel = new MockKernel(prgPtr, program->mockKernelInfo, *devPtr);
kernel = new MockKernel(prgPtr, program->mockKernelInfo, *device);
ASSERT_NE(nullptr, kernel);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -21,9 +21,9 @@ namespace NEO {
class CommandQueue;
class Context;
class MockClDevice;
class MockKernel;
class MockProgram;
class MockAlignedMallocManagerDevice;
struct RootDeviceEnvironment;
extern size_t numPlatformDevices;
@@ -70,7 +70,7 @@ struct api_fixture_using_aligned_memory_manager {
Context *context;
MockKernel *kernel;
MockProgram *program;
MockAlignedMallocManagerDevice *device;
MockClDevice *device;
};
using api_test_using_aligned_memory_manager = Test<api_fixture_using_aligned_memory_manager>;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -64,7 +64,8 @@ TEST_F(clCreateCommandQueueTest, GivenOoqParametersWhenQueueIsCreatedThenQueueIs
HWTEST_F(clCreateCommandQueueTest, GivenOoqParametersWhenQueueIsCreatedThenCommandStreamReceiverSwitchesToBatchingMode) {
cl_int retVal = CL_SUCCESS;
cl_queue_properties ooq = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
auto mockDevice = castToObject<MockDevice>(devices[testedRootDeviceIndex]);
auto clDevice = castToObject<ClDevice>(devices[testedRootDeviceIndex]);
auto mockDevice = reinterpret_cast<MockDevice *>(&clDevice->getDevice());
auto &csr = mockDevice->getUltCommandStreamReceiver<FamilyType>();
EXPECT_EQ(DispatchMode::ImmediateDispatch, csr.dispatchMode);
@@ -76,7 +77,8 @@ HWTEST_F(clCreateCommandQueueTest, GivenOoqParametersWhenQueueIsCreatedThenComma
HWTEST_F(clCreateCommandQueueTest, GivenOoqParametersWhenQueueIsCreatedThenCommandStreamReceiverSwitchesToNTo1SubmissionModel) {
cl_int retVal = CL_SUCCESS;
cl_queue_properties ooq = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
auto mockDevice = castToObject<MockDevice>(devices[testedRootDeviceIndex]);
auto clDevice = castToObject<ClDevice>(devices[testedRootDeviceIndex]);
auto mockDevice = reinterpret_cast<MockDevice *>(&clDevice->getDevice());
auto &csr = mockDevice->getUltCommandStreamReceiver<FamilyType>();
EXPECT_FALSE(csr.isNTo1SubmissionModelEnabled());

View File

@@ -79,7 +79,7 @@ TEST_P(clCreateCommandQueueWithPropertiesTests, GivenPropertiesWhenCreatingComma
const auto minimumCreateDeviceQueueFlags = static_cast<cl_command_queue_properties>(CL_QUEUE_ON_DEVICE |
CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE);
const auto deviceQueueShouldBeCreated = (commandQueueProperties & minimumCreateDeviceQueueFlags) == minimumCreateDeviceQueueFlags;
if (deviceQueueShouldBeCreated && !castToObject<Device>(this->devices[testedRootDeviceIndex])->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) {
if (deviceQueueShouldBeCreated && !castToObject<ClDevice>(this->devices[testedRootDeviceIndex])->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) {
return;
}
@@ -267,7 +267,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, clCreateCommandQueueWithPropertiesApi, GivenNumberOf
GTEST_SKIP();
}
cl_int retVal = CL_SUCCESS;
auto pDevice = castToObject<Device>(devices[testedRootDeviceIndex]);
auto pDevice = castToObject<ClDevice>(devices[testedRootDeviceIndex]);
cl_queue_properties odq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE, 0, 0};
auto cmdq1 = clCreateCommandQueueWithProperties(pContext, devices[testedRootDeviceIndex], odq, &retVal);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -66,7 +66,7 @@ TEST_F(clCreateImageTest, GivenNullHostPtrWhenCreatingImageThenImageIsCreatedAnd
}
HWTEST_F(clCreateImageTest, GivenDeviceThatDoesntSupportImagesWhenCreatingTiledImageThenInvalidOperationErrorIsReturned) {
auto device = static_cast<MockDevice *>(pContext->getDevice(0));
auto device = static_cast<MockDevice *>(&pContext->getDevice(0)->getDevice());
device->deviceInfo.imageSupport = CL_FALSE;
cl_bool imageSupportInfo = CL_TRUE;
auto status = clGetDeviceInfo(devices[testedRootDeviceIndex], CL_DEVICE_IMAGE_SUPPORT, sizeof(imageSupportInfo), &imageSupportInfo, nullptr);
@@ -93,7 +93,7 @@ HWTEST_F(clCreateImageTest, GivenDeviceThatDoesntSupportImagesWhenCreatingTiledI
}
HWTEST_F(clCreateImageTest, GivenDeviceThatDoesntSupportImagesWhenCreatingNonTiledImageThenCreate) {
auto device = static_cast<MockDevice *>(pContext->getDevice(0));
auto device = static_cast<MockDevice *>(&pContext->getDevice(0)->getDevice());
device->deviceInfo.imageSupport = CL_FALSE;
cl_bool imageSupportInfo = CL_TRUE;
auto status = clGetDeviceInfo(devices[testedRootDeviceIndex], CL_DEVICE_IMAGE_SUPPORT, sizeof(imageSupportInfo), &imageSupportInfo, nullptr);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -23,9 +23,9 @@ struct clCreatePerfCountersCommandQueueINTELTests : public DeviceInstrumentation
PerformanceCountersDeviceFixture::SetUp();
DeviceInstrumentationFixture::SetUp(true);
clDevice = device.get();
deviceId = device.get();
retVal = CL_SUCCESS;
context = std::unique_ptr<Context>(Context::create<MockContext>(nullptr, DeviceVector(&clDevice, 1),
context = std::unique_ptr<Context>(Context::create<MockContext>(nullptr, ClDeviceVector(&deviceId, 1),
nullptr, nullptr, retVal));
}
void TearDown() override {
@@ -33,7 +33,7 @@ struct clCreatePerfCountersCommandQueueINTELTests : public DeviceInstrumentation
}
std::unique_ptr<Context> context;
cl_device_id clDevice;
cl_device_id deviceId;
cl_int retVal;
};
@@ -44,7 +44,7 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenCorrectParamatersWhenCre
cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE;
cl_uint configuration = 0;
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal);
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), deviceId, properties, configuration, &retVal);
ASSERT_NE(nullptr, cmdQ);
ASSERT_EQ(CL_SUCCESS, retVal);
@@ -60,7 +60,7 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenNullPropertiesWhenCreati
cl_queue_properties properties = 0;
cl_uint configuration = 0;
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal);
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), deviceId, properties, configuration, &retVal);
ASSERT_EQ(nullptr, cmdQ);
ASSERT_EQ(CL_INVALID_QUEUE_PROPERTIES, retVal);
@@ -71,12 +71,12 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenClQueueOnDevicePropertyW
cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_ON_DEVICE;
cl_uint configuration = 0;
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal);
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), deviceId, properties, configuration, &retVal);
ASSERT_EQ(nullptr, cmdQ);
ASSERT_EQ(CL_INVALID_QUEUE_PROPERTIES, retVal);
properties = CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_ON_DEVICE_DEFAULT;
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal);
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), deviceId, properties, configuration, &retVal);
ASSERT_EQ(nullptr, cmdQ);
ASSERT_EQ(CL_INVALID_QUEUE_PROPERTIES, retVal);
@@ -87,7 +87,7 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenNullContextWhenCreatingP
cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE;
cl_uint configuration = 0;
cmdQ = clCreatePerfCountersCommandQueueINTEL(nullptr, clDevice, properties, configuration, &retVal);
cmdQ = clCreatePerfCountersCommandQueueINTEL(nullptr, deviceId, properties, configuration, &retVal);
ASSERT_EQ(nullptr, cmdQ);
ASSERT_EQ(CL_INVALID_CONTEXT, retVal);
@@ -98,7 +98,7 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenMaximumGtdiConfiguration
cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE;
cl_uint configuration = 4;
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal);
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), deviceId, properties, configuration, &retVal);
ASSERT_EQ(nullptr, cmdQ);
ASSERT_EQ(CL_INVALID_OPERATION, retVal);
@@ -109,7 +109,7 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenCorrectCmdQWhenEventIsCr
cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE;
cl_uint configuration = 0;
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal);
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), deviceId, properties, configuration, &retVal);
ASSERT_NE(nullptr, cmdQ);
ASSERT_EQ(CL_SUCCESS, retVal);
@@ -129,7 +129,7 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenInstrumentationEnabledIs
cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE;
cl_uint configuration = 0;
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal);
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), deviceId, properties, configuration, &retVal);
ASSERT_EQ(nullptr, cmdQ);
EXPECT_EQ(CL_INVALID_DEVICE, retVal);
}
@@ -150,7 +150,7 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenInvalidMetricsLibraryWhe
cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE;
cl_uint configuration = 0;
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal);
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), deviceId, properties, configuration, &retVal);
auto commandQueueObject = castToObject<CommandQueue>(cmdQ);
ASSERT_NE(nullptr, cmdQ);
ASSERT_EQ(CL_SUCCESS, retVal);
@@ -174,7 +174,7 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, givenInvalidMetricsLibraryWhe
auto metricsLibary = static_cast<MockMetricsLibrary *>(performanceCounters->getMetricsLibraryInterface());
metricsLibary->validOpen = false;
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal);
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), deviceId, properties, configuration, &retVal);
EXPECT_EQ(nullptr, cmdQ);
EXPECT_EQ(CL_OUT_OF_RESOURCES, retVal);
}

View File

@@ -167,14 +167,14 @@ TEST(clCreatePipeTest, givenPlatformWithoutDevicesWhenClCreatePipeIsCalledThenDe
auto executionEnvironment = platform()->peekExecutionEnvironment();
executionEnvironment->initializeMemoryManager();
executionEnvironment->prepareRootDeviceEnvironments(1);
auto device = std::unique_ptr<Device>(Device::create<RootDevice>(executionEnvironment, 0u));
auto device = std::make_unique<ClDevice>(*Device::create<RootDevice>(executionEnvironment, 0u));
const DeviceInfo &devInfo = device->getDeviceInfo();
if (devInfo.svmCapabilities == 0) {
GTEST_SKIP();
}
cl_device_id clDevice = device.get();
cl_int retVal;
auto context = ReleaseableObjectPtr<Context>(Context::create<Context>(nullptr, DeviceVector(&clDevice, 1), nullptr, nullptr, retVal));
auto context = ReleaseableObjectPtr<Context>(Context::create<Context>(nullptr, ClDeviceVector(&clDevice, 1), nullptr, nullptr, retVal));
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(0u, platform()->getNumDevices());

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -23,10 +23,14 @@ typedef api_tests clCreateProgramWithBuiltInKernelsTests;
struct clCreateProgramWithBuiltInVmeKernelsTests : clCreateProgramWithBuiltInKernelsTests {
void SetUp() override {
clCreateProgramWithBuiltInKernelsTests::SetUp();
if (!castToObject<Device>(devices[testedRootDeviceIndex])->getHardwareInfo().capabilityTable.supportsVme) {
if (!castToObject<ClDevice>(devices[testedRootDeviceIndex])->getHardwareInfo().capabilityTable.supportsVme) {
GTEST_SKIP();
}
pDev = &pContext->getDevice(0)->getDevice();
}
Device *pDev;
};
namespace ULT {
@@ -80,7 +84,6 @@ TEST_F(clCreateProgramWithBuiltInKernelsTests, GivenNoKernelsAndNoReturnWhenCrea
TEST_F(clCreateProgramWithBuiltInVmeKernelsTests, GivenValidMediaKernelsWhenCreatingProgramWithBuiltInKernelsThenProgramIsSuccessfullyCreated) {
cl_int retVal = CL_SUCCESS;
auto pDev = pContext->getDevice(0);
overwriteBuiltInBinaryName(pDev, "media_kernels_frontend");
const char *kernelNamesString = {
@@ -124,7 +127,6 @@ TEST_F(clCreateProgramWithBuiltInVmeKernelsTests, GivenValidMediaKernelsWhenCrea
TEST_F(clCreateProgramWithBuiltInVmeKernelsTests, GivenValidMediaKernelsWithOptionsWhenCreatingProgramWithBuiltInKernelsThenProgramIsSuccessfullyCreatedWithThoseOptions) {
cl_int retVal = CL_SUCCESS;
auto pDev = pContext->getDevice(0);
overwriteBuiltInBinaryName(pDev, "media_kernels_frontend");
const char *kernelNamesString = {
@@ -150,8 +152,6 @@ TEST_F(clCreateProgramWithBuiltInVmeKernelsTests, GivenValidMediaKernelsWithOpti
TEST_F(clCreateProgramWithBuiltInVmeKernelsTests, GivenVmeBlockMotionEstimateKernelWhenCreatingProgramWithBuiltInKernelsThenCorrectDispatchBuilderAndFrontendKernelIsCreated) {
cl_int retVal = CL_SUCCESS;
auto pDev = pContext->getDevice(0);
overwriteBuiltInBinaryName(pDev, "media_kernels_backend");
pDev->getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(EBuiltInOps::VmeBlockMotionEstimateIntel, *pContext, *pDev);
restoreBuiltInBinaryName(pDev);
@@ -179,7 +179,7 @@ TEST_F(clCreateProgramWithBuiltInVmeKernelsTests, GivenVmeBlockMotionEstimateKer
EXPECT_EQ(6U, kernNeo->getKernelArgsNumber());
auto ctxNeo = castToObject<Context>(pContext);
auto &vmeBuilder = pDev->getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(NEO::EBuiltInOps::VmeBlockMotionEstimateIntel, *ctxNeo, *ctxNeo->getDevice(0));
auto &vmeBuilder = pDev->getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(NEO::EBuiltInOps::VmeBlockMotionEstimateIntel, *ctxNeo, ctxNeo->getDevice(0)->getDevice());
EXPECT_EQ(&vmeBuilder, kernNeo->getKernelInfo().builtinDispatchBuilder);
clReleaseKernel(kernel);
@@ -189,8 +189,6 @@ TEST_F(clCreateProgramWithBuiltInVmeKernelsTests, GivenVmeBlockMotionEstimateKer
TEST_F(clCreateProgramWithBuiltInVmeKernelsTests, GivenVmeBlockAdvancedMotionEstimateKernelWhenCreatingProgramWithBuiltInKernelsThenCorrectDispatchBuilderAndFrontendKernelIsCreated) {
cl_int retVal = CL_SUCCESS;
auto pDev = pContext->getDevice(0);
overwriteBuiltInBinaryName(pDev, "media_kernels_backend");
pDev->getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(EBuiltInOps::VmeBlockAdvancedMotionEstimateCheckIntel, *pContext, *pDev);
restoreBuiltInBinaryName(pDev);
@@ -218,7 +216,7 @@ TEST_F(clCreateProgramWithBuiltInVmeKernelsTests, GivenVmeBlockAdvancedMotionEst
EXPECT_EQ(15U, kernNeo->getKernelArgsNumber());
auto ctxNeo = castToObject<Context>(pContext);
auto &vmeBuilder = pDev->getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(NEO::EBuiltInOps::VmeBlockAdvancedMotionEstimateCheckIntel, *ctxNeo, *ctxNeo->getDevice(0));
auto &vmeBuilder = pDev->getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(NEO::EBuiltInOps::VmeBlockAdvancedMotionEstimateCheckIntel, *ctxNeo, ctxNeo->getDevice(0)->getDevice());
EXPECT_EQ(&vmeBuilder, kernNeo->getKernelInfo().builtinDispatchBuilder);
clReleaseKernel(kernel);
@@ -228,8 +226,6 @@ TEST_F(clCreateProgramWithBuiltInVmeKernelsTests, GivenVmeBlockAdvancedMotionEst
TEST_F(clCreateProgramWithBuiltInVmeKernelsTests, GivenVmeBlockAdvancedMotionEstimateBidirectionalCheckKernelWhenCreatingProgramWithBuiltInKernelsThenCorrectDispatchBuilderAndFrontendKernelIsCreated) {
cl_int retVal = CL_SUCCESS;
auto pDev = pContext->getDevice(0);
overwriteBuiltInBinaryName(pDev, "media_kernels_backend");
pDev->getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(EBuiltInOps::VmeBlockAdvancedMotionEstimateBidirectionalCheckIntel, *pContext, *pDev);
restoreBuiltInBinaryName(pDev);
@@ -257,7 +253,7 @@ TEST_F(clCreateProgramWithBuiltInVmeKernelsTests, GivenVmeBlockAdvancedMotionEst
EXPECT_EQ(20U, kernNeo->getKernelArgsNumber());
auto ctxNeo = castToObject<Context>(pContext);
auto &vmeBuilder = pDev->getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(NEO::EBuiltInOps::VmeBlockAdvancedMotionEstimateBidirectionalCheckIntel, *ctxNeo, *ctxNeo->getDevice(0));
auto &vmeBuilder = pDev->getExecutionEnvironment()->getBuiltIns()->getBuiltinDispatchInfoBuilder(NEO::EBuiltInOps::VmeBlockAdvancedMotionEstimateBidirectionalCheckIntel, *ctxNeo, ctxNeo->getDevice(0)->getDevice());
EXPECT_EQ(&vmeBuilder, kernNeo->getKernelInfo().builtinDispatchBuilder);
clReleaseKernel(kernel);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -19,7 +19,7 @@ namespace ULT {
struct clCreateSubDevicesTests : ::testing::Test {
DebugManagerStateRestore restorer;
VariableBackup<bool> mockDeviceCreateSingleDeviceBackup{&MockDevice::createSingleDevice};
std::unique_ptr<MockDevice> device;
std::unique_ptr<MockClDevice> device;
cl_device_partition_property properties[3] = {CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, CL_DEVICE_AFFINITY_DOMAIN_NUMA, 0};
cl_uint outDevicesCount = 2;
cl_device_id outDevices[2];
@@ -27,7 +27,7 @@ struct clCreateSubDevicesTests : ::testing::Test {
void setup(int numberOfDevices) {
DebugManager.flags.CreateMultipleSubDevices.set(numberOfDevices);
mockDeviceCreateSingleDeviceBackup = (numberOfDevices == 1);
device.reset(MockDevice::createWithNewExecutionEnvironment<MockDevice>(*platformDevices));
device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(*platformDevices));
}
};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -66,7 +66,7 @@ TEST_F(clGetDeviceAndHostTimerTest, GivenValidOSTimeWhenGettingDeviceAndHostTime
cl_ulong host_timestamp = 0;
cl_ulong zero_timestamp = 0;
auto mDev = MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr);
auto mDev = new MockClDevice{MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr)};
mDev->setOSTime(new MockOSTime());
retVal = clGetDeviceAndHostTimer(
@@ -86,7 +86,7 @@ TEST_F(clGetDeviceAndHostTimerTest, GivenInvalidOSTimeWhenGettingDeviceAndHostTi
cl_ulong host_timestamp = 0;
cl_ulong zero_timestamp = 0;
auto mDev = MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr);
auto mDev = new MockClDevice{MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr)};
mDev->setOSTime(new FailOSTime());
retVal = clGetDeviceAndHostTimer(
@@ -135,7 +135,7 @@ TEST_F(clGetHostTimerTest, GivenValidOSTimeWhenGettingHostTimerThenSuccessIsRetu
cl_ulong host_timestamp = 0;
cl_ulong zero_timestamp = 0;
auto mDev = MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr);
auto mDev = new MockClDevice{MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr)};
mDev->setOSTime(new MockOSTime());
retVal = clGetHostTimer(
@@ -152,7 +152,7 @@ TEST_F(clGetHostTimerTest, GivenInvalidOSTimeWhenGettingHostTimerThenOutOfResour
cl_ulong host_timestamp = 0;
cl_ulong zero_timestamp = 0;
auto mDev = MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr);
auto mDev = new MockClDevice{MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr)};
mDev->setOSTime(new FailOSTime());
retVal = clGetHostTimer(

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -114,7 +114,7 @@ TEST(clGetDeviceIDsTest, givenMultipleRootDevicesWhenGetDeviceIdsThenAllRootDevi
EXPECT_EQ(retVal, CL_SUCCESS);
EXPECT_EQ(numEntries, numDevices);
for (auto i = 0u; i < numRootDevices; i++) {
EXPECT_EQ(devices[i], platform()->getDevice(i));
EXPECT_EQ(devices[i], platform()->getClDevice(i));
}
}
TEST(clGetDeviceIDsTest, givenMultipleRootDevicesWhenGetDeviceIdsButNumEntriesIsLowerThanNumDevicesThenSubsetOfRootDevicesIsReturned) {
@@ -141,7 +141,7 @@ TEST(clGetDeviceIDsTest, givenMultipleRootDevicesWhenGetDeviceIdsButNumEntriesIs
EXPECT_LT(numDevices, maxNumDevices);
EXPECT_EQ(numEntries, numDevices);
for (auto i = 0u; i < numEntries; i++) {
EXPECT_EQ(devices[i], platform()->getDevice(i));
EXPECT_EQ(devices[i], platform()->getClDevice(i));
}
EXPECT_EQ(devices[numEntries], dummyDevice);
}
@@ -166,7 +166,7 @@ TEST(clGetDeviceIDsTest, givenMultipleRootDevicesAndLimitedNumberOfReturnedDevic
EXPECT_EQ(retVal, CL_SUCCESS);
EXPECT_EQ(numEntries - 1, numDevices);
for (auto i = 0u; i < numDevices; i++) {
EXPECT_EQ(devices[i], platform()->getDevice(i));
EXPECT_EQ(devices[i], platform()->getClDevice(i));
}
EXPECT_EQ(devices[numDevices], dummyDevice);
}

View File

@@ -191,7 +191,7 @@ TEST_F(clGetDeviceInfoTests, GivenClDeviceExtensionsParamWhenGettingDeviceInfoTh
TEST_F(clGetDeviceInfoTests, GivenClDeviceIlVersionParamAndOcl21WhenGettingDeviceInfoThenSpirv12IsReturned) {
size_t paramRetSize = 0;
Device *pDevice = castToObject<Device>(devices[testedRootDeviceIndex]);
ClDevice *pDevice = castToObject<ClDevice>(devices[testedRootDeviceIndex]);
if (pDevice->getSupportedClVersion() < 21)
return;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -258,9 +258,9 @@ class clEventProfilingWithPerfCountersTests : public DeviceInstrumentationFixtur
PerformanceCountersDeviceFixture::SetUp();
DeviceInstrumentationFixture::SetUp(true);
cl_device_id clDevice = device.get();
cl_device_id deviceId = device.get();
cl_int retVal = CL_SUCCESS;
context = std::unique_ptr<Context>(Context::create<MockContext>(nullptr, DeviceVector(&clDevice, 1),
context = std::unique_ptr<Context>(Context::create<MockContext>(nullptr, ClDeviceVector(&deviceId, 1),
nullptr, nullptr, retVal));
commandQueue = std::make_unique<CommandQueue>(context.get(), device.get(), nullptr);
event = std::make_unique<Event>(commandQueue.get(), 0, 0, 0);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -79,7 +79,7 @@ TEST_P(KernelSubGroupInfoKhrReturnSizeTest, GivenLwsParameterWhenGettingMaxSubGr
retVal = clGetKernelSubGroupInfoKHR(
pKernel,
pDevice,
pClDevice,
CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE,
sizeof(size_t) * 3,
inputValue,
@@ -112,7 +112,7 @@ TEST_P(KernelSubGroupInfoKhrReturnCountTest, GivenLwsParameterWhenGettingSubGrou
retVal = clGetKernelSubGroupInfoKHR(
pKernel,
pDevice,
pClDevice,
CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE,
sizeof(size_t) * 3,
inputValue,
@@ -136,7 +136,7 @@ TEST_F(KernelSubGroupInfoKhrReturnCompileSizeTest, GivenKernelWhenGettingRequire
retVal = clGetKernelSubGroupInfoKHR(
pKernel,
pDevice,
pClDevice,
CL_KERNEL_COMPILE_SUB_GROUP_SIZE_INTEL,
0,
nullptr,
@@ -162,7 +162,7 @@ TEST_F(KernelSubGroupInfoKhrReturnCompileSizeTest, GivenKernelWhenGettingRequire
TEST_F(KernelSubGroupInfoKhrTest, GivenNullKernelWhenGettingKernelSubGroupInfoThenInvalidKernelErrorIsReturned) {
retVal = clGetKernelSubGroupInfoKHR(
nullptr,
pDevice,
pClDevice,
0,
0,
nullptr,
@@ -190,7 +190,7 @@ TEST_F(KernelSubGroupInfoKhrTest, GivenNullDeviceWhenGettingKernelSubGroupInfoTh
TEST_F(KernelSubGroupInfoKhrTest, GivenInvalidParamNameWhenGettingKernelSubGroupInfoThenInvalidValueErrorIsReturned) {
retVal = clGetKernelSubGroupInfoKHR(
pKernel,
pDevice,
pClDevice,
0,
sizeof(size_t),
inputValue,
@@ -215,7 +215,7 @@ TEST_P(KernelSubGroupInfoKhrInputParamsTest, GivenInvalidInputWhenGettingKernelS
// work dim == 0
retVal = clGetKernelSubGroupInfoKHR(
pKernel,
pDevice,
pClDevice,
GetParam(),
0,
inputValue,
@@ -228,7 +228,7 @@ TEST_P(KernelSubGroupInfoKhrInputParamsTest, GivenInvalidInputWhenGettingKernelS
// work dim % sizeof(size_t) != 0
retVal = clGetKernelSubGroupInfoKHR(
pKernel,
pDevice,
pClDevice,
GetParam(),
(sizeof(size_t) * MaxWorkDim) - 1,
inputValue,
@@ -241,7 +241,7 @@ TEST_P(KernelSubGroupInfoKhrInputParamsTest, GivenInvalidInputWhenGettingKernelS
// work dim > MaxWorkDim
retVal = clGetKernelSubGroupInfoKHR(
pKernel,
pDevice,
pClDevice,
GetParam(),
sizeof(size_t) * (MaxWorkDim + 1),
inputValue,
@@ -254,7 +254,7 @@ TEST_P(KernelSubGroupInfoKhrInputParamsTest, GivenInvalidInputWhenGettingKernelS
// null input_value
retVal = clGetKernelSubGroupInfoKHR(
pKernel,
pDevice,
pClDevice,
GetParam(),
sizeof(size_t) * (MaxWorkDim),
nullptr,
@@ -269,7 +269,7 @@ TEST_P(KernelSubGroupInfoKhrInputParamsTest, GivenInvalidParamSizeWhenGettingKer
//param_value_size < sizeof(size_t)
retVal = clGetKernelSubGroupInfoKHR(
pKernel,
pDevice,
pClDevice,
GetParam(),
sizeof(size_t),
inputValue,
@@ -283,7 +283,7 @@ TEST_P(KernelSubGroupInfoKhrInputParamsTest, GivenInvalidParamSizeWhenGettingKer
TEST_P(KernelSubGroupInfoKhrInputParamsTest, GivenNoReturnPointerWhenGettingKernelSubGroupInfoThenSuccessIsReturned) {
retVal = clGetKernelSubGroupInfoKHR(
pKernel,
pDevice,
pClDevice,
GetParam(),
sizeof(size_t),
inputValue,

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -108,7 +108,7 @@ TEST_P(KernelSubGroupInfoReturnSizeTest, GivenWorkGroupSizeWhenGettingMaxSubGrou
retVal = clGetKernelSubGroupInfo(
pKernel,
pDevice,
pClDevice,
CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE,
sizeof(size_t) * workDim,
inputValue,
@@ -162,7 +162,7 @@ TEST_P(KernelSubGroupInfoReturnCountTest, GivenWorkGroupSizeWhenGettingSubGroupC
retVal = clGetKernelSubGroupInfo(
pKernel,
pDevice,
pClDevice,
CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE,
sizeof(size_t) * workDim,
inputValue,
@@ -210,7 +210,7 @@ TEST_P(KernelSubGroupInfoReturnLocalSizeTest, GivenWorkGroupSizeWhenGettingLocal
retVal = clGetKernelSubGroupInfo(
pKernel,
pDevice,
pClDevice,
CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT,
sizeof(size_t),
inputValue,
@@ -243,7 +243,7 @@ TEST_F(KernelSubGroupInfoReturnMaxNumberTest, GivenWorkGroupSizeWhenGettingMaxNu
if (std::string(pDevice->getDeviceInfo().clVersion).find("OpenCL 2.1") != std::string::npos) {
retVal = clGetKernelSubGroupInfo(
pKernel,
pDevice,
pClDevice,
CL_KERNEL_MAX_NUM_SUB_GROUPS,
0,
nullptr,
@@ -263,7 +263,7 @@ TEST_F(KernelSubGroupInfoReturnCompileNumberTest, GivenKernelWhenGettingCompileN
if (std::string(pDevice->getDeviceInfo().clVersion).find("OpenCL 2.1") != std::string::npos) {
retVal = clGetKernelSubGroupInfo(
pKernel,
pDevice,
pClDevice,
CL_KERNEL_COMPILE_NUM_SUB_GROUPS,
0,
nullptr,
@@ -283,7 +283,7 @@ TEST_F(KernelSubGroupInfoReturnCompileSizeTest, GivenKernelWhenGettingCompileSub
if (std::string(pDevice->getDeviceInfo().clVersion).find("OpenCL 2.1") != std::string::npos) {
retVal = clGetKernelSubGroupInfo(
pKernel,
pDevice,
pClDevice,
CL_KERNEL_COMPILE_SUB_GROUP_SIZE_INTEL,
0,
nullptr,
@@ -311,7 +311,7 @@ TEST_F(KernelSubGroupInfoTest, GivenNullKernelWhenGettingSubGroupInfoThenInvalid
if (std::string(pDevice->getDeviceInfo().clVersion).find("OpenCL 2.1") != std::string::npos) {
retVal = clGetKernelSubGroupInfo(
nullptr,
pDevice,
pClDevice,
0,
0,
nullptr,
@@ -343,7 +343,7 @@ TEST_F(KernelSubGroupInfoTest, GivenInvalidParamNameWhenGettingSubGroupInfoThenI
if (std::string(pDevice->getDeviceInfo().clVersion).find("OpenCL 2.1") != std::string::npos) {
retVal = clGetKernelSubGroupInfo(
pKernel,
pDevice,
pClDevice,
0,
sizeof(size_t),
inputValue,
@@ -379,7 +379,7 @@ TEST_P(KernelSubGroupInfoInputParamsTest, GivenOpenClVersionLowerThan21WhenGetti
retVal = clGetKernelSubGroupInfo(
pKernel,
pDevice,
pClDevice,
GetParam(),
0,
nullptr,
@@ -402,7 +402,7 @@ TEST_P(KernelSubGroupInfoInputParamsTest, GivenWorkDimZeroWhenGettingSubGroupInf
retVal = clGetKernelSubGroupInfo(
pKernel,
pDevice,
pClDevice,
GetParam(),
0,
inputValue,
@@ -426,7 +426,7 @@ TEST_P(KernelSubGroupInfoInputParamsTest, GivenIndivisibleWorkDimWhenGettingSubG
retVal = clGetKernelSubGroupInfo(
pKernel,
pDevice,
pClDevice,
GetParam(),
(sizeof(size_t) * workDim) - 1,
inputValue,
@@ -450,7 +450,7 @@ TEST_P(KernelSubGroupInfoInputParamsTest, GivenWorkDimGreaterThanMaxWorkDimWhenG
retVal = clGetKernelSubGroupInfo(
pKernel,
pDevice,
pClDevice,
GetParam(),
sizeof(size_t) * (workDim + 1),
inputValue,
@@ -474,7 +474,7 @@ TEST_P(KernelSubGroupInfoInputParamsTest, GivenInputValueIsNullWhenGettingSubGro
retVal = clGetKernelSubGroupInfo(
pKernel,
pDevice,
pClDevice,
GetParam(),
sizeof(size_t) * (workDim),
nullptr,
@@ -491,7 +491,7 @@ TEST_P(KernelSubGroupInfoInputParamsTest, GivenParamValueSizeZeroWhenGettingSubG
retVal = clGetKernelSubGroupInfo(
pKernel,
pDevice,
pClDevice,
GetParam(),
sizeof(size_t),
inputValue,
@@ -509,7 +509,7 @@ TEST_P(KernelSubGroupInfoInputParamsTest, GivenUnalignedParamValueSizeWhenGettin
retVal = clGetKernelSubGroupInfo(
pKernel,
pDevice,
pClDevice,
GetParam(),
sizeof(size_t),
inputValue,
@@ -529,7 +529,7 @@ TEST_P(KernelSubGroupInfoInputParamsTest, GivenTooLargeParamValueSizeWhenGetting
// paramValue size / sizeof(size_t) > MaxWorkDim
retVal = clGetKernelSubGroupInfo(
pKernel,
pDevice,
pClDevice,
GetParam(),
sizeof(size_t),
inputValue,
@@ -547,7 +547,7 @@ TEST_P(KernelSubGroupInfoInputParamsTest, GivenNullPtrForReturnWhenGettingKernel
retVal = clGetKernelSubGroupInfo(
pKernel,
pDevice,
pClDevice,
GetParam(),
sizeof(size_t),
inputValue,

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -100,7 +100,7 @@ TEST_P(clGetKernelWorkGroupInfoTests, GivenValidParametersWhenGettingKernelWorkG
TEST_F(clGetKernelWorkGroupInfoTests, GivenKernelRequiringScratchSpaceWhenGettingKernelWorkGroupInfoThenCorrectSpillMemSizeIsReturned) {
size_t paramValueSizeRet;
cl_ulong param_value;
auto pDevice = castToObject<Device>(devices[testedRootDeviceIndex]);
auto pDevice = castToObject<ClDevice>(devices[testedRootDeviceIndex]);
MockKernelWithInternals mockKernel(*pDevice);
SPatchMediaVFEState mediaVFEstate;
@@ -126,7 +126,7 @@ TEST_F(clGetKernelWorkGroupInfoTests, GivenKernelRequiringScratchSpaceWhenGettin
TEST_F(clGetKernelWorkGroupInfoTests, givenKernelHavingPrivateMemoryAllocationWhenAskedForPrivateAllocationSizeThenProperSizeIsReturned) {
size_t paramValueSizeRet;
cl_ulong param_value;
auto pDevice = castToObject<Device>(devices[testedRootDeviceIndex]);
auto pDevice = castToObject<ClDevice>(devices[testedRootDeviceIndex]);
MockKernelWithInternals mockKernel(*pDevice);
SPatchAllocateStatelessPrivateSurface privateAllocation;
@@ -149,7 +149,7 @@ TEST_F(clGetKernelWorkGroupInfoTests, givenKernelHavingPrivateMemoryAllocationWh
TEST_F(clGetKernelWorkGroupInfoTests, givenKernelNotHavingPrivateMemoryAllocationWhenAskedForPrivateAllocationSizeThenZeroIsReturned) {
size_t paramValueSizeRet;
cl_ulong param_value;
auto pDevice = castToObject<Device>(devices[testedRootDeviceIndex]);
auto pDevice = castToObject<ClDevice>(devices[testedRootDeviceIndex]);
MockKernelWithInternals mockKernel(*pDevice);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -160,7 +160,7 @@ TEST_F(clGetPlatformInfoTests, GivenInvalidParamSizeWhenGettingPlatformInfoStrin
TEST_F(clGetPlatformInfoTests, GivenDeviceWhenGettingIcdDispatchTableThenDeviceAndPlatformTablesMatch) {
EXPECT_NE(pPlatform->dispatch.icdDispatch, nullptr);
for (size_t deviceOrdinal = 0; deviceOrdinal < pPlatform->getNumDevices(); ++deviceOrdinal) {
auto device = pPlatform->getDevice(deviceOrdinal);
auto device = pPlatform->getClDevice(deviceOrdinal);
ASSERT_NE(nullptr, device);
EXPECT_EQ(pPlatform->dispatch.icdDispatch, device->dispatch.icdDispatch);
}

View File

@@ -52,10 +52,10 @@ TEST_F(clGetSupportedImageFormatsTests, givenInvalidContextWhenGettingSupportIma
TEST(clGetSupportedImageFormatsTest, givenPlatforNotSupportingImageWhenGettingSupportImageFormatsThenClInvalidValueIsReturned) {
HardwareInfo hwInfo = *platformDevices[0];
hwInfo.capabilityTable.supportsImages = false;
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
cl_device_id clDevice = device.get();
cl_int retVal;
auto context = ReleaseableObjectPtr<Context>(Context::create<Context>(nullptr, DeviceVector(&clDevice, 1), nullptr, nullptr, retVal));
auto context = ReleaseableObjectPtr<Context>(Context::create<Context>(nullptr, ClDeviceVector(&clDevice, 1), nullptr, nullptr, retVal));
EXPECT_EQ(CL_SUCCESS, retVal);
cl_uint numImageFormats = 0;
@@ -74,14 +74,14 @@ TEST(clGetSupportedImageFormatsTest, givenPlatformWithoutDevicesWhenClGetSupport
auto executionEnvironment = platform()->peekExecutionEnvironment();
executionEnvironment->initializeMemoryManager();
executionEnvironment->prepareRootDeviceEnvironments(1);
auto device = std::unique_ptr<Device>(Device::create<RootDevice>(executionEnvironment, 0u));
auto device = std::make_unique<ClDevice>(*Device::create<RootDevice>(executionEnvironment, 0u));
const DeviceInfo &devInfo = device->getDeviceInfo();
if (!devInfo.imageSupport) {
GTEST_SKIP();
}
cl_device_id clDevice = device.get();
cl_int retVal;
auto context = ReleaseableObjectPtr<Context>(Context::create<Context>(nullptr, DeviceVector(&clDevice, 1), nullptr, nullptr, retVal));
auto context = ReleaseableObjectPtr<Context>(Context::create<Context>(nullptr, ClDeviceVector(&clDevice, 1), nullptr, nullptr, retVal));
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(0u, platform()->getNumDevices());

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 Intel Corporation
* Copyright (C) 2019-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -59,7 +59,7 @@ using clMemLocallyUncachedResourceFixture = Test<HelloWorldFixture<HelloWorldFix
HWTEST_F(clMemLocallyUncachedResourceFixture, GivenAtLeastOneLocallyUncacheableResourceWhenSettingKernelArgumentsThenKernelIsUncacheable) {
cl_int retVal = CL_SUCCESS;
MockKernelWithInternals mockKernel(*this->pDevice, context, true);
MockKernelWithInternals mockKernel(*this->pClDevice, context, true);
mockKernel.kernelInfo.usesSsh = true;
mockKernel.kernelInfo.requiresSshForBuffers = true;
@@ -136,7 +136,7 @@ HWTEST_F(clMemLocallyUncachedResourceFixture, GivenAtLeastOneLocallyUncacheableR
HWTEST_F(clMemLocallyUncachedResourceFixture, givenBuffersThatAreUncachedInSurfaceStateWhenStatelessIsProgrammedItIsCached) {
cl_int retVal = CL_SUCCESS;
MockKernelWithInternals mockKernel(*this->pDevice, context, true);
MockKernelWithInternals mockKernel(*this->pClDevice, context, true);
auto kernel = mockKernel.mockKernel;
mockKernel.kernelInfo.usesSsh = true;
mockKernel.kernelInfo.requiresSshForBuffers = true;
@@ -211,7 +211,7 @@ HWTEST_F(clMemLocallyUncachedResourceFixture, givenBuffersThatAreUncachedInSurfa
HWTEST_F(clMemLocallyUncachedResourceFixture, givenBuffersThatAreUncachedButKernelDoesntHaveAnyStatelessAccessessThenSurfacesAreNotRecordedAsUncacheable) {
cl_int retVal = CL_SUCCESS;
MockKernelWithInternals mockKernel(*this->pDevice, context, true);
MockKernelWithInternals mockKernel(*this->pClDevice, context, true);
auto kernel = mockKernel.mockKernel;
mockKernel.kernelInfo.usesSsh = true;
mockKernel.kernelInfo.requiresSshForBuffers = true;
@@ -290,7 +290,7 @@ HWTEST_F(clMemLocallyUncachedResourceFixture, givenBuffersThatAreUncachedButKern
HWTEST_F(clMemLocallyUncachedResourceFixture, WhenUnsettingUncacheableResourceFromKernelThanKernelContinuesToCorrectlySetMocs) {
cl_int retVal = CL_SUCCESS;
MockKernelWithInternals mockKernel(*this->pDevice, context, true);
MockKernelWithInternals mockKernel(*this->pClDevice, context, true);
auto kernel = mockKernel.mockKernel;
mockKernel.kernelInfo.usesSsh = true;
mockKernel.kernelInfo.requiresSshForBuffers = true;
@@ -356,7 +356,7 @@ HWTEST_F(clMemLocallyUncachedResourceFixture, WhenUnsettingUncacheableResourceFr
HWTEST_F(clMemLocallyUncachedResourceFixture, givenBuffersThatAreUncachedInSurfaceStateAndAreNotUsedInStatelessFashionThenThoseResourcesAreNotRegistredAsResourcesForCacheFlush) {
cl_int retVal = CL_SUCCESS;
MockKernelWithInternals mockKernel(*this->pDevice, context, true);
MockKernelWithInternals mockKernel(*this->pClDevice, context, true);
auto kernel = mockKernel.mockKernel;
mockKernel.kernelInfo.usesSsh = true;
mockKernel.kernelInfo.requiresSshForBuffers = true;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -24,7 +24,7 @@ class clReleaseCommandQueueTypeTests : public DeviceHostQueueFixture<T> {};
TYPED_TEST_CASE(clReleaseCommandQueueTypeTests, QueueTypes);
TYPED_TEST(clReleaseCommandQueueTypeTests, GivenValidCmdQueueWhenReleasingCmdQueueThenSucessIsReturned) {
if (std::is_same<TypeParam, DeviceQueue>::value && !castToObject<Device>(this->devices[this->testedRootDeviceIndex])->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) {
if (std::is_same<TypeParam, DeviceQueue>::value && !castToObject<ClDevice>(this->devices[this->testedRootDeviceIndex])->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) {
return;
}
@@ -52,7 +52,7 @@ typedef api_tests clReleaseCommandQueueTests;
TEST_F(clReleaseCommandQueueTests, givenBlockedEnqueueWithOutputEventStoredAsVirtualEventWhenReleasingCmdQueueThenInternalRefCountIsDecrementedAndQueueDeleted) {
cl_command_queue cmdQ = nullptr;
cl_queue_properties properties = 0;
Device *device = (Device *)devices[testedRootDeviceIndex];
ClDevice *device = (ClDevice *)devices[testedRootDeviceIndex];
MockKernelWithInternals kernelInternals(*device, pContext);
Kernel *kernel = kernelInternals.mockKernel;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -19,7 +19,7 @@ class clRetainReleaseCommandQueueTests : public DeviceHostQueueFixture<T> {};
TYPED_TEST_CASE(clRetainReleaseCommandQueueTests, QueueTypes);
TYPED_TEST(clRetainReleaseCommandQueueTests, GivenValidCommandQueueWhenRetainingAndReleasingThenReferenceCountIsUpdatedCorrectly) {
if (std::is_same<TypeParam, DeviceQueue>::value && !castToObject<Device>(this->devices[this->testedRootDeviceIndex])->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) {
if (std::is_same<TypeParam, DeviceQueue>::value && !castToObject<ClDevice>(this->devices[this->testedRootDeviceIndex])->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) {
return;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -61,7 +61,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, clSetDefaultDeviceCommandQueueApiTest, GivenValidPar
CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE,
0,
0};
auto pDevice = castToObject<Device>(devices[testedRootDeviceIndex]);
auto pDevice = castToObject<ClDevice>(devices[testedRootDeviceIndex]);
if (pDevice->getDeviceInfo().maxOnDeviceQueues > 1) {
auto newDeviceQueue = clCreateCommandQueueWithProperties(pContext, devices[testedRootDeviceIndex], properties, &retVal);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -45,7 +45,7 @@ class KernelArgSvmFixture : public ApiFixture, public DeviceFixture {
pKernelInfo->kernelArgInfo[0].typeStr = "char *";
pKernelInfo->kernelArgInfo[0].addressQualifier = CL_KERNEL_ARG_ADDRESS_GLOBAL;
pMockKernel = new MockKernel(pProgram, *pKernelInfo, *this->pDevice);
pMockKernel = new MockKernel(pProgram, *pKernelInfo, *this->pClDevice);
ASSERT_EQ(CL_SUCCESS, pMockKernel->initialize());
pMockKernel->setCrossThreadData(pCrossThreadData, sizeof(pCrossThreadData));
}

View File

@@ -20,7 +20,7 @@ class KernelExecInfoFixture : public ApiFixture {
pKernelInfo = std::make_unique<KernelInfo>();
pMockKernel = new MockKernel(pProgram, *pKernelInfo, *pPlatform->getDevice(0));
pMockKernel = new MockKernel(pProgram, *pKernelInfo, *pPlatform->getClDevice(0));
ASSERT_EQ(CL_SUCCESS, pMockKernel->initialize());
svmCapabilities = pPlatform->getDevice(0)->getDeviceInfo().svmCapabilities;
if (svmCapabilities != 0) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -40,14 +40,15 @@ TEST(clSVMAllocTest, givenPlatformWithoutDevicesWhenClSVMAllocIsCalledThenDevice
auto executionEnvironment = platform()->peekExecutionEnvironment();
executionEnvironment->initializeMemoryManager();
executionEnvironment->prepareRootDeviceEnvironments(1);
auto device = std::unique_ptr<Device>(Device::create<RootDevice>(executionEnvironment, 0u));
auto device = Device::create<RootDevice>(executionEnvironment, 0u);
auto clDevice = std::make_unique<ClDevice>(*device);
const DeviceInfo &devInfo = device->getDeviceInfo();
if (devInfo.svmCapabilities == 0) {
GTEST_SKIP();
}
cl_device_id clDevice = device.get();
cl_device_id deviceId = clDevice.get();
cl_int retVal;
auto context = ReleaseableObjectPtr<Context>(Context::create<Context>(nullptr, DeviceVector(&clDevice, 1), nullptr, nullptr, retVal));
auto context = ReleaseableObjectPtr<Context>(Context::create<Context>(nullptr, ClDeviceVector(&deviceId, 1), nullptr, nullptr, retVal));
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(0u, platform()->getNumDevices());

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -18,7 +18,7 @@ typedef api_tests clGetGLContextInfoKHR_;
namespace ULT {
TEST_F(clGetGLContextInfoKHR_, success) {
auto expectedDevice = ::platform()->getDevice(0);
auto expectedDevice = ::platform()->getClDevice(0);
cl_device_id retDevice = 0;
size_t retSize = 0;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -32,7 +32,7 @@ struct CopyBufferHw
typedef CopyBufferHw AUBCopyBuffer;
HWTEST_P(AUBCopyBuffer, simple) {
MockContext context(&pCmdQ->getDevice());
MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]);
cl_float srcMemory[] = {1.0f, 2.0f, 3.0f, 4.0f};
cl_float dstMemory[] = {0.0f, 0.0f, 0.0f, 0.0f};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -46,7 +46,7 @@ HWTEST_P(AUBCopyBufferRect, simple) {
static const size_t rowPitch = 20;
static const size_t slicePitch = rowPitch * rowPitch;
static const size_t elementCount = slicePitch * rowPitch;
MockContext context(this->pDevice);
MockContext context(this->pClDevice);
cl_uchar *srcMemory = new uint8_t[elementCount + 8];
cl_uchar *dstMemory = new uint8_t[elementCount + 8];

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -31,7 +31,7 @@ struct AUBCopyImage
}
CommandDeviceFixture::SetUp(cl_command_queue_properties(0));
CommandStreamFixture::SetUp(pCmdQ);
context = std::make_unique<MockContext>(pDevice);
context = std::make_unique<MockContext>(pClDevice);
}
void TearDown() override {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -35,7 +35,7 @@ typedef FillBufferHw AUBFillBuffer;
HWTEST_P(AUBFillBuffer, simple) {
cl_float destMemory[] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
auto pDestMemory = &destMemory[0];
MockContext context(&this->pCmdQ->getDevice());
MockContext context(platform()->clDeviceMap[&this->pCmdQ->getDevice()]);
auto retVal = CL_INVALID_VALUE;
auto destBuffer = Buffer::create(
&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};
auto pDestMemory = &destMemory[0];
MockContext context(&this->pCmdQ->getDevice());
MockContext context(platform()->clDeviceMap[&this->pCmdQ->getDevice()]);
auto retVal = CL_INVALID_VALUE;
std::unique_ptr<Buffer> destBuffer(Buffer::create(
&context,

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -97,7 +97,7 @@ struct AubFillImage
CommandDeviceFixture::SetUp(cl_command_queue_properties(0));
CommandStreamFixture::SetUp(pCmdQ);
context = std::make_unique<MockContext>(pDevice);
context = std::make_unique<MockContext>(pClDevice);
}
void TearDown() override {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -26,7 +26,7 @@ struct AUBMapBuffer
};
HWTEST_F(AUBMapBuffer, MapUpdateUnmapVerify) {
MockContext context(&this->pCmdQ->getDevice());
MockContext context(platform()->clDeviceMap[&this->pCmdQ->getDevice()]);
auto retVal = CL_INVALID_VALUE;
size_t bufferSize = 10;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -44,7 +44,7 @@ struct AUBMapImage
CommandDeviceFixture::SetUp(cl_command_queue_properties(0));
CommandStreamFixture::SetUp(pCmdQ);
context = std::make_unique<MockContext>(pDevice);
context = std::make_unique<MockContext>(pClDevice);
}
void TearDown() override {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -36,7 +36,7 @@ struct ReadBufferHw
typedef ReadBufferHw AUBReadBuffer;
HWTEST_P(AUBReadBuffer, simple) {
MockContext context(this->pDevice);
MockContext context(this->pClDevice);
cl_float srcMemory[] = {1.0f, 2.0f, 3.0f, 4.0f};
cl_float destMemory[] = {0.0f, 0.0f, 0.0f, 0.0f};
@@ -112,7 +112,7 @@ HWTEST_F(AUBReadBuffer, reserveCanonicalGpuAddress) {
return;
}
MockContext context(this->pDevice);
MockContext context(this->pClDevice);
cl_float srcMemory[] = {1.0f, 2.0f, 3.0f, 4.0f};
cl_float dstMemory[] = {0.0f, 0.0f, 0.0f, 0.0f};
@@ -171,7 +171,7 @@ struct AUBReadBufferUnaligned
template <typename FamilyType>
void testReadBufferUnaligned(size_t offset, size_t size) {
MockContext context(&pCmdQ->getDevice());
MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]);
char srcMemory[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const auto bufferSize = sizeof(srcMemory);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -34,7 +34,7 @@ typedef ReadBufferRectHw AUBReadBufferRect;
static const size_t width = 10;
HWTEST_P(AUBReadBufferRect, simple3D) {
MockContext context(this->pDevice);
MockContext context(this->pClDevice);
size_t rowPitch = width;
size_t slicePitch = rowPitch * rowPitch;
@@ -127,7 +127,7 @@ struct AUBReadBufferRectUnaligned
template <typename FamilyType>
void testReadBufferUnaligned(size_t offset, size_t size) {
MockContext context(&pCmdQ->getDevice());
MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]);
char srcMemory[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const auto bufferSize = sizeof(srcMemory);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -47,7 +47,7 @@ struct AUBReadImage
CommandDeviceFixture::SetUp(cl_command_queue_properties(0));
CommandStreamFixture::SetUp(pCmdQ);
context = std::make_unique<MockContext>(pDevice);
context = std::make_unique<MockContext>(pClDevice);
}
void TearDown() override {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 Intel Corporation
* Copyright (C) 2019-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -32,7 +32,7 @@ struct AUBImageUnaligned
template <typename FamilyType>
void testReadImageUnaligned(size_t offset, size_t size, size_t pixelSize) {
MockContext context(&pCmdQ->getDevice());
MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]);
char srcMemory[] = "_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnoprstuwxyz";
const auto bufferSize = sizeof(srcMemory) - 1;
@@ -128,7 +128,7 @@ struct AUBImageUnaligned
void testWriteImageUnaligned(size_t offset, size_t size, size_t pixelSize) {
DebugManagerStateRestore restorer;
DebugManager.flags.ForceLinearImages.set(true);
MockContext context(&pCmdQ->getDevice());
MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]);
char srcMemory[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnoprstuwxyz";
const auto bufferSize = sizeof(srcMemory);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -76,7 +76,7 @@ HWTEST_P(VerifyMemoryBufferHw, givenDifferentBuffersWhenValidatingMemoryThenSucc
invalidContent2.get()[offset + itemOffset] = pTestItemWrong2[itemOffset];
}
MockContext context(&this->pCmdQ->getDevice());
MockContext context(platform()->clDeviceMap[&this->pCmdQ->getDevice()]);
cl_int retVal = CL_INVALID_VALUE;
std::unique_ptr<Buffer> buffer(Buffer::create(

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -29,7 +29,7 @@ struct TimestampPacketAubTests : public CommandEnqueueAUBFixture, public ::testi
};
HWTEST_F(TimestampPacketAubTests, givenTwoBatchedEnqueuesWhenDependencyIsResolvedThenDecrementCounterOnGpu) {
MockContext context(&pCmdQ->getDevice());
MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]);
pCommandStreamReceiver->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
const size_t bufferSize = 1024;
@@ -70,7 +70,7 @@ HWTEST_F(TimestampPacketAubTests, givenTwoBatchedEnqueuesWhenDependencyIsResolve
}
HWTEST_F(TimestampPacketAubTests, givenMultipleWalkersWhenEnqueueingThenWriteAllTimestamps) {
MockContext context(&pCmdQ->getDevice());
MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]);
const size_t bufferSize = 70;
const size_t writeSize = bufferSize - 2;
uint8_t writeData[writeSize] = {};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -33,7 +33,7 @@ struct WriteBufferHw
typedef WriteBufferHw AUBWriteBuffer;
HWTEST_P(AUBWriteBuffer, simple) {
MockContext context(&this->pCmdQ->getDevice());
MockContext context(platform()->clDeviceMap[&this->pCmdQ->getDevice()]);
cl_float *srcMemory = new float[1024];
cl_float *destMemory = new float[1024];
@@ -124,7 +124,7 @@ struct AUBWriteBufferUnaligned
template <typename FamilyType>
void testWriteBufferUnaligned(size_t offset, size_t size) {
MockContext context(&pCmdQ->getDevice());
MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]);
char srcMemory[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const auto bufferSize = sizeof(srcMemory);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -35,7 +35,7 @@ typedef WriteBufferRectHw AUBWriteBufferRect;
static const size_t width = 10;
HWTEST_P(AUBWriteBufferRect, simple3D) {
MockContext context(this->pDevice);
MockContext context(this->pClDevice);
size_t rowPitch = width;
size_t slicePitch = rowPitch * rowPitch;
@@ -126,7 +126,7 @@ struct AUBWriteBufferRectUnaligned
template <typename FamilyType>
void testWriteBufferUnaligned(size_t offset, size_t size) {
MockContext context(&pCmdQ->getDevice());
MockContext context(platform()->clDeviceMap[&pCmdQ->getDevice()]);
char srcMemory[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const auto bufferSize = sizeof(srcMemory);

Some files were not shown because too many files have changed in this diff Show More