mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23:03:02 +08:00
feature: don't allow to build program with stateful accesses on PVC
Related-To: NEO-6075 Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
0605716499
commit
52651991c2
@@ -73,6 +73,8 @@ void ModuleImmutableDataFixture::MockKernel::setCrossThreadData(uint32_t dataSiz
|
||||
}
|
||||
|
||||
void ModuleImmutableDataFixture::setUp() {
|
||||
DebugManager.flags.FailBuildProgramWithStatefulAccess.set(0);
|
||||
|
||||
auto hwInfo = NEO::defaultHwInfo.get();
|
||||
if (DebugManager.flags.OverrideRevision.get() != -1) {
|
||||
this->copyHwInfo = *NEO::defaultHwInfo.get();
|
||||
@@ -86,6 +88,9 @@ void ModuleImmutableDataFixture::setUp() {
|
||||
}
|
||||
|
||||
void ModuleImmutableDataFixture::createModuleFromMockBinary(uint32_t perHwThreadPrivateMemorySize, bool isInternal, MockImmutableData *mockKernelImmData, std::initializer_list<ZebinTestData::appendElfAdditionalSection> additionalSections) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.FailBuildProgramWithStatefulAccess.set(0);
|
||||
|
||||
zebinData = std::make_unique<ZebinTestData::ZebinWithL0TestCommonModule>(device->getHwInfo(), additionalSections);
|
||||
const auto &src = zebinData->storage;
|
||||
|
||||
@@ -133,6 +138,7 @@ L0::Module *ModuleFixture::ProxyModuleImp::create(L0::Device *device, const ze_m
|
||||
}
|
||||
|
||||
void ModuleFixture::setUp() {
|
||||
DebugManager.flags.FailBuildProgramWithStatefulAccess.set(0);
|
||||
|
||||
DeviceFixture::setUp();
|
||||
createModuleFromMockBinary();
|
||||
@@ -183,6 +189,9 @@ void MultiDeviceModuleFixture::setUp() {
|
||||
}
|
||||
|
||||
void MultiDeviceModuleFixture::createModuleFromMockBinary(uint32_t rootDeviceIndex) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.FailBuildProgramWithStatefulAccess.set(0);
|
||||
|
||||
auto device = driverHandle->devices[rootDeviceIndex];
|
||||
zebinData = std::make_unique<ZebinTestData::ZebinWithL0TestCommonModule>(device->getHwInfo());
|
||||
const auto &src = zebinData->storage;
|
||||
|
||||
@@ -116,6 +116,7 @@ struct ModuleImmutableDataFixture : public DeviceFixture {
|
||||
std::unique_ptr<MockModule> module;
|
||||
std::unique_ptr<ZebinTestData::ZebinWithL0TestCommonModule> zebinData;
|
||||
MockImmutableMemoryManager *memoryManager;
|
||||
DebugManagerStateRestore restore;
|
||||
};
|
||||
|
||||
struct ModuleFixture : public DeviceFixture {
|
||||
@@ -146,6 +147,7 @@ struct ModuleFixture : public DeviceFixture {
|
||||
std::unique_ptr<L0::Module> module;
|
||||
std::unique_ptr<WhiteBox<::L0::Kernel>> kernel;
|
||||
std::unique_ptr<ZebinTestData::ZebinWithL0TestCommonModule> zebinData;
|
||||
DebugManagerStateRestore restore;
|
||||
};
|
||||
|
||||
struct MultiDeviceModuleFixture : public MultiDeviceFixture {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/compiler_interface/external_functions.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/debugger/debugger_l0.h"
|
||||
#include "shared/source/device_binary_format/patchtokens_decoder.h"
|
||||
#include "shared/source/helpers/bindless_heaps_helper.h"
|
||||
@@ -1392,6 +1393,7 @@ class KernelPropertiesTests : public ModuleFixture, public ::testing::Test {
|
||||
using KernelImp::kernelHasIndirectAccess;
|
||||
};
|
||||
void SetUp() override {
|
||||
DebugManager.flags.FailBuildProgramWithStatefulAccess.set(0);
|
||||
ModuleFixture::setUp();
|
||||
|
||||
ze_kernel_desc_t kernelDesc = {};
|
||||
@@ -1411,6 +1413,7 @@ class KernelPropertiesTests : public ModuleFixture, public ::testing::Test {
|
||||
|
||||
ze_kernel_handle_t kernelHandle;
|
||||
MockKernel *kernel = nullptr;
|
||||
DebugManagerStateRestore restore;
|
||||
};
|
||||
|
||||
TEST_F(KernelPropertiesTests, givenKernelThenCorrectNameIsRetrieved) {
|
||||
|
||||
@@ -3131,6 +3131,8 @@ TEST_F(MultipleDevicePeerAllocationFailTest,
|
||||
|
||||
struct MultipleDevicePeerAllocationTest : public ::testing::Test {
|
||||
void createModuleFromMockBinary(L0::Device *device, ModuleType type = ModuleType::User) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.FailBuildProgramWithStatefulAccess.set(0);
|
||||
auto zebinData = std::make_unique<ZebinTestData::ZebinWithL0TestCommonModule>(device->getHwInfo());
|
||||
const auto &src = zebinData->storage;
|
||||
ze_module_desc_t moduleDesc = {};
|
||||
@@ -3145,6 +3147,7 @@ struct MultipleDevicePeerAllocationTest : public ::testing::Test {
|
||||
|
||||
void SetUp() override {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.FailBuildProgramWithStatefulAccess.set(0);
|
||||
|
||||
DebugManager.flags.CreateMultipleSubDevices.set(numSubDevices);
|
||||
VariableBackup<bool> mockDeviceFlagBackup(&MockDevice::createSingleDevice, false);
|
||||
|
||||
@@ -2203,6 +2203,8 @@ HWTEST_F(MultiDeviceModuleSetArgBufferTest,
|
||||
using ContextModuleCreateTest = Test<DeviceFixture>;
|
||||
|
||||
HWTEST_F(ContextModuleCreateTest, givenCallToCreateModuleThenModuleIsReturned) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.FailBuildProgramWithStatefulAccess.set(0);
|
||||
auto zebinData = std::make_unique<ZebinTestData::ZebinWithL0TestCommonModule>(device->getHwInfo());
|
||||
const auto &src = zebinData->storage;
|
||||
|
||||
@@ -2237,6 +2239,7 @@ struct MockModuleTU : public L0::ModuleTranslationUnit {
|
||||
}
|
||||
|
||||
ze_result_t createFromNativeBinary(const char *input, size_t inputSize) override {
|
||||
DebugManager.flags.FailBuildProgramWithStatefulAccess.set(0);
|
||||
wasCreateFromNativeBinaryCalled = true;
|
||||
return L0::ModuleTranslationUnit::createFromNativeBinary(input, inputSize);
|
||||
}
|
||||
@@ -2244,6 +2247,7 @@ struct MockModuleTU : public L0::ModuleTranslationUnit {
|
||||
bool callRealBuildFromSpirv = false;
|
||||
bool wasBuildFromSpirVCalled = false;
|
||||
bool wasCreateFromNativeBinaryCalled = false;
|
||||
DebugManagerStateRestore restore;
|
||||
};
|
||||
|
||||
HWTEST_F(ModuleTranslationUnitTest, GivenRebuildPrecompiledKernelsFlagAndFileWithoutIntermediateCodeWhenCreatingModuleFromNativeBinaryThenModuleIsNotRecompiled) {
|
||||
@@ -2924,6 +2928,8 @@ TEST(ModuleBuildLog, WhenTooSmallBufferIsPassedToGetStringThenErrorIsReturned) {
|
||||
using PrintfModuleTest = Test<DeviceFixture>;
|
||||
|
||||
HWTEST_F(PrintfModuleTest, GivenModuleWithPrintfWhenKernelIsCreatedThenPrintfAllocationIsPlacedInResidencyContainer) {
|
||||
DebugManagerStateRestore restore{};
|
||||
DebugManager.flags.FailBuildProgramWithStatefulAccess.set(0);
|
||||
auto zebinData = std::make_unique<ZebinTestData::ZebinWithL0TestCommonModule>(device->getHwInfo());
|
||||
const auto &src = zebinData->storage;
|
||||
|
||||
@@ -3258,8 +3264,10 @@ TEST_F(ModuleInitializeTest, whenModuleInitializeIsCalledThenCorrectResultIsRetu
|
||||
moduleDesc.pInputModule = reinterpret_cast<const uint8_t *>(src.data());
|
||||
moduleDesc.inputSize = src.size();
|
||||
|
||||
std::array<std::tuple<ze_result_t, bool, bool, ModuleType, int32_t>, 6> testParams = {{
|
||||
std::array<std::tuple<ze_result_t, bool, bool, ModuleType, int32_t>, 8> testParams = {{
|
||||
{ZE_RESULT_SUCCESS, false, true, ModuleType::Builtin, -1},
|
||||
{ZE_RESULT_SUCCESS, true, true, ModuleType::User, -1},
|
||||
{ZE_RESULT_SUCCESS, true, false, ModuleType::User, -1},
|
||||
{ZE_RESULT_SUCCESS, true, true, ModuleType::Builtin, 0},
|
||||
{ZE_RESULT_SUCCESS, true, true, ModuleType::User, 0},
|
||||
{ZE_RESULT_SUCCESS, true, true, ModuleType::Builtin, 1},
|
||||
@@ -3273,6 +3281,13 @@ TEST_F(ModuleInitializeTest, whenModuleInitializeIsCalledThenCorrectResultIsRetu
|
||||
module.translationUnit->isGeneratedByIgc = isIgcGenerated;
|
||||
DebugManager.flags.FailBuildProgramWithStatefulAccess.set(debugKey);
|
||||
module.setAddressingMode(isStateful);
|
||||
|
||||
if (isStateful && debugKey == -1 && isIgcGenerated == true) {
|
||||
if (compilerProductHelper.failBuildProgramWithStatefulAccessPreference() == true) {
|
||||
expectedResult = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
EXPECT_EQ(expectedResult, module.initialize(&moduleDesc, device->getNEODevice()));
|
||||
}
|
||||
}
|
||||
@@ -3917,6 +3932,8 @@ HWTEST_F(ModuleWithZebinTest, givenZebinWithKernelCallingExternalFunctionThenUpd
|
||||
|
||||
using ModuleKernelImmDatasTest = Test<ModuleFixture>;
|
||||
TEST_F(ModuleKernelImmDatasTest, givenDeviceOOMWhenMemoryManagerFailsToAllocateMemoryThenReturnInformativeErrorToTheCaller) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.FailBuildProgramWithStatefulAccess.set(0);
|
||||
|
||||
auto zebinData = std::make_unique<ZebinTestData::ZebinWithL0TestCommonModule>(device->getHwInfo());
|
||||
const auto &src = zebinData->storage;
|
||||
|
||||
@@ -24,6 +24,7 @@ class ModuleOnlineCompiled : public DeviceFixture, public testing::Test {
|
||||
public:
|
||||
void SetUp() override {
|
||||
DeviceFixture::setUp();
|
||||
DebugManager.flags.FailBuildProgramWithStatefulAccess.set(0);
|
||||
|
||||
auto zebinData = std::make_unique<ZebinTestData::ZebinWithL0TestCommonModule>(device->getHwInfo());
|
||||
const auto &src = zebinData->storage;
|
||||
@@ -42,6 +43,7 @@ class ModuleOnlineCompiled : public DeviceFixture, public testing::Test {
|
||||
DeviceFixture::tearDown();
|
||||
}
|
||||
std::unique_ptr<WhiteBox<L0::Module>> module;
|
||||
DebugManagerStateRestore restore;
|
||||
};
|
||||
|
||||
using ModuleTests = Test<DeviceFixture>;
|
||||
|
||||
Reference in New Issue
Block a user