mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 05:35:19 +08:00
feature: fail stateful kernel when stateless is required
Resolves: NEO-11859 Signed-off-by: Damian Tomczak <damian.tomczak@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
f411dc2e65
commit
bb742a88a4
@@ -7,6 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/helpers/compiler_product_helper.h"
|
||||
#include "shared/test/common/libult/global_environment.h"
|
||||
#include "shared/test/common/mocks/mock_modules_zebin.h"
|
||||
|
||||
@@ -19,16 +20,18 @@ template <size_t binariesCount = 1u, Elf::ElfIdentifierClass numBits = is32bit ?
|
||||
struct MockZebinWrapper {
|
||||
using Descriptor = ZebinTestData::ZebinCopyBufferModule<numBits>::Descriptor;
|
||||
|
||||
MockZebinWrapper(const HardwareInfo &hwInfo, Descriptor desc)
|
||||
: data(hwInfo, desc) {
|
||||
std::fill_n(binaries.begin(), binariesCount, reinterpret_cast<const unsigned char *>(this->data.storage.data()));
|
||||
std::fill_n(binarySizes.begin(), binariesCount, this->data.storage.size());
|
||||
MockZebinWrapper(const HardwareInfo &hwInfo, Descriptor desc = {}) {
|
||||
auto productHelper = NEO::CompilerProductHelper::create(defaultHwInfo->platform.eProductFamily);
|
||||
desc.isStateless = productHelper->isForceToStatelessRequired();
|
||||
|
||||
data = std::make_unique<ZebinTestData::ZebinCopyBufferModule<numBits>>(hwInfo, desc);
|
||||
|
||||
std::fill_n(binaries.begin(), binariesCount, reinterpret_cast<const unsigned char *>(this->data->storage.data()));
|
||||
std::fill_n(binarySizes.begin(), binariesCount, this->data->storage.size());
|
||||
}
|
||||
|
||||
MockZebinWrapper(const HardwareInfo &hwInfo) : MockZebinWrapper(hwInfo, Descriptor{}) {}
|
||||
|
||||
auto &getFlags() {
|
||||
return reinterpret_cast<Zebin::Elf::ZebinTargetFlags &>(this->data.elfHeader->flags);
|
||||
return reinterpret_cast<Zebin::Elf::ZebinTargetFlags &>(this->data->elfHeader->flags);
|
||||
}
|
||||
|
||||
void setAsMockCompilerReturnedBinary() {
|
||||
@@ -57,7 +60,7 @@ struct MockZebinWrapper {
|
||||
}};
|
||||
}
|
||||
|
||||
ZebinTestData::ZebinCopyBufferModule<numBits> data;
|
||||
std::unique_ptr<ZebinTestData::ZebinCopyBufferModule<numBits>> data;
|
||||
std::array<const unsigned char *, binariesCount> binaries;
|
||||
std::array<size_t, binariesCount> binarySizes;
|
||||
std::unique_ptr<void, void (*)(void *)> debugVarsRestore{nullptr, nullptr};
|
||||
@@ -80,4 +83,4 @@ class FixtureWithMockZebin {
|
||||
const char *sources[1] = {sourceKernel};
|
||||
std::unique_ptr<MockZebinWrapper<>> zebinPtr;
|
||||
};
|
||||
} // namespace NEO
|
||||
} // namespace NEO
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "shared/test/common/helpers/gtest_helpers.h"
|
||||
#include "shared/test/common/helpers/unit_test_helper.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/mocks/mock_release_helper.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
@@ -512,3 +513,17 @@ HWTEST_F(CompilerProductHelperFixture, GivenRequestForExtraKernelCapabilitiesThe
|
||||
EXPECT_EQ(0u, extraCaps);
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(CompilerProductHelperFixture, givenStatefulPlatformWhenFailBuildProgramWithStatefulAccessPreferenceThenFalseIsReturned, IsStatefulBufferPreferredForProduct) {
|
||||
MockExecutionEnvironment executionEnvironment{};
|
||||
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0];
|
||||
auto &compilerProductHelper = rootDeviceEnvironment.getHelper<CompilerProductHelper>();
|
||||
EXPECT_FALSE(compilerProductHelper.failBuildProgramWithStatefulAccessPreference());
|
||||
}
|
||||
|
||||
HWTEST2_F(CompilerProductHelperFixture, givenNotStatefulPlatformWhenFailBuildProgramWithStatefulAccessPreferenceThenTrueIsReturned, IsStatelessBufferPreferredForProduct) {
|
||||
MockExecutionEnvironment executionEnvironment{};
|
||||
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0];
|
||||
auto &compilerProductHelper = rootDeviceEnvironment.getHelper<CompilerProductHelper>();
|
||||
EXPECT_TRUE(compilerProductHelper.failBuildProgramWithStatefulAccessPreference());
|
||||
}
|
||||
|
||||
@@ -38,13 +38,6 @@ PVCTEST_F(CompilerProductHelperPvcTest, givenPvcConfigsWhenMatchConfigWithRevIdT
|
||||
EXPECT_EQ(compilerProductHelper.matchRevisionIdWithProductConfig(AOT::PVC_XT_C0_VG, 0x2f), AOT::PVC_XT_C0_VG);
|
||||
}
|
||||
|
||||
PVCTEST_F(CompilerProductHelperPvcTest, givenPvcWhenFailBuildProgramWithStatefulAccessPreferenceThenFalseIsReturned) {
|
||||
MockExecutionEnvironment executionEnvironment{};
|
||||
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0];
|
||||
auto &compilerProductHelper = rootDeviceEnvironment.getHelper<CompilerProductHelper>();
|
||||
EXPECT_FALSE(compilerProductHelper.failBuildProgramWithStatefulAccessPreference());
|
||||
}
|
||||
|
||||
PVCTEST_F(CompilerProductHelperPvcTest, givenPvcB0AndLaterThenMatrixMultiplyAccumulateTF32IsSupported) {
|
||||
MockExecutionEnvironment executionEnvironment{};
|
||||
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0];
|
||||
|
||||
Reference in New Issue
Block a user