2023-01-11 16:46:43 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2023 Intel Corporation
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2023-11-16 19:04:39 +01:00
|
|
|
#include "shared/source/ail/ail_configuration.h"
|
2023-02-17 15:40:18 +00:00
|
|
|
#include "shared/test/common/helpers/default_hw_info.h"
|
|
|
|
|
#include "shared/test/common/helpers/variable_backup.h"
|
2023-01-11 16:46:43 +00:00
|
|
|
#include "shared/test/common/test_macros/hw_test.h"
|
|
|
|
|
|
|
|
|
|
namespace NEO {
|
|
|
|
|
|
2023-02-10 15:05:50 +00:00
|
|
|
using AILBaseTests = ::testing::Test;
|
2023-01-11 16:46:43 +00:00
|
|
|
|
2023-02-10 15:05:50 +00:00
|
|
|
HWTEST2_F(AILBaseTests, whenKernelSourceIsANGenDummyKernelThenDoEnforcePatchtokensFormat, IsAtLeastSkl) {
|
2023-01-11 16:46:43 +00:00
|
|
|
std::string dummyKernelSource{"kernel void _(){}"};
|
2023-02-10 15:05:50 +00:00
|
|
|
AILConfigurationHw<productFamily> ail;
|
2023-03-03 13:23:24 +00:00
|
|
|
EXPECT_TRUE(ail.isFallbackToPatchtokensRequired(dummyKernelSource));
|
2023-01-11 16:46:43 +00:00
|
|
|
}
|
|
|
|
|
|
2023-02-10 15:05:50 +00:00
|
|
|
HWTEST2_F(AILBaseTests, whenKernelSourceIsNotANGenDummyKernelThenDoNotEnforcePatchtokensFormat, IsAtLeastSkl) {
|
2023-01-11 16:46:43 +00:00
|
|
|
std::string dummyKernelSource{"kernel void copybuffer(__global int* a, __global int* b){ //some code }"};
|
2023-02-10 15:05:50 +00:00
|
|
|
AILConfigurationHw<productFamily> ail;
|
2023-03-03 13:23:24 +00:00
|
|
|
EXPECT_FALSE(ail.isFallbackToPatchtokensRequired(dummyKernelSource));
|
2023-01-11 16:46:43 +00:00
|
|
|
}
|
|
|
|
|
|
2023-02-17 17:02:34 +00:00
|
|
|
HWTEST2_F(AILBaseTests, givenApplicationNamesThatRequirAILWhenCheckingIfPatchtokenFallbackIsRequiredThenIsCorrectResult, IsAtLeastSkl) {
|
2023-11-16 19:04:39 +01:00
|
|
|
class AILMock : public AILConfigurationHw<productFamily> {
|
|
|
|
|
public:
|
|
|
|
|
using AILConfiguration::processName;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
VariableBackup<AILConfiguration *> ailConfigurationBackup(&ailConfigurationTable[productFamily]);
|
|
|
|
|
AILMock ail;
|
|
|
|
|
ailConfigurationTable[productFamily] = &ail;
|
|
|
|
|
|
2023-02-17 15:40:18 +00:00
|
|
|
for (const auto &name : {"Resolve",
|
|
|
|
|
"ArcControlAssist",
|
|
|
|
|
"ArcControl"}) {
|
|
|
|
|
ail.processName = name;
|
2023-03-03 13:23:24 +00:00
|
|
|
EXPECT_TRUE(ail.isFallbackToPatchtokensRequired(""));
|
2023-02-17 15:40:18 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace NEO
|