mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
refactor: correct variable naming
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
824cdfa585
commit
c3d3a4db1f
@@ -30,13 +30,13 @@ struct CmdValidatorWithStaticStorage : CmdValidator {
|
||||
}
|
||||
};
|
||||
|
||||
template <typename CmdT, typename ReturnT, ReturnT (CmdT::*Getter)() const, ReturnT Expected>
|
||||
struct GenericCmdValidator : CmdValidatorWithStaticStorage<GenericCmdValidator<CmdT, ReturnT, Getter, Expected>> {
|
||||
template <typename CmdT, typename ReturnT, ReturnT (CmdT::*getter)() const, ReturnT expected>
|
||||
struct GenericCmdValidator : CmdValidatorWithStaticStorage<GenericCmdValidator<CmdT, ReturnT, getter, expected>> {
|
||||
bool operator()(GenCmdList::iterator it, size_t numInSection, const std::string &member, std::string &outFailReason) override {
|
||||
auto cmd = genCmdCast<CmdT *>(*it);
|
||||
UNRECOVERABLE_IF(cmd == nullptr);
|
||||
if (Expected != (cmd->*Getter)()) {
|
||||
outFailReason = member + " - expected: " + std::to_string(Expected) + ", got: " + std::to_string((cmd->*Getter)());
|
||||
if (expected != (cmd->*getter)()) {
|
||||
outFailReason = member + " - expected: " + std::to_string(expected) + ", got: " + std::to_string((cmd->*getter)());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -90,12 +90,12 @@ struct MatchCmd {
|
||||
bool matchesAny = false;
|
||||
};
|
||||
|
||||
inline constexpr int32_t AnyNumber = -1;
|
||||
inline constexpr int32_t AtLeastOne = -2;
|
||||
inline constexpr int32_t anyNumber = -1;
|
||||
inline constexpr int32_t atLeastOne = -2;
|
||||
inline std::string countToString(int32_t count) {
|
||||
if (count == AnyNumber) {
|
||||
if (count == anyNumber) {
|
||||
return "AnyNumber";
|
||||
} else if (count == AtLeastOne) {
|
||||
} else if (count == atLeastOne) {
|
||||
return "AtLeastOne";
|
||||
} else {
|
||||
return std::to_string(count);
|
||||
@@ -103,7 +103,7 @@ inline std::string countToString(int32_t count) {
|
||||
}
|
||||
|
||||
inline bool notPreciseNumber(int32_t count) {
|
||||
return (count == AnyNumber) || (count == AtLeastOne);
|
||||
return (count == anyNumber) || (count == atLeastOne);
|
||||
}
|
||||
|
||||
struct MatchAnyCmd : MatchCmd {
|
||||
@@ -204,7 +204,7 @@ inline bool expectCmdBuff(GenCmdList::iterator begin, GenCmdList::iterator end,
|
||||
while (it != end) {
|
||||
if (currentMatcher < expectedCmdBuffMatchers.size()) {
|
||||
auto currentMatcherExpectedCount = expectedCmdBuffMatchers[currentMatcher]->getExpectedCount();
|
||||
if (expectedCmdBuffMatchers[currentMatcher]->getMatchesAny() && ((currentMatcherExpectedCount == AnyNumber) || ((currentMatcherExpectedCount == AtLeastOne) && (currentMatcherCount > 0)))) {
|
||||
if (expectedCmdBuffMatchers[currentMatcher]->getMatchesAny() && ((currentMatcherExpectedCount == anyNumber) || ((currentMatcherExpectedCount == atLeastOne) && (currentMatcherCount > 0)))) {
|
||||
if (expectedCmdBuffMatchers.size() > currentMatcher + 1) {
|
||||
// eat as many as possible but proceed to next matcher when possible
|
||||
if (expectedCmdBuffMatchers[currentMatcher + 1]->matches(it)) {
|
||||
@@ -214,7 +214,7 @@ inline bool expectCmdBuff(GenCmdList::iterator begin, GenCmdList::iterator end,
|
||||
}
|
||||
} else if ((notPreciseNumber(expectedCmdBuffMatchers[currentMatcher]->getExpectedCount())) && (false == expectedCmdBuffMatchers[currentMatcher]->matches(it))) {
|
||||
// proceed to next matcher if not matched
|
||||
if ((expectedCmdBuffMatchers[currentMatcher]->getExpectedCount() == AtLeastOne) && (currentMatcherCount < 1)) {
|
||||
if ((expectedCmdBuffMatchers[currentMatcher]->getExpectedCount() == atLeastOne) && (currentMatcherCount < 1)) {
|
||||
failed = true;
|
||||
failReason = "Unmatched cmd#" + std::to_string(cmdNum) + ":" + HardwareParse::getCommandName<FamilyType>(*it) + " - expected " + std::string(expectedCmdBuffMatchers[currentMatcher]->getName()) + "(" + countToString(expectedCmdBuffMatchers[currentMatcher]->getExpectedCount()) + " - " + std::to_string(currentMatcherCount) + ") after : " + matchedCommandsString();
|
||||
break;
|
||||
@@ -271,7 +271,7 @@ inline bool expectCmdBuff(GenCmdList::iterator begin, GenCmdList::iterator end,
|
||||
}
|
||||
|
||||
if (failed == false) {
|
||||
while ((currentMatcher < expectedCmdBuffMatchers.size()) && ((expectedCmdBuffMatchers[currentMatcher]->getExpectedCount() == 0) || (expectedCmdBuffMatchers[currentMatcher]->getExpectedCount() == AnyNumber))) {
|
||||
while ((currentMatcher < expectedCmdBuffMatchers.size()) && ((expectedCmdBuffMatchers[currentMatcher]->getExpectedCount() == 0) || (expectedCmdBuffMatchers[currentMatcher]->getExpectedCount() == anyNumber))) {
|
||||
++currentMatcher;
|
||||
currentMatcherCount = 0;
|
||||
}
|
||||
@@ -281,7 +281,7 @@ inline bool expectCmdBuff(GenCmdList::iterator begin, GenCmdList::iterator end,
|
||||
} else if (currentMatcher + 1 == expectedCmdBuffMatchers.size()) {
|
||||
// last matcher
|
||||
auto currentMatcherExpectedCount = expectedCmdBuffMatchers[currentMatcher]->getExpectedCount();
|
||||
if ((currentMatcherExpectedCount == AtLeastOne) && (currentMatcherCount < 1)) {
|
||||
if ((currentMatcherExpectedCount == atLeastOne) && (currentMatcherCount < 1)) {
|
||||
failReason = "Unexpected command buffer end at cmd#" + std::to_string(cmdNum) + " - expected " + expectedCmdBuffMatchers[currentMatcher]->getName() + "(" + countToString(currentMatcherExpectedCount) + " - " + std::to_string(currentMatcherCount) + ") after : " + matchedCommandsString();
|
||||
failed = true;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -7,10 +7,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
template <size_t X, size_t Y, size_t Z>
|
||||
template <size_t x, size_t y, size_t z>
|
||||
struct StatickSize3 {
|
||||
operator const size_t *() {
|
||||
static const size_t v[] = {X, Y, Z};
|
||||
static const size_t v[] = {z, y, z};
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <atomic>
|
||||
|
||||
namespace NEO {
|
||||
static std::atomic<int> PerfTicks{0};
|
||||
static std::atomic<int> perfTicks{0};
|
||||
constexpr uint64_t convertToNs = 100;
|
||||
class MockDeviceTime : public DeviceTime {
|
||||
public:
|
||||
@@ -20,12 +20,12 @@ class MockDeviceTime : public DeviceTime {
|
||||
if (gpuTimeStampResult) {
|
||||
pGpuCpuTime->gpuTimeStamp = *gpuTimeStampResult;
|
||||
} else {
|
||||
pGpuCpuTime->gpuTimeStamp = ++PerfTicks;
|
||||
pGpuCpuTime->gpuTimeStamp = ++perfTicks;
|
||||
}
|
||||
if (cpuTimeResult) {
|
||||
pGpuCpuTime->cpuTimeinNS = *cpuTimeResult;
|
||||
} else {
|
||||
pGpuCpuTime->cpuTimeinNS = PerfTicks * convertToNs;
|
||||
pGpuCpuTime->cpuTimeinNS = perfTicks * convertToNs;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -53,7 +53,7 @@ class MockOSTime : public OSTime {
|
||||
if (cpuTimeResult) {
|
||||
*timeStamp = *cpuTimeResult;
|
||||
} else {
|
||||
*timeStamp = ++PerfTicks * convertToNs;
|
||||
*timeStamp = ++perfTicks * convertToNs;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -27,8 +27,8 @@ static ReleaseableObjectPtr<T> clUniquePtr(T *object) {
|
||||
return ReleaseableObjectPtr<T>{object};
|
||||
}
|
||||
|
||||
template <class _Ty, class... _Types>
|
||||
inline ReleaseableObjectPtr<_Ty> makeReleaseable(_Types &&...args) {
|
||||
return (ReleaseableObjectPtr<_Ty>(new _Ty(std::forward<_Types>(args)...)));
|
||||
template <class Type, class... Types>
|
||||
inline ReleaseableObjectPtr<Type> makeReleaseable(Types &&...args) {
|
||||
return (ReleaseableObjectPtr<Type>(new Type(std::forward<Types>(args)...)));
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using PIPE_CONTROL = typename Gen11Family::PIPE_CONTROL;
|
||||
struct Gen11MediaSamplerProgramingTest : public ::testing::Test {
|
||||
typedef typename Gen11Family::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
|
||||
typedef typename Gen11Family::PIPE_CONTROL PIPE_CONTROL;
|
||||
|
||||
struct MyCsr : public CommandStreamReceiverHw<Gen11Family> {
|
||||
using CommandStreamReceiver::commandStream;
|
||||
@@ -59,7 +59,6 @@ struct Gen11MediaSamplerProgramingTest : public ::testing::Test {
|
||||
std::unique_ptr<LinearStream> stream;
|
||||
};
|
||||
|
||||
template <typename PIPE_CONTROL>
|
||||
void setFlushAllCaches(PIPE_CONTROL &pc) {
|
||||
pc.setDcFlushEnable(true);
|
||||
pc.setRenderTargetCacheFlushEnable(true);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Intel Corporation
|
||||
* Copyright (C) 2019-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -34,13 +34,13 @@ HWTEST_F(HwParseTest, WhenEmptyBufferThenDontExpectCommands) {
|
||||
|
||||
cmdBuffOk = expectCmdBuff<FamilyType>(beg, end,
|
||||
std::vector<MatchCmd *>{
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(AnyNumber),
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(anyNumber),
|
||||
});
|
||||
EXPECT_TRUE(cmdBuffOk);
|
||||
|
||||
cmdBuffOk = expectCmdBuff<FamilyType>(beg, end,
|
||||
std::vector<MatchCmd *>{
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(AtLeastOne),
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(atLeastOne),
|
||||
});
|
||||
EXPECT_FALSE(cmdBuffOk);
|
||||
|
||||
@@ -70,13 +70,13 @@ HWTEST_F(HwParseTest, WhenExpectingAnyCommandThenAllCommandsAreValidAsLongAsTheC
|
||||
|
||||
cmdBuffOk = expectCmdBuff<FamilyType>(stream, 0,
|
||||
std::vector<MatchCmd *>{
|
||||
new MatchAnyCmd(AtLeastOne),
|
||||
new MatchAnyCmd(atLeastOne),
|
||||
});
|
||||
EXPECT_TRUE(cmdBuffOk);
|
||||
|
||||
cmdBuffOk = expectCmdBuff<FamilyType>(stream, 0,
|
||||
std::vector<MatchCmd *>{
|
||||
new MatchAnyCmd(AnyNumber),
|
||||
new MatchAnyCmd(anyNumber),
|
||||
});
|
||||
EXPECT_TRUE(cmdBuffOk);
|
||||
|
||||
@@ -93,7 +93,7 @@ HWTEST_F(HwParseTest, WhenExpectingAnyCommandThenAllCommandsAreValidAsLongAsTheC
|
||||
new MatchAnyCmd(1),
|
||||
new MatchAnyCmd(1),
|
||||
new MatchAnyCmd(1),
|
||||
new MatchAnyCmd(AtLeastOne)});
|
||||
new MatchAnyCmd(atLeastOne)});
|
||||
EXPECT_FALSE(cmdBuffOk);
|
||||
|
||||
cmdBuffOk = expectCmdBuff<FamilyType>(stream, 0,
|
||||
@@ -101,18 +101,18 @@ HWTEST_F(HwParseTest, WhenExpectingAnyCommandThenAllCommandsAreValidAsLongAsTheC
|
||||
new MatchAnyCmd(1),
|
||||
new MatchAnyCmd(1),
|
||||
new MatchAnyCmd(1),
|
||||
new MatchAnyCmd(AnyNumber)});
|
||||
new MatchAnyCmd(anyNumber)});
|
||||
EXPECT_TRUE(cmdBuffOk);
|
||||
|
||||
cmdBuffOk = expectCmdBuff<FamilyType>(stream, 0,
|
||||
std::vector<MatchCmd *>{
|
||||
new MatchAnyCmd(AtLeastOne),
|
||||
new MatchAnyCmd(atLeastOne),
|
||||
new MatchAnyCmd(1)});
|
||||
EXPECT_FALSE(cmdBuffOk);
|
||||
|
||||
cmdBuffOk = expectCmdBuff<FamilyType>(stream, 0,
|
||||
std::vector<MatchCmd *>{
|
||||
new MatchAnyCmd(AnyNumber),
|
||||
new MatchAnyCmd(anyNumber),
|
||||
new MatchAnyCmd(1)});
|
||||
EXPECT_FALSE(cmdBuffOk);
|
||||
|
||||
@@ -217,40 +217,40 @@ HWTEST_F(HwParseTest, WhenExpectingAnyNumberOfCommandsThenOnlyTypeOfCommandMatte
|
||||
cmdBuffOk = expectCmdBuff<FamilyType>(stream, 0,
|
||||
std::vector<MatchCmd *>{
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(1),
|
||||
new MatchHwCmd<FamilyType, STATE_BASE_ADDRESS>(AnyNumber),
|
||||
new MatchHwCmd<FamilyType, STATE_BASE_ADDRESS>(anyNumber),
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(1)});
|
||||
EXPECT_TRUE(cmdBuffOk);
|
||||
|
||||
cmdBuffOk = expectCmdBuff<FamilyType>(stream, 0,
|
||||
std::vector<MatchCmd *>{
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(AnyNumber),
|
||||
new MatchHwCmd<FamilyType, STATE_BASE_ADDRESS>(AnyNumber),
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(AnyNumber)});
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(anyNumber),
|
||||
new MatchHwCmd<FamilyType, STATE_BASE_ADDRESS>(anyNumber),
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(anyNumber)});
|
||||
EXPECT_TRUE(cmdBuffOk);
|
||||
|
||||
cmdBuffOk = expectCmdBuff<FamilyType>(stream, 0,
|
||||
std::vector<MatchCmd *>{
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(AtLeastOne),
|
||||
new MatchHwCmd<FamilyType, STATE_BASE_ADDRESS>(AtLeastOne),
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(AtLeastOne)});
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(atLeastOne),
|
||||
new MatchHwCmd<FamilyType, STATE_BASE_ADDRESS>(atLeastOne),
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(atLeastOne)});
|
||||
EXPECT_TRUE(cmdBuffOk);
|
||||
|
||||
cmdBuffOk = expectCmdBuff<FamilyType>(stream, 0,
|
||||
std::vector<MatchCmd *>{
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(AtLeastOne),
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(AtLeastOne),
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(AtLeastOne),
|
||||
new MatchHwCmd<FamilyType, STATE_BASE_ADDRESS>(AtLeastOne),
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(AtLeastOne),
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(atLeastOne),
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(atLeastOne),
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(atLeastOne),
|
||||
new MatchHwCmd<FamilyType, STATE_BASE_ADDRESS>(atLeastOne),
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(atLeastOne),
|
||||
});
|
||||
EXPECT_FALSE(cmdBuffOk);
|
||||
|
||||
cmdBuffOk = expectCmdBuff<FamilyType>(stream, 0,
|
||||
std::vector<MatchCmd *>{
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(AnyNumber),
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(anyNumber),
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(0),
|
||||
new MatchHwCmd<FamilyType, STATE_BASE_ADDRESS>(AnyNumber),
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(AnyNumber),
|
||||
new MatchHwCmd<FamilyType, STATE_BASE_ADDRESS>(anyNumber),
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(anyNumber),
|
||||
new MatchHwCmd<FamilyType, STATE_BASE_ADDRESS>(0)});
|
||||
EXPECT_TRUE(cmdBuffOk);
|
||||
}
|
||||
@@ -269,15 +269,15 @@ HWTEST_F(HwParseTest, WhenCommandMemberValidatorFailsThenCommandBufferValidation
|
||||
|
||||
cmdBuffOk = expectCmdBuff<FamilyType>(stream, 0,
|
||||
std::vector<MatchCmd *>{
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(AnyNumber),
|
||||
new MatchHwCmd<FamilyType, STATE_BASE_ADDRESS>(AnyNumber, Expects{EXPECT_MEMBER(STATE_BASE_ADDRESS, getGeneralStateBaseAddressModifyEnable, true)}),
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(AnyNumber)});
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(anyNumber),
|
||||
new MatchHwCmd<FamilyType, STATE_BASE_ADDRESS>(anyNumber, Expects{EXPECT_MEMBER(STATE_BASE_ADDRESS, getGeneralStateBaseAddressModifyEnable, true)}),
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(anyNumber)});
|
||||
EXPECT_TRUE(cmdBuffOk);
|
||||
|
||||
cmdBuffOk = expectCmdBuff<FamilyType>(stream, 0,
|
||||
std::vector<MatchCmd *>{
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(AnyNumber),
|
||||
new MatchHwCmd<FamilyType, STATE_BASE_ADDRESS>(AnyNumber, Expects{EXPECT_MEMBER(STATE_BASE_ADDRESS, getGeneralStateBaseAddressModifyEnable, false)}),
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(AnyNumber)});
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(anyNumber),
|
||||
new MatchHwCmd<FamilyType, STATE_BASE_ADDRESS>(anyNumber, Expects{EXPECT_MEMBER(STATE_BASE_ADDRESS, getGeneralStateBaseAddressModifyEnable, false)}),
|
||||
new MatchHwCmd<FamilyType, PIPE_CONTROL>(anyNumber)});
|
||||
EXPECT_FALSE(cmdBuffOk);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user