refactor: indirect detection helpers, VC
Allow for different required version for VC compiled kernels. Define constant for detection disabled. Related-To: NEO-12491 Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
parent
f5b88f085a
commit
3bd2befe74
|
@ -12,5 +12,6 @@
|
|||
namespace NEO {
|
||||
namespace IndirectDetectionVersions {
|
||||
constexpr uint32_t requiredDetectIndirectVersionPVC = 3u;
|
||||
}
|
||||
constexpr uint32_t disabled = std::numeric_limits<uint32_t>::max();
|
||||
} // namespace IndirectDetectionVersions
|
||||
} // namespace NEO
|
|
@ -189,6 +189,7 @@ class ProductHelper {
|
|||
virtual bool isDummyBlitWaRequired() const = 0;
|
||||
virtual bool isDetectIndirectAccessInKernelSupported(const KernelDescriptor &kernelDescriptor, const bool isPrecompiled, const uint32_t precompiledKernelIndirectDetectionVersion) const = 0;
|
||||
virtual uint32_t getRequiredDetectIndirectVersion() const = 0;
|
||||
virtual uint32_t getRequiredDetectIndirectVersionVC() const = 0;
|
||||
virtual bool isLinearStoragePreferred(bool isImage1d, bool forceLinearStorage) const = 0;
|
||||
virtual bool isTranslationExceptionSupported() const = 0;
|
||||
virtual uint32_t getMaxNumSamplers() const = 0;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/helpers/cache_policy.h"
|
||||
#include "shared/source/helpers/constants.h"
|
||||
#include "shared/source/helpers/definitions/indirect_detection_versions.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/helpers/hw_mapper.h"
|
||||
#include "shared/source/helpers/local_memory_access_modes.h"
|
||||
|
@ -71,19 +72,32 @@ bool ProductHelperHw<gfxProduct>::isTlbFlushRequired() const {
|
|||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
bool ProductHelperHw<gfxProduct>::isDetectIndirectAccessInKernelSupported(const KernelDescriptor &kernelDescriptor, const bool isPrecompiled, const uint32_t precompiledKernelIndirectDetectionVersion) const {
|
||||
if (std::numeric_limits<uint32_t>::max() == getRequiredDetectIndirectVersion()) {
|
||||
return false;
|
||||
}
|
||||
const bool isZebin = kernelDescriptor.kernelAttributes.binaryFormat == DeviceBinaryFormat::zebin;
|
||||
const bool isCMKernelHeuristic = kernelDescriptor.kernelAttributes.simdSize == 1;
|
||||
const bool isZebin = kernelDescriptor.kernelAttributes.binaryFormat == DeviceBinaryFormat::zebin;
|
||||
const auto currentIndirectDetectionVersion = isPrecompiled ? precompiledKernelIndirectDetectionVersion : INDIRECT_ACCESS_DETECTION_VERSION;
|
||||
const bool indirectDetectionValid = currentIndirectDetectionVersion >= getRequiredDetectIndirectVersion();
|
||||
return isZebin && indirectDetectionValid && !isCMKernelHeuristic;
|
||||
bool indirectDetectionValid = false;
|
||||
if (isCMKernelHeuristic) {
|
||||
if (IndirectDetectionVersions::disabled == getRequiredDetectIndirectVersionVC()) {
|
||||
return false;
|
||||
}
|
||||
indirectDetectionValid = currentIndirectDetectionVersion >= getRequiredDetectIndirectVersionVC();
|
||||
} else {
|
||||
if (IndirectDetectionVersions::disabled == getRequiredDetectIndirectVersion()) {
|
||||
return false;
|
||||
}
|
||||
indirectDetectionValid = currentIndirectDetectionVersion >= getRequiredDetectIndirectVersion();
|
||||
}
|
||||
return isZebin && indirectDetectionValid;
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
uint32_t ProductHelperHw<gfxProduct>::getRequiredDetectIndirectVersion() const {
|
||||
return std::numeric_limits<uint32_t>::max();
|
||||
return IndirectDetectionVersions::disabled;
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
uint32_t ProductHelperHw<gfxProduct>::getRequiredDetectIndirectVersionVC() const {
|
||||
return IndirectDetectionVersions::disabled;
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
|
|
|
@ -132,6 +132,7 @@ class ProductHelperHw : public ProductHelper {
|
|||
bool isDummyBlitWaRequired() const override;
|
||||
bool isDetectIndirectAccessInKernelSupported(const KernelDescriptor &kernelDescriptor, const bool isPrecompiled, const uint32_t precompiledKernelIndirectDetectionVersion) const override;
|
||||
uint32_t getRequiredDetectIndirectVersion() const override;
|
||||
uint32_t getRequiredDetectIndirectVersionVC() const override;
|
||||
bool isLinearStoragePreferred(bool isImage1d, bool forceLinearStorage) const override;
|
||||
bool isTranslationExceptionSupported() const override;
|
||||
uint32_t getMaxNumSamplers() const override;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "shared/test/unit_test/os_interface/product_helper_tests.h"
|
||||
|
||||
#include "shared/source/aub_mem_dump/aub_mem_dump.h"
|
||||
#include "shared/source/helpers/definitions/indirect_detection_versions.h"
|
||||
#include "shared/source/helpers/gfx_core_helper.h"
|
||||
#include "shared/source/helpers/local_memory_access_modes.h"
|
||||
#include "shared/source/kernel/kernel_descriptor.h"
|
||||
|
@ -883,69 +884,82 @@ HWTEST_F(ProductHelperTest, givenProductHelperWhenCheckDummyBlitWaRequiredThenRe
|
|||
|
||||
HWTEST_F(ProductHelperTest, givenProductHelperAndKernelBinaryFormatsWhenCheckingIsDetectIndirectAccessInKernelSupportedThenCorrectValueIsReturned) {
|
||||
KernelDescriptor kernelDescriptor;
|
||||
const auto minimalRequiredDetectIndirectVersion = productHelper->getRequiredDetectIndirectVersion();
|
||||
EXPECT_GT(minimalRequiredDetectIndirectVersion, 0u);
|
||||
const auto igcDetectIndirectVersion = INDIRECT_ACCESS_DETECTION_VERSION;
|
||||
EXPECT_LE(igcDetectIndirectVersion, minimalRequiredDetectIndirectVersion);
|
||||
const bool detectionEnabled = std::numeric_limits<uint32_t>::max() != minimalRequiredDetectIndirectVersion;
|
||||
if (detectionEnabled) {
|
||||
const uint32_t notAcceptedIndirectDetectionVersion = minimalRequiredDetectIndirectVersion - 1;
|
||||
{
|
||||
kernelDescriptor.kernelAttributes.binaryFormat = DeviceBinaryFormat::patchtokens;
|
||||
kernelDescriptor.kernelAttributes.simdSize = 8u;
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, false, notAcceptedIndirectDetectionVersion));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, true, notAcceptedIndirectDetectionVersion));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, false, minimalRequiredDetectIndirectVersion));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, true, minimalRequiredDetectIndirectVersion));
|
||||
{
|
||||
const auto minimalRequiredDetectIndirectVersion = productHelper->getRequiredDetectIndirectVersion();
|
||||
EXPECT_GT(minimalRequiredDetectIndirectVersion, 0u);
|
||||
EXPECT_LE(igcDetectIndirectVersion, minimalRequiredDetectIndirectVersion);
|
||||
const bool detectionEnabled = IndirectDetectionVersions::disabled != minimalRequiredDetectIndirectVersion;
|
||||
if (detectionEnabled) {
|
||||
const uint32_t notAcceptedIndirectDetectionVersion = minimalRequiredDetectIndirectVersion - 1;
|
||||
{
|
||||
kernelDescriptor.kernelAttributes.binaryFormat = DeviceBinaryFormat::patchtokens;
|
||||
kernelDescriptor.kernelAttributes.simdSize = 8u;
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, false, notAcceptedIndirectDetectionVersion));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, true, notAcceptedIndirectDetectionVersion));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, false, minimalRequiredDetectIndirectVersion));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, true, minimalRequiredDetectIndirectVersion));
|
||||
}
|
||||
{
|
||||
kernelDescriptor.kernelAttributes.binaryFormat = DeviceBinaryFormat::zebin;
|
||||
kernelDescriptor.kernelAttributes.simdSize = 8u;
|
||||
EXPECT_TRUE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, false, notAcceptedIndirectDetectionVersion));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, true, notAcceptedIndirectDetectionVersion));
|
||||
EXPECT_TRUE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, false, minimalRequiredDetectIndirectVersion));
|
||||
EXPECT_TRUE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, true, minimalRequiredDetectIndirectVersion));
|
||||
}
|
||||
} else { // detection disabled
|
||||
{
|
||||
kernelDescriptor.kernelAttributes.binaryFormat = DeviceBinaryFormat::patchtokens;
|
||||
kernelDescriptor.kernelAttributes.simdSize = 8u;
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, false, minimalRequiredDetectIndirectVersion));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, true, minimalRequiredDetectIndirectVersion));
|
||||
}
|
||||
{
|
||||
kernelDescriptor.kernelAttributes.binaryFormat = DeviceBinaryFormat::zebin;
|
||||
kernelDescriptor.kernelAttributes.simdSize = 8u;
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, false, minimalRequiredDetectIndirectVersion));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, true, minimalRequiredDetectIndirectVersion));
|
||||
}
|
||||
}
|
||||
{
|
||||
kernelDescriptor.kernelAttributes.binaryFormat = DeviceBinaryFormat::patchtokens;
|
||||
kernelDescriptor.kernelAttributes.simdSize = 1u;
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, false, notAcceptedIndirectDetectionVersion));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, true, notAcceptedIndirectDetectionVersion));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, false, minimalRequiredDetectIndirectVersion));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, true, minimalRequiredDetectIndirectVersion));
|
||||
}
|
||||
{
|
||||
kernelDescriptor.kernelAttributes.binaryFormat = DeviceBinaryFormat::zebin;
|
||||
kernelDescriptor.kernelAttributes.simdSize = 1u;
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, false, notAcceptedIndirectDetectionVersion));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, true, notAcceptedIndirectDetectionVersion));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, false, minimalRequiredDetectIndirectVersion));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, true, minimalRequiredDetectIndirectVersion));
|
||||
}
|
||||
{
|
||||
kernelDescriptor.kernelAttributes.binaryFormat = DeviceBinaryFormat::zebin;
|
||||
kernelDescriptor.kernelAttributes.simdSize = 8u;
|
||||
EXPECT_TRUE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, false, notAcceptedIndirectDetectionVersion));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, true, notAcceptedIndirectDetectionVersion));
|
||||
EXPECT_TRUE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, false, minimalRequiredDetectIndirectVersion));
|
||||
EXPECT_TRUE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, true, minimalRequiredDetectIndirectVersion));
|
||||
}
|
||||
} else { // detection disabled
|
||||
{
|
||||
kernelDescriptor.kernelAttributes.binaryFormat = DeviceBinaryFormat::patchtokens;
|
||||
kernelDescriptor.kernelAttributes.simdSize = 8u;
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, false, minimalRequiredDetectIndirectVersion));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, true, minimalRequiredDetectIndirectVersion));
|
||||
}
|
||||
{
|
||||
kernelDescriptor.kernelAttributes.binaryFormat = DeviceBinaryFormat::patchtokens;
|
||||
kernelDescriptor.kernelAttributes.simdSize = 1u;
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, false, minimalRequiredDetectIndirectVersion));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, true, minimalRequiredDetectIndirectVersion));
|
||||
}
|
||||
{
|
||||
kernelDescriptor.kernelAttributes.binaryFormat = DeviceBinaryFormat::zebin;
|
||||
kernelDescriptor.kernelAttributes.simdSize = 1u;
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, false, minimalRequiredDetectIndirectVersion));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, true, minimalRequiredDetectIndirectVersion));
|
||||
}
|
||||
{
|
||||
kernelDescriptor.kernelAttributes.binaryFormat = DeviceBinaryFormat::zebin;
|
||||
kernelDescriptor.kernelAttributes.simdSize = 8u;
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, false, minimalRequiredDetectIndirectVersion));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, true, minimalRequiredDetectIndirectVersion));
|
||||
}
|
||||
|
||||
{
|
||||
const auto minimalRequiredDetectIndirectVersionVC = productHelper->getRequiredDetectIndirectVersionVC();
|
||||
EXPECT_GT(minimalRequiredDetectIndirectVersionVC, 0u);
|
||||
EXPECT_LE(igcDetectIndirectVersion, minimalRequiredDetectIndirectVersionVC);
|
||||
const bool detectionEnabledVC = IndirectDetectionVersions::disabled != minimalRequiredDetectIndirectVersionVC;
|
||||
if (detectionEnabledVC) {
|
||||
const uint32_t notAcceptedIndirectDetectionVersionVC = minimalRequiredDetectIndirectVersionVC - 1;
|
||||
{
|
||||
kernelDescriptor.kernelAttributes.binaryFormat = DeviceBinaryFormat::patchtokens;
|
||||
kernelDescriptor.kernelAttributes.simdSize = 1u;
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, false, notAcceptedIndirectDetectionVersionVC));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, true, notAcceptedIndirectDetectionVersionVC));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, false, minimalRequiredDetectIndirectVersionVC));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, true, minimalRequiredDetectIndirectVersionVC));
|
||||
}
|
||||
{
|
||||
kernelDescriptor.kernelAttributes.binaryFormat = DeviceBinaryFormat::zebin;
|
||||
kernelDescriptor.kernelAttributes.simdSize = 1u;
|
||||
EXPECT_TRUE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, false, notAcceptedIndirectDetectionVersionVC));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, true, notAcceptedIndirectDetectionVersionVC));
|
||||
EXPECT_TRUE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, false, minimalRequiredDetectIndirectVersionVC));
|
||||
EXPECT_TRUE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, true, minimalRequiredDetectIndirectVersionVC));
|
||||
}
|
||||
} else { // detection disabled for VC
|
||||
{
|
||||
kernelDescriptor.kernelAttributes.binaryFormat = DeviceBinaryFormat::patchtokens;
|
||||
kernelDescriptor.kernelAttributes.simdSize = 1u;
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, false, minimalRequiredDetectIndirectVersionVC));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, true, minimalRequiredDetectIndirectVersionVC));
|
||||
}
|
||||
{
|
||||
kernelDescriptor.kernelAttributes.binaryFormat = DeviceBinaryFormat::zebin;
|
||||
kernelDescriptor.kernelAttributes.simdSize = 1u;
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, false, minimalRequiredDetectIndirectVersionVC));
|
||||
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor, true, minimalRequiredDetectIndirectVersionVC));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue