From 22c25a231ec0a9d8630fe175520318642ba78a36 Mon Sep 17 00:00:00 2001 From: Sebastian Luzynski Date: Thu, 28 Jan 2021 08:41:56 +0000 Subject: [PATCH] Extra checks for gen12lp Signed-off-by: Sebastian Luzynski --- opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl | 2 +- opencl/test/unit_test/helpers/hw_helper_tests.cpp | 8 ++++++++ opencl/test/unit_test/mocks/mock_wddm.cpp | 6 +++--- opencl/test/unit_test/mocks/mock_wddm.h | 3 ++- shared/source/gen12lp/helpers_gen12lp.h | 2 +- shared/source/gen12lp/hw_helper_gen12lp.cpp | 5 +++++ shared/source/helpers/hw_helper.h | 3 +++ shared/source/helpers/hw_helper_base.inl | 5 +++++ shared/source/os_interface/windows/wddm/wddm.cpp | 3 ++- shared/source/os_interface/windows/wddm/wddm.h | 2 +- .../windows/wddm_additional_context_flags.cpp | 4 ++-- 11 files changed, 33 insertions(+), 10 deletions(-) diff --git a/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl b/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl index a14e1fd3f1..70e6927db9 100644 --- a/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl +++ b/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2020 Intel Corporation + * Copyright (C) 2019-2021 Intel Corporation * * SPDX-License-Identifier: MIT * diff --git a/opencl/test/unit_test/helpers/hw_helper_tests.cpp b/opencl/test/unit_test/helpers/hw_helper_tests.cpp index 9b13d1854a..108153485e 100644 --- a/opencl/test/unit_test/helpers/hw_helper_tests.cpp +++ b/opencl/test/unit_test/helpers/hw_helper_tests.cpp @@ -1191,3 +1191,11 @@ TEST_F(HwHelperTest, WhenGettingIsCpuImageTransferPreferredThenFalseIsReturned) auto &hwHelper = HwHelper::get(renderCoreFamily); EXPECT_FALSE(hwHelper.isCpuImageTransferPreferred(*defaultHwInfo)); } + +TEST_F(HwHelperTest, whenFtrGpGpuMidThreadLevelPreemptFeatureDisabledThenFalseIsReturned) { + HwHelper &hwHelper = HwHelper::get(renderCoreFamily); + FeatureTable featureTable = {}; + featureTable.ftrGpGpuMidThreadLevelPreempt = false; + bool result = hwHelper.isAdditionalFeatureFlagRequired(&featureTable); + EXPECT_FALSE(result); +} diff --git a/opencl/test/unit_test/mocks/mock_wddm.cpp b/opencl/test/unit_test/mocks/mock_wddm.cpp index 26c3e96b65..086a7d6ea6 100644 --- a/opencl/test/unit_test/mocks/mock_wddm.cpp +++ b/opencl/test/unit_test/mocks/mock_wddm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2020 Intel Corporation + * Copyright (C) 2018-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -153,9 +153,9 @@ bool WddmMock::createContext(OsContextWin &osContext) { return createContextResult.success = Wddm::createContext(osContext); } -void WddmMock::applyAdditionalContextFlags(CREATECONTEXT_PVTDATA &privateData, OsContextWin &osContext) { +void WddmMock::applyAdditionalContextFlags(CREATECONTEXT_PVTDATA &privateData, OsContextWin &osContext, const HardwareInfo &hwInfo) { applyAdditionalContextFlagsResult.called++; - Wddm::applyAdditionalContextFlags(privateData, osContext); + Wddm::applyAdditionalContextFlags(privateData, osContext, hwInfo); } bool WddmMock::destroyContext(D3DKMT_HANDLE context) { diff --git a/opencl/test/unit_test/mocks/mock_wddm.h b/opencl/test/unit_test/mocks/mock_wddm.h index 9de18f715c..2cf80a0b3f 100644 --- a/opencl/test/unit_test/mocks/mock_wddm.h +++ b/opencl/test/unit_test/mocks/mock_wddm.h @@ -8,6 +8,7 @@ #pragma once #include "shared/source/helpers/constants.h" +#include "shared/source/helpers/hw_info.h" #include "shared/source/memory_manager/host_ptr_defines.h" #include "shared/source/os_interface/windows/wddm/wddm.h" #include "shared/source/os_interface/windows/wddm_residency_allocations_container.h" @@ -65,7 +66,7 @@ class WddmMock : public Wddm { bool destroyAllocation(WddmAllocation *alloc, OsContextWin *osContext); bool openSharedHandle(D3DKMT_HANDLE handle, WddmAllocation *alloc) override; bool createContext(OsContextWin &osContext) override; - void applyAdditionalContextFlags(CREATECONTEXT_PVTDATA &privateData, OsContextWin &osContext) override; + void applyAdditionalContextFlags(CREATECONTEXT_PVTDATA &privateData, OsContextWin &osContext, const HardwareInfo &hwInfo) override; bool destroyContext(D3DKMT_HANDLE context) override; bool queryAdapterInfo() override; bool submit(uint64_t commandBuffer, size_t size, void *commandHeader, WddmSubmitArguments &submitArguments) override; diff --git a/shared/source/gen12lp/helpers_gen12lp.h b/shared/source/gen12lp/helpers_gen12lp.h index b507e17554..97a5f46a86 100644 --- a/shared/source/gen12lp/helpers_gen12lp.h +++ b/shared/source/gen12lp/helpers_gen12lp.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2020 Intel Corporation + * Copyright (C) 2019-2021 Intel Corporation * * SPDX-License-Identifier: MIT * diff --git a/shared/source/gen12lp/hw_helper_gen12lp.cpp b/shared/source/gen12lp/hw_helper_gen12lp.cpp index 95937a95eb..5851ab2840 100644 --- a/shared/source/gen12lp/hw_helper_gen12lp.cpp +++ b/shared/source/gen12lp/hw_helper_gen12lp.cpp @@ -51,6 +51,11 @@ bool HwHelperHw::isWaDisableRccRhwoOptimizationRequired() const { return true; } +template <> +bool HwHelperHw::isAdditionalFeatureFlagRequired(const FeatureTable *featureTable) const { + return featureTable->ftrGpGpuMidThreadLevelPreempt; +} + template <> uint32_t HwHelperHw::getComputeUnitsUsedForScratch(const HardwareInfo *pHwInfo) const { /* For ICL+ maxThreadCount equals (EUCount * 8). diff --git a/shared/source/helpers/hw_helper.h b/shared/source/helpers/hw_helper.h index 1cd9abd418..b679c3f6c6 100644 --- a/shared/source/helpers/hw_helper.h +++ b/shared/source/helpers/hw_helper.h @@ -102,6 +102,7 @@ class HwHelper { virtual bool isForceEmuInt32DivRemSPWARequired(const HardwareInfo &hwInfo) = 0; virtual bool isWaDisableRccRhwoOptimizationRequired() const = 0; + virtual bool isAdditionalFeatureFlagRequired(const FeatureTable *featureTable) const = 0; virtual uint32_t getMinimalSIMDSize() = 0; virtual uint32_t getHwRevIdFromStepping(uint32_t stepping, const HardwareInfo &hwInfo) const = 0; virtual uint32_t getSteppingFromHwRevId(uint32_t hwRevId, const HardwareInfo &hwInfo) const = 0; @@ -281,6 +282,8 @@ class HwHelperHw : public HwHelper { bool isWaDisableRccRhwoOptimizationRequired() const override; + bool isAdditionalFeatureFlagRequired(const FeatureTable *featureTable) const override; + uint32_t getMinimalSIMDSize() override; uint64_t getGpuTimeStampInNS(uint64_t timeStamp, double frequency) const override; diff --git a/shared/source/helpers/hw_helper_base.inl b/shared/source/helpers/hw_helper_base.inl index 970ca16472..9a9f72408a 100644 --- a/shared/source/helpers/hw_helper_base.inl +++ b/shared/source/helpers/hw_helper_base.inl @@ -529,4 +529,9 @@ bool HwHelperHw::isSipWANeeded(const HardwareInfo &hwInfo) const { return false; } +template +bool HwHelperHw::isAdditionalFeatureFlagRequired(const FeatureTable *featureTable) const { + return false; +} + } // namespace NEO diff --git a/shared/source/os_interface/windows/wddm/wddm.cpp b/shared/source/os_interface/windows/wddm/wddm.cpp index 62159f0649..e20e410616 100644 --- a/shared/source/os_interface/windows/wddm/wddm.cpp +++ b/shared/source/os_interface/windows/wddm/wddm.cpp @@ -763,7 +763,8 @@ bool Wddm::createContext(OsContextWin &osContext) { PrivateData.pHwContextId = &hwContextId; PrivateData.IsMediaUsage = false; PrivateData.NoRingFlushes = DebugManager.flags.UseNoRingFlushesKmdMode.get(); - applyAdditionalContextFlags(PrivateData, osContext); + auto &rootDeviceEnvironment = this->getRootDeviceEnvironment(); + applyAdditionalContextFlags(PrivateData, osContext, *rootDeviceEnvironment.getHardwareInfo()); CreateContext.EngineAffinity = 0; CreateContext.Flags.NullRendering = static_cast(DebugManager.flags.EnableNullHardware.get()); diff --git a/shared/source/os_interface/windows/wddm/wddm.h b/shared/source/os_interface/windows/wddm/wddm.h index 05bc27397d..13ce15093a 100644 --- a/shared/source/os_interface/windows/wddm/wddm.h +++ b/shared/source/os_interface/windows/wddm/wddm.h @@ -60,7 +60,7 @@ class Wddm { bool mapGpuVirtualAddress(AllocationStorageData *allocationStorageData); MOCKABLE_VIRTUAL D3DGPU_VIRTUAL_ADDRESS reserveGpuVirtualAddress(D3DGPU_VIRTUAL_ADDRESS minimumAddress, D3DGPU_VIRTUAL_ADDRESS maximumAddress, D3DGPU_SIZE_T size); MOCKABLE_VIRTUAL bool createContext(OsContextWin &osContext); - MOCKABLE_VIRTUAL void applyAdditionalContextFlags(CREATECONTEXT_PVTDATA &privateData, OsContextWin &osContext); + MOCKABLE_VIRTUAL void applyAdditionalContextFlags(CREATECONTEXT_PVTDATA &privateData, OsContextWin &osContext, const HardwareInfo &hwInfo); MOCKABLE_VIRTUAL bool freeGpuVirtualAddress(D3DGPU_VIRTUAL_ADDRESS &gpuPtr, uint64_t size); MOCKABLE_VIRTUAL NTSTATUS createAllocation(const void *alignedCpuPtr, const Gmm *gmm, D3DKMT_HANDLE &outHandle, D3DKMT_HANDLE &outResourceHandle, D3DKMT_HANDLE *outSharedHandle); MOCKABLE_VIRTUAL bool createAllocation64k(const Gmm *gmm, D3DKMT_HANDLE &outHandle); diff --git a/shared/source/os_interface/windows/wddm_additional_context_flags.cpp b/shared/source/os_interface/windows/wddm_additional_context_flags.cpp index af1cdc2372..64a09543d9 100644 --- a/shared/source/os_interface/windows/wddm_additional_context_flags.cpp +++ b/shared/source/os_interface/windows/wddm_additional_context_flags.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2020 Intel Corporation + * Copyright (C) 2018-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -8,6 +8,6 @@ #include "shared/source/os_interface/windows/wddm/wddm.h" namespace NEO { -void Wddm::applyAdditionalContextFlags(CREATECONTEXT_PVTDATA &privateData, OsContextWin &osContext) { +void Wddm::applyAdditionalContextFlags(CREATECONTEXT_PVTDATA &privateData, OsContextWin &osContext, const HardwareInfo &hwInfo) { } } // namespace NEO