test: refactor aub tests to use AUBFixture

- AUBCommandStreamFixture derives from AUBFixture

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe 2023-11-22 09:59:08 +00:00 committed by Compute-Runtime-Automation
parent c49a9b9787
commit 24a32b97c8
12 changed files with 121 additions and 205 deletions

View File

@ -20,16 +20,16 @@
using namespace NEO;
struct PostSyncWriteXeHPTests : public HelloWorldFixture<AUBHelloWorldFixtureFactory>, public ::testing::Test {
struct PostSyncWriteXeHPTests : public AUBCommandStreamFixture, public ::testing::Test {
void SetUp() override {
DebugManager.flags.EnableTimestampPacket.set(true);
HelloWorldFixture<AUBHelloWorldFixtureFactory>::setUp();
AUBCommandStreamFixture::setUp();
EXPECT_TRUE(pCommandStreamReceiver->peekTimestampPacketWriteEnabled());
};
void TearDown() override {
HelloWorldFixture<AUBHelloWorldFixtureFactory>::tearDown();
AUBCommandStreamFixture::tearDown();
}
DebugManagerStateRestore restore;
@ -39,7 +39,7 @@ struct PostSyncWriteXeHPTests : public HelloWorldFixture<AUBHelloWorldFixtureFac
HWCMDTEST_F(IGFX_XE_HP_CORE, PostSyncWriteXeHPTests, givenTimestampWriteEnabledWhenEnqueueingThenWritePostsyncOperation) {
const uint32_t bufferSize = 4;
std::unique_ptr<Buffer> buffer(Buffer::create(pContext, CL_MEM_READ_WRITE, bufferSize, nullptr, retVal));
std::unique_ptr<Buffer> buffer(Buffer::create(context, CL_MEM_READ_WRITE, bufferSize, nullptr, retVal));
auto graphicsAllocation = buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex());
memset(graphicsAllocation->getUnderlyingBuffer(), 0, graphicsAllocation->getUnderlyingBufferSize());
buffer->forceDisallowCPUCopy = true;
@ -50,14 +50,14 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, PostSyncWriteXeHPTests, givenTimestampWriteEnabledW
typename FamilyType::TimestampPacketType expectedTimestampValues[4] = {1, 1, 1, 1};
auto tagGpuAddress = reinterpret_cast<void *>(pCmdQ->getTimestampPacketContainer()->peekNodes().at(0)->getGpuAddress());
expectMemoryNotEqual<FamilyType>(tagGpuAddress, expectedTimestampValues, 4 * sizeof(typename FamilyType::TimestampPacketType));
expectNotEqualMemory<FamilyType>(tagGpuAddress, expectedTimestampValues, 4 * sizeof(typename FamilyType::TimestampPacketType));
}
HWCMDTEST_F(IGFX_XE_HP_CORE, PostSyncWriteXeHPTests, givenDebugVariableEnabledWhenEnqueueingThenWritePostsyncOperationInImmWriteMode) {
DebugManager.flags.UseImmDataWriteModeOnPostSyncOperation.set(true);
const uint32_t bufferSize = 4;
std::unique_ptr<Buffer> buffer(Buffer::create(pContext, CL_MEM_READ_WRITE, bufferSize, nullptr, retVal));
std::unique_ptr<Buffer> buffer(Buffer::create(context, CL_MEM_READ_WRITE, bufferSize, nullptr, retVal));
auto graphicsAllocation = buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex());
memset(graphicsAllocation->getUnderlyingBuffer(), 0, graphicsAllocation->getUnderlyingBufferSize());
buffer->forceDisallowCPUCopy = true;
@ -109,10 +109,10 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, PostSyncWriteXeHPTests, givenTwoBatchedEnqueuesWhen
auto endTimestampAddress2 = TimestampPacketHelper::getGlobalEndGpuAddress(*node1);
auto endTimestampAddress3 = TimestampPacketHelper::getContextEndGpuAddress(*node2);
auto endTimestampAddress4 = TimestampPacketHelper::getGlobalEndGpuAddress(*node2);
expectMemoryNotEqual<FamilyType>(reinterpret_cast<void *>(endTimestampAddress1), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType));
expectMemoryNotEqual<FamilyType>(reinterpret_cast<void *>(endTimestampAddress2), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType));
expectMemoryNotEqual<FamilyType>(reinterpret_cast<void *>(endTimestampAddress3), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType));
expectMemoryNotEqual<FamilyType>(reinterpret_cast<void *>(endTimestampAddress4), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType));
expectNotEqualMemory<FamilyType>(reinterpret_cast<void *>(endTimestampAddress1), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType));
expectNotEqualMemory<FamilyType>(reinterpret_cast<void *>(endTimestampAddress2), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType));
expectNotEqualMemory<FamilyType>(reinterpret_cast<void *>(endTimestampAddress3), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType));
expectNotEqualMemory<FamilyType>(reinterpret_cast<void *>(endTimestampAddress4), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType));
clReleaseEvent(outEvent1);
clReleaseEvent(outEvent2);
@ -140,10 +140,10 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, PostSyncWriteXeHPTests, givenMultipleWalkersWhenEnq
auto endTimestampAddress2 = TimestampPacketHelper::getGlobalEndGpuAddress(*timestampNodes[0]);
auto endTimestampAddress3 = TimestampPacketHelper::getContextEndGpuAddress(*timestampNodes[1]);
auto endTimestampAddress4 = TimestampPacketHelper::getGlobalEndGpuAddress(*timestampNodes[1]);
expectMemoryNotEqual<FamilyType>(reinterpret_cast<void *>(endTimestampAddress1), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType));
expectMemoryNotEqual<FamilyType>(reinterpret_cast<void *>(endTimestampAddress2), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType));
expectMemoryNotEqual<FamilyType>(reinterpret_cast<void *>(endTimestampAddress3), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType));
expectMemoryNotEqual<FamilyType>(reinterpret_cast<void *>(endTimestampAddress4), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType));
expectNotEqualMemory<FamilyType>(reinterpret_cast<void *>(endTimestampAddress1), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType));
expectNotEqualMemory<FamilyType>(reinterpret_cast<void *>(endTimestampAddress2), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType));
expectNotEqualMemory<FamilyType>(reinterpret_cast<void *>(endTimestampAddress3), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType));
expectNotEqualMemory<FamilyType>(reinterpret_cast<void *>(endTimestampAddress4), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType));
clReleaseEvent(outEvent);
}

View File

@ -75,8 +75,7 @@ struct FillChannelType {
// clang-format on
struct AubFillImage
: public CommandDeviceFixture,
public AUBCommandStreamFixture,
: public AUBCommandStreamFixture,
public ::testing::WithParamInterface<std::tuple<FillChannelType, uint32_t /*cl_channel_order*/, FillImageParams>>,
public ::testing::Test {
@ -95,24 +94,20 @@ struct AubFillImage
// sRGBA and sBGRA support only unorm int8 type
GTEST_SKIP();
}
CommandDeviceFixture::setUp(cl_command_queue_properties(0));
CommandStreamFixture::setUp(pCmdQ);
context = std::make_unique<MockContext>(pClDevice);
if ((pClDevice->getHardwareInfo().capabilityTable.supportsOcl21Features == false) && (channelOrder == CL_sRGBA || channelOrder == CL_sBGRA)) {
CommandStreamFixture::setUp();
if ((device->getHardwareInfo().capabilityTable.supportsOcl21Features == false) && (channelOrder == CL_sRGBA || channelOrder == CL_sBGRA)) {
GTEST_SKIP();
}
}
void TearDown() override {
image.reset();
context.reset();
CommandStreamFixture::tearDown();
CommandDeviceFixture::tearDown();
}
std::unique_ptr<MockContext> context;
std::unique_ptr<Image> image;
};
@ -183,7 +178,7 @@ HWTEST_P(AubFillImage, WhenFillingThenExpectationsMet) {
cl_mem_flags flags = CL_MEM_READ_ONLY;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
image.reset(Image::create(
context.get(),
context,
ClMemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context->getDevice(0)->getDevice()),
flags,
0,

View File

@ -46,22 +46,73 @@ cl_uint TestSimdTable[] = {
8, 16, 32};
namespace ULT {
struct AUBHelloWorld
: public HelloWorldFixture<AUBHelloWorldFixtureFactory>,
public ClHardwareParse,
public ::testing::Test {
template <typename FixtureFactory>
struct AUBHelloWorldFixture
: public AUBCommandStreamFixture,
public FixtureFactory::KernelFixture,
public FixtureFactory::IndirectHeapFixture,
public ClHardwareParse {
void SetUp() override {
HelloWorldFixture<AUBHelloWorldFixtureFactory>::setUp();
typedef typename FixtureFactory::KernelFixture KernelFixture;
using KernelFixture::pKernel;
void setUp() {
AUBCommandStreamFixture::setUp(nullptr);
ClHardwareParse::setUp();
IndirectHeapFixture::setUp(pCmdQ);
KernelFixture::setUp(device.get(), kernelFilename, kernelName);
ASSERT_NE(nullptr, pKernel);
auto retVal = CL_INVALID_VALUE;
destBuffer = Buffer::create(
context,
CL_MEM_READ_WRITE,
sizeUserMemory,
nullptr,
retVal);
srcBuffer = Buffer::create(
context,
CL_MEM_READ_WRITE,
sizeUserMemory,
nullptr,
retVal);
pDestMemory = destBuffer->getCpuAddressForMapping();
pSrcMemory = srcBuffer->getCpuAddressForMapping();
memset(pDestMemory, destPattern, sizeUserMemory);
memset(pSrcMemory, srcPattern, sizeUserMemory);
pKernel->setArg(0, srcBuffer);
pKernel->setArg(1, destBuffer);
}
void TearDown() override {
void tearDown() {
srcBuffer->release();
destBuffer->release();
KernelFixture::tearDown();
IndirectHeapFixture::tearDown();
ClHardwareParse::tearDown();
HelloWorldFixture<AUBHelloWorldFixtureFactory>::tearDown();
AUBCommandStreamFixture::tearDown();
}
Buffer *srcBuffer = nullptr;
Buffer *destBuffer = nullptr;
void *pSrcMemory = nullptr;
void *pDestMemory = nullptr;
size_t sizeUserMemory = 128 * sizeof(float);
const char *kernelFilename = "CopyBuffer_simd";
const char *kernelName = "CopyBuffer";
const int srcPattern = 85;
const int destPattern = 170;
};
using AUBHelloWorld = Test<AUBHelloWorldFixture<AUBHelloWorldFixtureFactory>>;
HWCMDTEST_F(IGFX_GEN8_CORE, AUBHelloWorld, WhenEnqueuingKernelThenAddressesAreAligned) {
typedef typename FamilyType::GPGPU_WALKER GPGPU_WALKER;
typedef typename FamilyType::STATE_BASE_ADDRESS STATE_BASE_ADDRESS;
@ -117,9 +168,9 @@ HWCMDTEST_F(IGFX_GEN8_CORE, AUBHelloWorld, WhenEnqueuingKernelThenAddressesAreAl
EXPECT_EQ(0, memcmp(pISA, pExpectedISA, expectedSize));
}
struct AUBHelloWorldIntegrateTest : public HelloWorldFixture<AUBHelloWorldFixtureFactory>,
struct AUBHelloWorldIntegrateTest : public AUBHelloWorldFixture<AUBHelloWorldFixtureFactory>,
public ::testing::TestWithParam<std::tuple<uint32_t /*cl_uint*/, TestParam>> {
typedef HelloWorldFixture<AUBHelloWorldFixtureFactory> ParentClass;
typedef AUBHelloWorldFixture<AUBHelloWorldFixtureFactory> ParentClass;
void SetUp() override {
std::tie(KernelFixture::simd, param) = GetParam();

View File

@ -29,8 +29,7 @@ struct MapImageParams {
};
struct AUBMapImage
: public CommandDeviceFixture,
public AUBCommandStreamFixture,
: public AUBCommandStreamFixture,
public ::testing::WithParamInterface<std::tuple<uint32_t /*cl_channel_type*/, uint32_t /*cl_channel_order*/, MapImageParams>>,
public ::testing::Test {
typedef AUBCommandStreamFixture CommandStreamFixture;
@ -41,20 +40,15 @@ struct AUBMapImage
if (!(defaultHwInfo->capabilityTable.supportsImages)) {
GTEST_SKIP();
}
CommandDeviceFixture::setUp(cl_command_queue_properties(0));
CommandStreamFixture::setUp(pCmdQ);
context = std::make_unique<MockContext>(pClDevice);
CommandStreamFixture::setUp();
}
void TearDown() override {
srcImage.reset();
context.reset();
CommandStreamFixture::tearDown();
CommandDeviceFixture::tearDown();
}
std::unique_ptr<MockContext> context;
std::unique_ptr<Image> srcImage;
};
@ -125,7 +119,7 @@ HWTEST_P(AUBMapImage, WhenMappingAndUnmappingThenExpectationsAreMet) {
cl_mem_flags flags = CL_MEM_COPY_HOST_PTR;
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, pClDevice->getHardwareInfo().capabilityTable.supportsOcl21Features);
srcImage.reset(Image::create(
context.get(),
context,
ClMemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context->getDevice(0)->getDevice()),
flags,
0,

View File

@ -23,55 +23,24 @@
namespace NEO {
CommandStreamReceiver *AUBCommandStreamFixture::prepareComputeEngine(MockDevice &device, const std::string &filename) {
CommandStreamReceiver *pCommandStreamReceiver = nullptr;
if (testMode == TestMode::AubTestsWithTbx) {
pCommandStreamReceiver = TbxCommandStreamReceiver::create(filename, true, *device.executionEnvironment, device.getRootDeviceIndex(), device.getDeviceBitfield());
} else {
pCommandStreamReceiver = AUBCommandStreamReceiver::create(filename, true, *device.executionEnvironment, device.getRootDeviceIndex(), device.getDeviceBitfield());
}
device.resetCommandStreamReceiver(pCommandStreamReceiver);
return pCommandStreamReceiver;
}
void AUBCommandStreamFixture::prepareCopyEngines(MockDevice &device, const std::string &filename) {
for (auto i = 0u; i < device.allEngines.size(); i++) {
if (EngineHelpers::isBcs(device.allEngines[i].getEngineType())) {
CommandStreamReceiver *pBcsCommandStreamReceiver = nullptr;
if (testMode == TestMode::AubTestsWithTbx) {
pBcsCommandStreamReceiver = TbxCommandStreamReceiver::create(filename, true, *device.executionEnvironment, device.getRootDeviceIndex(), device.getDeviceBitfield());
} else {
pBcsCommandStreamReceiver = AUBCommandStreamReceiver::create(filename, true, *device.executionEnvironment, device.getRootDeviceIndex(), device.getDeviceBitfield());
}
device.resetCommandStreamReceiver(pBcsCommandStreamReceiver, i);
}
}
}
void AUBCommandStreamFixture::setUp(CommandQueue *pCmdQ) {
ASSERT_NE(pCmdQ, nullptr);
auto &device = reinterpret_cast<MockDevice &>(pCmdQ->getDevice());
auto &gfxCoreHelper = device.getGfxCoreHelper();
const ::testing::TestInfo *const testInfo = ::testing::UnitTest::GetInstance()->current_test_info();
std::stringstream strfilename;
auto engineType = pCmdQ->getGpgpuCommandStreamReceiver().getOsContext().getEngineType();
strfilename << ApiSpecificConfig::getAubPrefixForSpecificApi();
strfilename << testInfo->test_case_name() << "_" << testInfo->name() << "_" << gfxCoreHelper.getCsTraits(engineType).name;
pCommandStreamReceiver = prepareComputeEngine(device, strfilename.str());
ASSERT_NE(nullptr, pCommandStreamReceiver);
prepareCopyEngines(device, strfilename.str());
void AUBCommandStreamFixture::setUp(const HardwareInfo *hardwareInfo) {
AUBFixture::setUp(hardwareInfo);
CommandStreamFixture::setUp(pCmdQ);
pClDevice = device.get();
pDevice = &pClDevice->device;
pCommandStreamReceiver = csr;
pTagMemory = pCommandStreamReceiver->getTagAddress();
this->commandQueue = pCmdQ;
}
void AUBCommandStreamFixture::setUp() {
setUp(nullptr);
}
void AUBCommandStreamFixture::tearDown() {
CommandStreamFixture::tearDown();
AUBFixture::tearDown();
}
} // namespace NEO

View File

@ -18,6 +18,7 @@
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/tests_configuration.h"
#include "opencl/test/unit_test/aub_tests/fixtures/aub_fixture.h"
#include "opencl/test/unit_test/command_stream/command_stream_fixture.h"
#include <cstdint>
@ -25,12 +26,10 @@
namespace NEO {
class CommandStreamReceiver;
class AUBCommandStreamFixture : public CommandStreamFixture {
class AUBCommandStreamFixture : public AUBFixture, public CommandStreamFixture {
public:
static CommandStreamReceiver *prepareComputeEngine(MockDevice &device, const std::string &filename);
static void prepareCopyEngines(MockDevice &device, const std::string &filename);
void setUp(CommandQueue *pCommandQueue);
void setUp(const HardwareInfo *hardwareInfo);
void setUp();
void tearDown();
template <typename FamilyType>
@ -42,68 +41,10 @@ class AUBCommandStreamFixture : public CommandStreamFixture {
return static_cast<AUBCommandStreamReceiverHw<FamilyType> *>(csr);
}
template <typename FamilyType>
void expectMMIO(uint32_t mmioRegister, uint32_t expectedValue) {
CommandStreamReceiver *csr = pCommandStreamReceiver;
if (testMode == TestMode::AubTestsWithTbx) {
csr = static_cast<CommandStreamReceiverWithAUBDump<TbxCommandStreamReceiverHw<FamilyType>> *>(pCommandStreamReceiver)->aubCSR.get();
}
if (csr) {
// Write our pseudo-op to the AUB file
auto aubCsr = static_cast<AUBCommandStreamReceiverHw<FamilyType> *>(csr);
aubCsr->expectMMIO(mmioRegister, expectedValue);
}
}
template <typename FamilyType>
void expectMemory(void *gfxAddress, const void *srcAddress, size_t length) {
CommandStreamReceiver *csr = pCommandStreamReceiver;
if (testMode == TestMode::AubTestsWithTbx) {
auto tbxCsr = static_cast<CommandStreamReceiverSimulatedCommonHw<FamilyType> *>(pCommandStreamReceiver);
EXPECT_TRUE(tbxCsr->expectMemoryEqual(gfxAddress, srcAddress, length));
csr = static_cast<CommandStreamReceiverWithAUBDump<TbxCommandStreamReceiverHw<FamilyType>> *>(pCommandStreamReceiver)->aubCSR.get();
}
if (csr) {
auto aubCsr = static_cast<CommandStreamReceiverSimulatedCommonHw<FamilyType> *>(csr);
aubCsr->expectMemoryEqual(gfxAddress, srcAddress, length);
}
}
template <typename FamilyType>
void expectMemoryNotEqual(void *gfxAddress, const void *srcAddress, size_t length) {
CommandStreamReceiver *csr = pCommandStreamReceiver;
if (testMode == TestMode::AubTestsWithTbx) {
auto tbxCsr = static_cast<CommandStreamReceiverSimulatedCommonHw<FamilyType> *>(pCommandStreamReceiver);
EXPECT_TRUE(tbxCsr->expectMemoryNotEqual(gfxAddress, srcAddress, length));
csr = static_cast<CommandStreamReceiverWithAUBDump<TbxCommandStreamReceiverHw<FamilyType>> *>(pCommandStreamReceiver)->aubCSR.get();
}
if (csr) {
auto aubCsr = static_cast<CommandStreamReceiverSimulatedCommonHw<FamilyType> *>(csr);
aubCsr->expectMemoryNotEqual(gfxAddress, srcAddress, length);
}
}
template <typename FamilyType>
CommandStreamReceiverSimulatedCommonHw<FamilyType> *getSimulatedCsr() const {
return static_cast<CommandStreamReceiverSimulatedCommonHw<FamilyType> *>(pCommandStreamReceiver);
}
template <typename FamilyType>
void pollForCompletion() {
getSimulatedCsr<FamilyType>()->pollForCompletion();
}
GraphicsAllocation *createResidentAllocationAndStoreItInCsr(const void *address, size_t size) {
GraphicsAllocation *graphicsAllocation = pCommandStreamReceiver->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pCommandStreamReceiver->getRootDeviceIndex(), false, size}, address);
pCommandStreamReceiver->makeResidentHostPtrAllocation(graphicsAllocation);
pCommandStreamReceiver->getInternalAllocationStorage()->storeAllocation(std::unique_ptr<GraphicsAllocation>(graphicsAllocation), TEMPORARY_ALLOCATION);
return graphicsAllocation;
}
CommandStreamReceiver *pCommandStreamReceiver = nullptr;
volatile TagAddressType *pTagMemory = nullptr;
MockClDevice *pClDevice = nullptr;
MockDevice *pDevice = nullptr;
private:
CommandQueue *commandQueue = nullptr;

View File

@ -24,23 +24,13 @@
using namespace NEO;
struct AUBFixture : public AUBCommandStreamFixture,
public CommandQueueFixture,
public ClDeviceFixture {
using AUBCommandStreamFixture::setUp;
using CommandQueueFixture::setUp;
struct AUBCommandStreamNoopFixture : public AUBCommandStreamFixture {
void setUp() {
ClDeviceFixture::setUp();
CommandQueueFixture::setUp(nullptr, pClDevice, 0);
AUBCommandStreamFixture::setUp(pCmdQ);
AUBCommandStreamFixture::setUp();
}
void tearDown() {
AUBCommandStreamFixture::tearDown();
CommandQueueFixture::tearDown();
ClDeviceFixture::tearDown();
}
template <typename FamilyType>
@ -73,7 +63,7 @@ struct AUBFixture : public AUBCommandStreamFixture,
}
};
using AUBcommandstreamTests = Test<AUBFixture>;
using AUBcommandstreamTests = Test<AUBCommandStreamNoopFixture>;
HWTEST_F(AUBcommandstreamTests, WhenFlushingTwiceThenCompletes) {
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(*pCS, nullptr);
@ -111,7 +101,7 @@ HWTEST_F(AUBcommandstreamTests, WhenCreatingResidentAllocationThenAllocationIsRe
getSimulatedCsr<FamilyType>()->initializeEngine();
auto &commandStreamReceiver = pDevice->getGpgpuCommandStreamReceiver();
auto &commandStreamReceiver = device->getGpgpuCommandStreamReceiver();
auto graphicsAllocation = createResidentAllocationAndStoreItInCsr(buffer, size);
ResidencyContainer allocationsForResidency = {graphicsAllocation};
commandStreamReceiver.processResidency(allocationsForResidency, 0u);

View File

@ -38,6 +38,7 @@ class AUBFixture : public CommandQueueHwFixture {
executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(&hwInfo);
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<MockMemoryOperationsHandler>();
executionEnvironment->calculateMaxOsContextCount();
auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper<GfxCoreHelper>();
auto engineType = getChosenEngineType(hwInfo);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -16,7 +16,8 @@ namespace NEO {
////////////////////////////////////////////////////////////////////////////////
// Factory where all command stream traffic funnels to an AUB file
////////////////////////////////////////////////////////////////////////////////
struct AUBHelloWorldFixtureFactory : public HelloWorldFixtureFactory {
typedef AUBCommandStreamFixture CommandStreamFixture;
struct AUBHelloWorldFixtureFactory {
typedef NEO::IndirectHeapFixture IndirectHeapFixture;
typedef NEO::HelloWorldKernelFixture KernelFixture;
};
} // namespace NEO

View File

@ -22,7 +22,7 @@ struct ImagesSupportedMatcher {
};
namespace NEO {
struct ImageAubFixture : public ClDeviceFixture, public AUBCommandStreamFixture {
struct ImageAubFixture : public AUBCommandStreamFixture {
typedef AUBCommandStreamFixture CommandStreamFixture;
using AUBCommandStreamFixture::setUp;
@ -37,39 +37,23 @@ struct ImageAubFixture : public ClDeviceFixture, public AUBCommandStreamFixture
GTEST_SKIP();
}
hardwareInfo = *defaultHwInfo;
auto hardwareInfo = *defaultHwInfo;
hardwareInfo.capabilityTable.blitterOperationsSupported = true;
ClDeviceFixture::setUpImpl(&hardwareInfo);
CommandStreamFixture::setUp(&hardwareInfo);
} else {
ClDeviceFixture::setUp();
CommandStreamFixture::setUp(nullptr);
}
context = new MockContext(pClDevice);
cl_int retVal = CL_SUCCESS;
auto clQueue = clCreateCommandQueueWithProperties(context, pClDevice, nullptr, &retVal);
EXPECT_EQ(CL_SUCCESS, retVal);
pCmdQ = castToObject<CommandQueue>(clQueue);
CommandStreamFixture::setUp(pCmdQ);
}
void tearDown() {
if (pCmdQ) {
auto blocked = pCmdQ->isQueueBlocked();
UNRECOVERABLE_IF(blocked);
pCmdQ->release();
}
if (context) {
context->release();
}
CommandStreamFixture::tearDown();
ClDeviceFixture::tearDown();
}
DebugManagerStateRestore restorer;
CommandQueue *pCmdQ = nullptr;
MockContext *context = nullptr;
};
} // namespace NEO

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -35,16 +35,15 @@ struct AUBSimpleArgFixtureFactory : public SimpleArgFixtureFactory,
template <typename FixtureFactory>
struct SimpleArgFixture : public FixtureFactory::IndirectHeapFixture,
public FixtureFactory::CommandStreamFixture,
public FixtureFactory::CommandQueueFixture,
public FixtureFactory::KernelFixture,
public ClDeviceFixture {
public FixtureFactory::KernelFixture {
typedef typename FixtureFactory::IndirectHeapFixture IndirectHeapFixture;
typedef typename FixtureFactory::CommandStreamFixture CommandStreamFixture;
typedef typename FixtureFactory::CommandQueueFixture CommandQueueFixture;
typedef typename FixtureFactory::KernelFixture KernelFixture;
using AUBCommandStreamFixture::setUp;
using CommandQueueFixture::pCmdQ;
using CommandStreamFixture::pClDevice;
using CommandStreamFixture::pCmdQ;
using CommandStreamFixture::pCS;
using IndirectHeapFixture::setUp;
using KernelFixture::pKernel;
@ -52,11 +51,7 @@ struct SimpleArgFixture : public FixtureFactory::IndirectHeapFixture,
public:
void setUp() {
ClDeviceFixture::setUp();
ASSERT_NE(nullptr, pClDevice);
CommandQueueFixture::setUp(pClDevice, 0);
ASSERT_NE(nullptr, pCmdQ);
CommandStreamFixture::setUp(pCmdQ);
CommandStreamFixture::setUp();
ASSERT_NE(nullptr, pCS);
IndirectHeapFixture::setUp(pCmdQ);
KernelFixture::setUp(pClDevice);
@ -95,8 +90,6 @@ struct SimpleArgFixture : public FixtureFactory::IndirectHeapFixture,
KernelFixture::tearDown();
IndirectHeapFixture::tearDown();
CommandStreamFixture::tearDown();
CommandQueueFixture::tearDown();
ClDeviceFixture::tearDown();
}
int argVal = 0;

View File

@ -24,8 +24,7 @@ static const unsigned int testImageDimensions = 17;
auto const elementSize = 4; // sizeof CL_RGBA * CL_UNORM_INT8
struct AUBCreateImage
: public CommandDeviceFixture,
public AUBCommandStreamFixture,
: public AUBCommandStreamFixture,
public ::testing::Test {
typedef AUBCommandStreamFixture CommandStreamFixture;
@ -35,8 +34,7 @@ struct AUBCreateImage
if (!(defaultHwInfo->capabilityTable.supportsImages)) {
GTEST_SKIP();
}
CommandDeviceFixture::setUp(cl_command_queue_properties(0));
CommandStreamFixture::setUp(pCmdQ);
CommandStreamFixture::setUp();
imageFormat.image_channel_data_type = CL_UNORM_INT8;
imageFormat.image_channel_order = CL_RGBA;
@ -56,7 +54,6 @@ struct AUBCreateImage
void TearDown() override {
image.reset();
CommandStreamFixture::tearDown();
CommandDeviceFixture::tearDown();
}
std::unique_ptr<Image> image;