Add helper method to get support for MidThread preemption for RT kernels
Move raii hw info config helper to shared Related-To: NEO-7547, NEO-7548 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
parent
be5a1c3d08
commit
b6c51c6793
|
@ -6,11 +6,11 @@
|
|||
*/
|
||||
|
||||
#include "shared/source/gmm_helper/gmm.h"
|
||||
#include "shared/test/common/helpers/raii_hw_info_config.h"
|
||||
#include "shared/test/common/mocks/mock_gmm_resource_info.h"
|
||||
|
||||
#include "opencl/source/mem_obj/image.h"
|
||||
#include "opencl/source/sharings/unified/unified_image.h"
|
||||
#include "opencl/test/unit_test/os_interface/raii_hw_info_config.h"
|
||||
#include "opencl/test/unit_test/sharings/unified/unified_sharing_fixtures.h"
|
||||
#include "opencl/test/unit_test/sharings/unified/unified_sharing_mocks.h"
|
||||
|
||||
|
|
|
@ -79,10 +79,13 @@ PreemptionMode PreemptionHelper::getDefaultPreemptionMode(const HardwareInfo &hw
|
|||
|
||||
PreemptionFlags PreemptionHelper::createPreemptionLevelFlags(Device &device, const KernelDescriptor *kernelDescriptor) {
|
||||
PreemptionFlags flags = {};
|
||||
auto &productHelper = device.getRootDeviceEnvironment().getHelper<ProductHelper>();
|
||||
if (kernelDescriptor) {
|
||||
flags.flags.disabledMidThreadPreemptionKernel = kernelDescriptor->kernelAttributes.flags.requiresDisabledMidThreadPreemption;
|
||||
flags.flags.vmeKernel = kernelDescriptor->kernelAttributes.flags.usesVme;
|
||||
flags.flags.usesFencesForReadWriteImages = kernelDescriptor->kernelAttributes.flags.usesFencesForReadWriteImages;
|
||||
|
||||
flags.flags.disabledMidThreadPreemptionKernel |= kernelDescriptor->kernelAttributes.flags.hasRTCalls && productHelper.isMidThreadPreemptionDisallowedForRayTracingKernels();
|
||||
}
|
||||
flags.flags.deviceSupportsVmePreemption = device.getDeviceInfo().vmeAvcSupportsPreemption;
|
||||
flags.flags.disablePerCtxtPreemptionGranularityControl = device.getHardwareInfo().workaroundTable.flags.waDisablePerCtxtPreemptionGranularityControl;
|
||||
|
|
|
@ -148,6 +148,7 @@ class HwInfoConfig {
|
|||
virtual bool isPlatformQuerySupported() const = 0;
|
||||
virtual bool isNonBlockingGpuSubmissionSupported() const = 0;
|
||||
virtual bool isResolveDependenciesByPipeControlsSupported(const HardwareInfo &hwInfo, bool isOOQ) const = 0;
|
||||
virtual bool isMidThreadPreemptionDisallowedForRayTracingKernels() const = 0;
|
||||
|
||||
virtual bool getFrontEndPropertyScratchSizeSupport() const = 0;
|
||||
virtual bool getFrontEndPropertyPrivateScratchSizeSupport() const = 0;
|
||||
|
@ -291,6 +292,7 @@ class HwInfoConfigHw : public HwInfoConfig {
|
|||
bool isPlatformQuerySupported() const override;
|
||||
bool isNonBlockingGpuSubmissionSupported() const override;
|
||||
bool isResolveDependenciesByPipeControlsSupported(const HardwareInfo &hwInfo, bool isOOQ) const override;
|
||||
bool isMidThreadPreemptionDisallowedForRayTracingKernels() const override;
|
||||
|
||||
bool getFrontEndPropertyScratchSizeSupport() const override;
|
||||
bool getFrontEndPropertyPrivateScratchSizeSupport() const override;
|
||||
|
|
|
@ -532,6 +532,11 @@ bool HwInfoConfigHw<gfxProduct>::isResolveDependenciesByPipeControlsSupported(co
|
|||
return enabled;
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
bool HwInfoConfigHw<gfxProduct>::isMidThreadPreemptionDisallowedForRayTracingKernels() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
void HwInfoConfigHw<gfxProduct>::fillScmPropertiesSupportStructureBase(StateComputeModePropertiesSupport &propertiesSupport) {
|
||||
propertiesSupport.coherencyRequired = getScmPropertyCoherencyRequiredSupport();
|
||||
|
|
|
@ -10,6 +10,7 @@ target_sources(neo_libult_common PRIVATE
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/batch_buffer_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gtest_helpers.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/raii_hw_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/raii_hw_info_config.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/static_size3.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ult_limits.h
|
||||
)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
|
@ -7,10 +7,12 @@
|
|||
|
||||
#include "shared/source/command_stream/preemption.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/kernel/kernel_descriptor.h"
|
||||
#include "shared/source/memory_manager/allocation_properties.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/dispatch_flags_helper.h"
|
||||
#include "shared/test/common/helpers/raii_hw_info_config.h"
|
||||
#include "shared/test/common/libult/ult_command_stream_receiver.h"
|
||||
#include "shared/test/common/mocks/mock_builtins.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
|
@ -399,3 +401,43 @@ HWCMDTEST_F(IGFX_GEN8_CORE, MidThreadPreemptionTests, WhenProgrammingPreemptionT
|
|||
alignedFree(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(MidThreadPreemptionTests, givenKernelWithRayTracingWhenGettingPreemptionFlagsThenMidThreadPreemptionIsNotDisabled) {
|
||||
|
||||
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
|
||||
KernelDescriptor kernelDescriptor{};
|
||||
|
||||
kernelDescriptor.kernelAttributes.flags.hasRTCalls = true;
|
||||
|
||||
auto flags = PreemptionHelper::createPreemptionLevelFlags(*device, &kernelDescriptor);
|
||||
EXPECT_FALSE(flags.flags.disabledMidThreadPreemptionKernel);
|
||||
}
|
||||
|
||||
class MockHwInfoConfigForRtKernels : public HwInfoConfigHw<IGFX_UNKNOWN> {
|
||||
public:
|
||||
bool isMidThreadPreemptionDisallowedForRayTracingKernels() const override {
|
||||
return !midThreadPreemptionAllowedForRayTracing;
|
||||
}
|
||||
bool midThreadPreemptionAllowedForRayTracing = true;
|
||||
};
|
||||
|
||||
HWTEST_F(MidThreadPreemptionTests, givenKernelWithRayTracingWhenGettingPreemptionFlagsThenMidThreadPreemptionIsEnabledBasedOnProductHelperCapability) {
|
||||
RAIIHwInfoConfigFactory<MockHwInfoConfigForRtKernels> hwInfoConfigBackup{defaultHwInfo->platform.eProductFamily};
|
||||
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
|
||||
KernelDescriptor kernelDescriptor{};
|
||||
|
||||
kernelDescriptor.kernelAttributes.flags.hasRTCalls = true;
|
||||
auto &productHelper = static_cast<MockHwInfoConfigForRtKernels &>(device->getRootDeviceEnvironment().getHelper<ProductHelper>());
|
||||
{
|
||||
productHelper.midThreadPreemptionAllowedForRayTracing = true;
|
||||
auto flags = PreemptionHelper::createPreemptionLevelFlags(*device, &kernelDescriptor);
|
||||
EXPECT_FALSE(flags.flags.disabledMidThreadPreemptionKernel);
|
||||
}
|
||||
{
|
||||
productHelper.midThreadPreemptionAllowedForRayTracing = false;
|
||||
auto flags = PreemptionHelper::createPreemptionLevelFlags(*device, &kernelDescriptor);
|
||||
EXPECT_TRUE(flags.flags.disabledMidThreadPreemptionKernel);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue