diff --git a/opencl/test/unit_test/aub_tests/command_queue/aub_postsync_write_tests_xehp_and_later.cpp b/opencl/test/unit_test/aub_tests/command_queue/aub_postsync_write_tests_xehp_and_later.cpp index afece60110..20fd0f16d4 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/aub_postsync_write_tests_xehp_and_later.cpp +++ b/opencl/test/unit_test/aub_tests/command_queue/aub_postsync_write_tests_xehp_and_later.cpp @@ -20,16 +20,16 @@ using namespace NEO; -struct PostSyncWriteXeHPTests : public HelloWorldFixture, public ::testing::Test { +struct PostSyncWriteXeHPTests : public AUBCommandStreamFixture, public ::testing::Test { void SetUp() override { DebugManager.flags.EnableTimestampPacket.set(true); - HelloWorldFixture::setUp(); + AUBCommandStreamFixture::setUp(); EXPECT_TRUE(pCommandStreamReceiver->peekTimestampPacketWriteEnabled()); }; void TearDown() override { - HelloWorldFixture::tearDown(); + AUBCommandStreamFixture::tearDown(); } DebugManagerStateRestore restore; @@ -39,7 +39,7 @@ struct PostSyncWriteXeHPTests : public HelloWorldFixture buffer(Buffer::create(pContext, CL_MEM_READ_WRITE, bufferSize, nullptr, retVal)); + std::unique_ptr 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(pCmdQ->getTimestampPacketContainer()->peekNodes().at(0)->getGpuAddress()); - expectMemoryNotEqual(tagGpuAddress, expectedTimestampValues, 4 * sizeof(typename FamilyType::TimestampPacketType)); + expectNotEqualMemory(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::create(pContext, CL_MEM_READ_WRITE, bufferSize, nullptr, retVal)); + std::unique_ptr 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(reinterpret_cast(endTimestampAddress1), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType)); - expectMemoryNotEqual(reinterpret_cast(endTimestampAddress2), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType)); - expectMemoryNotEqual(reinterpret_cast(endTimestampAddress3), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType)); - expectMemoryNotEqual(reinterpret_cast(endTimestampAddress4), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType)); + expectNotEqualMemory(reinterpret_cast(endTimestampAddress1), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType)); + expectNotEqualMemory(reinterpret_cast(endTimestampAddress2), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType)); + expectNotEqualMemory(reinterpret_cast(endTimestampAddress3), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType)); + expectNotEqualMemory(reinterpret_cast(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(reinterpret_cast(endTimestampAddress1), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType)); - expectMemoryNotEqual(reinterpret_cast(endTimestampAddress2), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType)); - expectMemoryNotEqual(reinterpret_cast(endTimestampAddress3), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType)); - expectMemoryNotEqual(reinterpret_cast(endTimestampAddress4), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType)); + expectNotEqualMemory(reinterpret_cast(endTimestampAddress1), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType)); + expectNotEqualMemory(reinterpret_cast(endTimestampAddress2), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType)); + expectNotEqualMemory(reinterpret_cast(endTimestampAddress3), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType)); + expectNotEqualMemory(reinterpret_cast(endTimestampAddress4), &expectedEndTimestamp, sizeof(typename FamilyType::TimestampPacketType)); clReleaseEvent(outEvent); } diff --git a/opencl/test/unit_test/aub_tests/command_queue/enqueue_fill_image_aub_tests.cpp b/opencl/test/unit_test/aub_tests/command_queue/enqueue_fill_image_aub_tests.cpp index 1e4b49fcf9..517659b6fe 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/enqueue_fill_image_aub_tests.cpp +++ b/opencl/test/unit_test/aub_tests/command_queue/enqueue_fill_image_aub_tests.cpp @@ -75,8 +75,7 @@ struct FillChannelType { // clang-format on struct AubFillImage - : public CommandDeviceFixture, - public AUBCommandStreamFixture, + : public AUBCommandStreamFixture, public ::testing::WithParamInterface>, 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(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 context; std::unique_ptr 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, diff --git a/opencl/test/unit_test/aub_tests/command_queue/enqueue_kernel_aub_tests.cpp b/opencl/test/unit_test/aub_tests/command_queue/enqueue_kernel_aub_tests.cpp index a126600c2b..e6a6d7af88 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/enqueue_kernel_aub_tests.cpp +++ b/opencl/test/unit_test/aub_tests/command_queue/enqueue_kernel_aub_tests.cpp @@ -46,22 +46,73 @@ cl_uint TestSimdTable[] = { 8, 16, 32}; namespace ULT { -struct AUBHelloWorld - : public HelloWorldFixture, - public ClHardwareParse, - public ::testing::Test { +template +struct AUBHelloWorldFixture + : public AUBCommandStreamFixture, + public FixtureFactory::KernelFixture, + public FixtureFactory::IndirectHeapFixture, + public ClHardwareParse { - void SetUp() override { - HelloWorldFixture::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::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>; + 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, +struct AUBHelloWorldIntegrateTest : public AUBHelloWorldFixture, public ::testing::TestWithParam> { - typedef HelloWorldFixture ParentClass; + typedef AUBHelloWorldFixture ParentClass; void SetUp() override { std::tie(KernelFixture::simd, param) = GetParam(); diff --git a/opencl/test/unit_test/aub_tests/command_queue/enqueue_map_image_aub_tests.cpp b/opencl/test/unit_test/aub_tests/command_queue/enqueue_map_image_aub_tests.cpp index 53d9f209c5..cb87ccaeb6 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/enqueue_map_image_aub_tests.cpp +++ b/opencl/test/unit_test/aub_tests/command_queue/enqueue_map_image_aub_tests.cpp @@ -29,8 +29,7 @@ struct MapImageParams { }; struct AUBMapImage - : public CommandDeviceFixture, - public AUBCommandStreamFixture, + : public AUBCommandStreamFixture, public ::testing::WithParamInterface>, 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(pClDevice); + CommandStreamFixture::setUp(); } void TearDown() override { srcImage.reset(); - context.reset(); + CommandStreamFixture::tearDown(); - CommandDeviceFixture::tearDown(); } - std::unique_ptr context; std::unique_ptr 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, diff --git a/opencl/test/unit_test/aub_tests/command_stream/aub_command_stream_fixture.cpp b/opencl/test/unit_test/aub_tests/command_stream/aub_command_stream_fixture.cpp index d31c9d9893..238eec8be8 100644 --- a/opencl/test/unit_test/aub_tests/command_stream/aub_command_stream_fixture.cpp +++ b/opencl/test/unit_test/aub_tests/command_stream/aub_command_stream_fixture.cpp @@ -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(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 diff --git a/opencl/test/unit_test/aub_tests/command_stream/aub_command_stream_fixture.h b/opencl/test/unit_test/aub_tests/command_stream/aub_command_stream_fixture.h index 7b48709b80..92ff5fe19b 100644 --- a/opencl/test/unit_test/aub_tests/command_stream/aub_command_stream_fixture.h +++ b/opencl/test/unit_test/aub_tests/command_stream/aub_command_stream_fixture.h @@ -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 @@ -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 @@ -42,68 +41,10 @@ class AUBCommandStreamFixture : public CommandStreamFixture { return static_cast *>(csr); } - template - void expectMMIO(uint32_t mmioRegister, uint32_t expectedValue) { - CommandStreamReceiver *csr = pCommandStreamReceiver; - if (testMode == TestMode::AubTestsWithTbx) { - csr = static_cast> *>(pCommandStreamReceiver)->aubCSR.get(); - } - - if (csr) { - // Write our pseudo-op to the AUB file - auto aubCsr = static_cast *>(csr); - aubCsr->expectMMIO(mmioRegister, expectedValue); - } - } - - template - void expectMemory(void *gfxAddress, const void *srcAddress, size_t length) { - CommandStreamReceiver *csr = pCommandStreamReceiver; - if (testMode == TestMode::AubTestsWithTbx) { - auto tbxCsr = static_cast *>(pCommandStreamReceiver); - EXPECT_TRUE(tbxCsr->expectMemoryEqual(gfxAddress, srcAddress, length)); - csr = static_cast> *>(pCommandStreamReceiver)->aubCSR.get(); - } - - if (csr) { - auto aubCsr = static_cast *>(csr); - aubCsr->expectMemoryEqual(gfxAddress, srcAddress, length); - } - } - - template - void expectMemoryNotEqual(void *gfxAddress, const void *srcAddress, size_t length) { - CommandStreamReceiver *csr = pCommandStreamReceiver; - if (testMode == TestMode::AubTestsWithTbx) { - auto tbxCsr = static_cast *>(pCommandStreamReceiver); - EXPECT_TRUE(tbxCsr->expectMemoryNotEqual(gfxAddress, srcAddress, length)); - csr = static_cast> *>(pCommandStreamReceiver)->aubCSR.get(); - } - - if (csr) { - auto aubCsr = static_cast *>(csr); - aubCsr->expectMemoryNotEqual(gfxAddress, srcAddress, length); - } - } - - template - CommandStreamReceiverSimulatedCommonHw *getSimulatedCsr() const { - return static_cast *>(pCommandStreamReceiver); - } - - template - void pollForCompletion() { - getSimulatedCsr()->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), TEMPORARY_ALLOCATION); - return graphicsAllocation; - } CommandStreamReceiver *pCommandStreamReceiver = nullptr; volatile TagAddressType *pTagMemory = nullptr; + MockClDevice *pClDevice = nullptr; + MockDevice *pDevice = nullptr; private: CommandQueue *commandQueue = nullptr; diff --git a/opencl/test/unit_test/aub_tests/command_stream/aub_command_stream_tests.cpp b/opencl/test/unit_test/aub_tests/command_stream/aub_command_stream_tests.cpp index d28e3874de..7fe3d616ab 100644 --- a/opencl/test/unit_test/aub_tests/command_stream/aub_command_stream_tests.cpp +++ b/opencl/test/unit_test/aub_tests/command_stream/aub_command_stream_tests.cpp @@ -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 @@ -73,7 +63,7 @@ struct AUBFixture : public AUBCommandStreamFixture, } }; -using AUBcommandstreamTests = Test; +using AUBcommandstreamTests = Test; HWTEST_F(AUBcommandstreamTests, WhenFlushingTwiceThenCompletes) { CommandStreamReceiverHw::addBatchBufferEnd(*pCS, nullptr); @@ -111,7 +101,7 @@ HWTEST_F(AUBcommandstreamTests, WhenCreatingResidentAllocationThenAllocationIsRe getSimulatedCsr()->initializeEngine(); - auto &commandStreamReceiver = pDevice->getGpgpuCommandStreamReceiver(); + auto &commandStreamReceiver = device->getGpgpuCommandStreamReceiver(); auto graphicsAllocation = createResidentAllocationAndStoreItInCsr(buffer, size); ResidencyContainer allocationsForResidency = {graphicsAllocation}; commandStreamReceiver.processResidency(allocationsForResidency, 0u); diff --git a/opencl/test/unit_test/aub_tests/fixtures/aub_fixture.h b/opencl/test/unit_test/aub_tests/fixtures/aub_fixture.h index 6f33a7ea57..e839e21bb1 100644 --- a/opencl/test/unit_test/aub_tests/fixtures/aub_fixture.h +++ b/opencl/test/unit_test/aub_tests/fixtures/aub_fixture.h @@ -38,6 +38,7 @@ class AUBFixture : public CommandQueueHwFixture { executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(&hwInfo); executionEnvironment->rootDeviceEnvironments[0]->initGmm(); executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique(); + executionEnvironment->calculateMaxOsContextCount(); auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); auto engineType = getChosenEngineType(hwInfo); diff --git a/opencl/test/unit_test/aub_tests/fixtures/hello_world_fixture.h b/opencl/test/unit_test/aub_tests/fixtures/hello_world_fixture.h index 5808884dee..9e64abc7fe 100644 --- a/opencl/test/unit_test/aub_tests/fixtures/hello_world_fixture.h +++ b/opencl/test/unit_test/aub_tests/fixtures/hello_world_fixture.h @@ -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 diff --git a/opencl/test/unit_test/aub_tests/fixtures/image_aub_fixture.h b/opencl/test/unit_test/aub_tests/fixtures/image_aub_fixture.h index 9e100eedd8..682734dc8d 100644 --- a/opencl/test/unit_test/aub_tests/fixtures/image_aub_fixture.h +++ b/opencl/test/unit_test/aub_tests/fixtures/image_aub_fixture.h @@ -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(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 diff --git a/opencl/test/unit_test/aub_tests/fixtures/simple_arg_fixture.h b/opencl/test/unit_test/aub_tests/fixtures/simple_arg_fixture.h index f7d9b6303d..c73f23980f 100644 --- a/opencl/test/unit_test/aub_tests/fixtures/simple_arg_fixture.h +++ b/opencl/test/unit_test/aub_tests/fixtures/simple_arg_fixture.h @@ -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 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; diff --git a/opencl/test/unit_test/aub_tests/mem_obj/create_image_aub_tests.cpp b/opencl/test/unit_test/aub_tests/mem_obj/create_image_aub_tests.cpp index c09a7545a5..8389718719 100644 --- a/opencl/test/unit_test/aub_tests/mem_obj/create_image_aub_tests.cpp +++ b/opencl/test/unit_test/aub_tests/mem_obj/create_image_aub_tests.cpp @@ -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;