From eff5a281edf63f76b3e599128f4b3dd094428457 Mon Sep 17 00:00:00 2001 From: Kamil Kopryk Date: Tue, 10 Jan 2023 15:58:16 +0000 Subject: [PATCH] refactor: don't use global gfxCoreHelper getter 4/n Related-To: NEO-6853 Signed-off-by: Kamil Kopryk --- .../core/test/unit_tests/sources/memory/test_memory.cpp | 4 ++-- .../unit_test/command_queue/enqueue_kernel_2_tests.cpp | 7 +++++-- .../command_stream_receiver_flush_task_2_tests.cpp | 4 +++- opencl/test/unit_test/context/driver_diagnostics_tests.cpp | 4 ++-- opencl/test/unit_test/device/device_caps_tests.cpp | 6 ++++-- opencl/test/unit_test/program/program_tests.cpp | 3 ++- .../direct_submission/direct_submission_tests_1.cpp | 6 ++++-- .../direct_submission/direct_submission_tests_2.cpp | 2 +- 8 files changed, 23 insertions(+), 13 deletions(-) diff --git a/level_zero/core/test/unit_tests/sources/memory/test_memory.cpp b/level_zero/core/test/unit_tests/sources/memory/test_memory.cpp index 6f2a4373c3..5db9e2aa24 100644 --- a/level_zero/core/test/unit_tests/sources/memory/test_memory.cpp +++ b/level_zero/core/test/unit_tests/sources/memory/test_memory.cpp @@ -342,8 +342,8 @@ struct CompressionMemoryTest : public MemoryTest { HWTEST2_F(CompressionMemoryTest, givenDeviceUsmWhenAllocatingThenEnableCompressionIfPossible, IsAtLeastSkl) { device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable.ftrRenderCompressedBuffers = true; auto &hwInfo = device->getHwInfo(); - auto &l0GfxCoreHelper = device->getNEODevice()->getRootDeviceEnvironment().getHelper(); - auto &gfxCoreHelper = NEO::GfxCoreHelperHw::get(); + auto &l0GfxCoreHelper = device->getL0GfxCoreHelper(); + auto &gfxCoreHelper = device->getNEODevice()->getGfxCoreHelper(); // Default path { diff --git a/opencl/test/unit_test/command_queue/enqueue_kernel_2_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_kernel_2_tests.cpp index 8131af8e85..bb3be04f87 100644 --- a/opencl/test/unit_test/command_queue/enqueue_kernel_2_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_kernel_2_tests.cpp @@ -758,7 +758,9 @@ HWTEST_F(EnqueueKernelTests, whenEnqueueingKernelThenCsrCorrectlySetsRequiredThr nullptr, nullptr); pCommandQueue->flush(); - EXPECT_EQ(GfxCoreHelperHw::get().getDefaultThreadArbitrationPolicy(), + + auto &gfxCoreHelper = clDeviceFactory.rootDevices[0]->getGfxCoreHelper(); + EXPECT_EQ(gfxCoreHelper.getDefaultThreadArbitrationPolicy(), csr.streamProperties.stateComputeMode.threadArbitrationPolicy.value); pCommandQueue->enqueueKernel( @@ -784,7 +786,8 @@ HWTEST_F(EnqueueKernelTests, whenEnqueueingKernelThenCsrCorrectlySetsRequiredThr nullptr, nullptr); pCommandQueue->flush(); - EXPECT_EQ(GfxCoreHelperHw::get().getDefaultThreadArbitrationPolicy(), + + EXPECT_EQ(gfxCoreHelper.getDefaultThreadArbitrationPolicy(), csr.streamProperties.stateComputeMode.threadArbitrationPolicy.value); } diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_2_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_2_tests.cpp index a2848be9be..4195ed8a1f 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_2_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_2_tests.cpp @@ -441,7 +441,9 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDefaultCommandStreamReceiverT EXPECT_EQ(ThreadArbitrationPolicy::NotPresent, pCommandStreamReceiver->peekThreadArbitrationPolicy()); flushTask(*pCommandStreamReceiver); - EXPECT_EQ(GfxCoreHelperHw::get().getDefaultThreadArbitrationPolicy(), pCommandStreamReceiver->peekThreadArbitrationPolicy()); + + auto &gfxCoreHelper = pDevice->getGfxCoreHelper(); + EXPECT_EQ(gfxCoreHelper.getDefaultThreadArbitrationPolicy(), pCommandStreamReceiver->peekThreadArbitrationPolicy()); } HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenKernelWithSlmWhenPreviousSLML3WasSentThenDontProgramL3) { diff --git a/opencl/test/unit_test/context/driver_diagnostics_tests.cpp b/opencl/test/unit_test/context/driver_diagnostics_tests.cpp index 400dd016bb..804ddbd09c 100644 --- a/opencl/test/unit_test/context/driver_diagnostics_tests.cpp +++ b/opencl/test/unit_test/context/driver_diagnostics_tests.cpp @@ -773,8 +773,8 @@ HWTEST_F(PerformanceHintTest, givenCompressedImageWhenItsCreatedThenProperPerfor auto graphicsAllocation = mockBuffer->getGraphicsAllocation(device->getRootDeviceIndex()); graphicsAllocation->setDefaultGmm(gmm); - - if (!GfxCoreHelperHw::get().checkResourceCompatibility(*graphicsAllocation)) { + auto &gfxCoreHelper = device->getGfxCoreHelper(); + if (!gfxCoreHelper.checkResourceCompatibility(*graphicsAllocation)) { GTEST_SKIP(); } diff --git a/opencl/test/unit_test/device/device_caps_tests.cpp b/opencl/test/unit_test/device/device_caps_tests.cpp index e7f7862eae..735e5726ac 100644 --- a/opencl/test/unit_test/device/device_caps_tests.cpp +++ b/opencl/test/unit_test/device/device_caps_tests.cpp @@ -439,7 +439,8 @@ HWTEST_F(DeviceGetCapsTest, givenGlobalMemSizeAndSharedSystemAllocationsNotSuppo const auto &caps = device->getSharedDeviceInfo(); uint64_t expectedSize = std::max((caps.globalMemSize / 2), static_cast(128ULL * MemoryConstants::megaByte)); - expectedSize = std::min(expectedSize, GfxCoreHelperHw::get().getMaxMemAllocSize()); + auto &gfxCoreHelper = device->getGfxCoreHelper(); + expectedSize = std::min(expectedSize, gfxCoreHelper.getMaxMemAllocSize()); EXPECT_EQ(caps.maxMemAllocSize, expectedSize); } @@ -1058,7 +1059,8 @@ HWTEST_F(DeviceGetCapsTest, givenDisabledFtrPooledEuWhenCalculatingMaxEuPerSSThe auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&myHwInfo)); auto &deviceInfo = device->deviceInfo; - auto simdSizeUsed = GfxCoreHelperHw::get().getMinimalSIMDSize(); + auto &gfxCoreHelper = device->getGfxCoreHelper(); + auto simdSizeUsed = gfxCoreHelper.getMinimalSIMDSize(); auto productHelper = ProductHelper::get(myHwInfo.platform.eProductFamily); auto expectedMaxWGS = productHelper->getMaxThreadsForWorkgroupInDSSOrSS(myHwInfo, static_cast(deviceInfo.maxNumEUsPerSubSlice), diff --git a/opencl/test/unit_test/program/program_tests.cpp b/opencl/test/unit_test/program/program_tests.cpp index d697727e1c..023616e514 100644 --- a/opencl/test/unit_test/program/program_tests.cpp +++ b/opencl/test/unit_test/program/program_tests.cpp @@ -2101,7 +2101,8 @@ HWTEST_F(ProgramTests, givenNewProgramThenStatelessToStatefulBufferOffsetOptimiz MockProgram program(pContext, false, toClDeviceVector(*pClDevice)); auto internalOptions = program.getInternalOptions(); - if (GfxCoreHelperHw::get().isStatelessToStatefulWithOffsetSupported()) { + auto &gfxCoreHelper = pClDevice->getGfxCoreHelper(); + if (gfxCoreHelper.isStatelessToStatefulWithOffsetSupported()) { EXPECT_TRUE(CompilerOptions::contains(internalOptions, CompilerOptions::hasBufferOffsetArg)); } else { EXPECT_FALSE(CompilerOptions::contains(internalOptions, CompilerOptions::hasBufferOffsetArg)); diff --git a/shared/test/unit_test/direct_submission/direct_submission_tests_1.cpp b/shared/test/unit_test/direct_submission/direct_submission_tests_1.cpp index 978d768f8f..1ea1a23890 100644 --- a/shared/test/unit_test/direct_submission/direct_submission_tests_1.cpp +++ b/shared/test/unit_test/direct_submission/direct_submission_tests_1.cpp @@ -134,7 +134,8 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWithoutCompletionFenceAlloca EXPECT_EQ(nullptr, directSubmission.completionFenceAllocation); size_t expectedAllocationsCnt = 3; - if (GfxCoreHelperHw::get().isRelaxedOrderingSupported()) { + auto &gfxCoreHelper = pDevice->getGfxCoreHelper(); + if (gfxCoreHelper.isRelaxedOrderingSupported()) { expectedAllocationsCnt += 2; } @@ -165,7 +166,8 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWithCompletionFenceAllocatio EXPECT_EQ(&completionFenceAllocation, directSubmission.completionFenceAllocation); size_t expectedAllocationsCnt = 4; - if (GfxCoreHelperHw::get().isRelaxedOrderingSupported()) { + auto &gfxCoreHelper = pDevice->getGfxCoreHelper(); + if (gfxCoreHelper.isRelaxedOrderingSupported()) { expectedAllocationsCnt += 2; } diff --git a/shared/test/unit_test/direct_submission/direct_submission_tests_2.cpp b/shared/test/unit_test/direct_submission/direct_submission_tests_2.cpp index dbc14e55e5..1d83a8e8e5 100644 --- a/shared/test/unit_test/direct_submission/direct_submission_tests_2.cpp +++ b/shared/test/unit_test/direct_submission/direct_submission_tests_2.cpp @@ -2132,7 +2132,7 @@ HWTEST2_F(DirectSubmissionRelaxedOrderingTests, WhenStoppingRingWithoutSubmissio HWTEST_F(DirectSubmissionRelaxedOrderingTests, givenDebugFlagSetWhenAskingForRelaxedOrderingSupportThenEnable) { auto ultCsr = static_cast *>(pDevice->getDefaultEngine().commandStreamReceiver); - auto &gfxCoreHelper = GfxCoreHelperHw::get(); + auto &gfxCoreHelper = pDevice->getGfxCoreHelper(); { DebugManager.flags.DirectSubmissionRelaxedOrdering.set(-1);