fix code issues reported by clang 14

Signed-off-by: Artur Harasimiuk <artur.harasimiuk@intel.com>
This commit is contained in:
Artur Harasimiuk
2022-04-28 16:43:27 +02:00
committed by Compute-Runtime-Automation
parent 96dd1de20c
commit a6490062a9
17 changed files with 23 additions and 50 deletions

View File

@@ -58,7 +58,6 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container,
const HardwareInfo &hwInfo = args.device->getHardwareInfo();
LinearStream *listCmdBufferStream = container.getCommandStream();
size_t sshOffset = 0;
auto threadDims = static_cast<const uint32_t *>(args.pThreadGroupDimensions);
const Vec3<size_t> threadStartVec{0, 0, 0};
@@ -94,7 +93,6 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container,
container.prepareBindfulSsh();
if (bindingTableStateCount > 0u) {
auto ssh = container.getHeapWithRequiredSizeAndAlignment(HeapType::SURFACE_STATE, args.dispatchInterface->getSurfaceStateHeapDataSize(), BINDING_TABLE_STATE::SURFACESTATEPOINTER_ALIGN_SIZE);
sshOffset = ssh->getUsed();
bindingTablePointer = static_cast<uint32_t>(EncodeSurfaceState<Family>::pushBindingTableAndSurfaceStates(
*ssh, bindingTableStateCount,
args.dispatchInterface->getSurfaceStateHeapData(),

View File

@@ -60,7 +60,6 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container,
auto pImplicitArgs = args.dispatchInterface->getImplicitArgs();
LinearStream *listCmdBufferStream = container.getCommandStream();
size_t sshOffset = 0;
auto threadDims = static_cast<const uint32_t *>(args.pThreadGroupDimensions);
const Vec3<size_t> threadStartVec{0, 0, 0};
@@ -114,7 +113,6 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container,
container.prepareBindfulSsh();
if (bindingTableStateCount > 0u) {
auto ssh = container.getHeapWithRequiredSizeAndAlignment(HeapType::SURFACE_STATE, args.dispatchInterface->getSurfaceStateHeapDataSize(), BINDING_TABLE_STATE::SURFACESTATEPOINTER_ALIGN_SIZE);
sshOffset = ssh->getUsed();
bindingTablePointer = static_cast<uint32_t>(EncodeSurfaceState<Family>::pushBindingTableAndSurfaceStates(
*ssh, bindingTableStateCount,
args.dispatchInterface->getSurfaceStateHeapData(),

View File

@@ -32,7 +32,7 @@ constexpr bool isWhitespace(char c) {
}
constexpr bool isLetter(char c) {
return ((c >= 'a') & (c <= 'z')) | ((c >= 'A') & (c <= 'Z'));
return ((c >= 'a') & (c <= 'z')) || ((c >= 'A') & (c <= 'Z'));
}
constexpr bool isNumber(char c) {
@@ -40,19 +40,19 @@ constexpr bool isNumber(char c) {
}
constexpr bool isAlphaNumeric(char c) {
return isLetter(c) | isNumber(c);
return isLetter(c) || isNumber(c);
}
constexpr bool isNameIdentifierCharacter(char c) {
return isAlphaNumeric(c) | ('_' == c);
return isAlphaNumeric(c) || ('_' == c);
}
constexpr bool isNameIdentifierBeginningCharacter(char c) {
return isLetter(c) | ('_' == c);
return isLetter(c) || ('_' == c);
}
constexpr bool isSign(char c) {
return ('+' == c) | ('-' == c);
return ('+' == c) || ('-' == c);
}
inline bool isSpecificNameIdentifier(ConstStringRef wholeText, const char *parsePos, ConstStringRef pattern) {
@@ -60,7 +60,7 @@ inline bool isSpecificNameIdentifier(ConstStringRef wholeText, const char *parse
bool hasEnoughText = (reinterpret_cast<uintptr_t>(parsePos) + pattern.size() <= reinterpret_cast<uintptr_t>(wholeText.end()));
bool isEnd = (reinterpret_cast<uintptr_t>(parsePos) + pattern.size() == reinterpret_cast<uintptr_t>(wholeText.end()));
bool matched = hasEnoughText &&
((pattern == ConstStringRef(parsePos, pattern.size())) & (isEnd || (false == isNameIdentifierCharacter(parsePos[pattern.size()]))));
((pattern == ConstStringRef(parsePos, pattern.size())) && (isEnd || (false == isNameIdentifierCharacter(parsePos[pattern.size()]))));
return matched;
}
@@ -77,7 +77,7 @@ constexpr const char *consumeNumberOrSign(ConstStringRef wholeText, const char *
if (isNumber(*parsePos)) {
auto it = parsePos + 1;
while (it < parseEnd) {
if (false == (isNumber(*it) | ('.' == *it))) {
if (false == (isNumber(*it) || ('.' == *it))) {
break;
}
++it;
@@ -644,7 +644,7 @@ inline bool YamlParser::readValueChecked<bool>(const Node &node, bool &outValue)
case 1:
return true;
case 2:
return ((token.cstrref()[1] == 'o') | (token.cstrref()[1] == 'O'));
return ((token.cstrref()[1] == 'o') || (token.cstrref()[1] == 'O'));
}
break;
}
@@ -671,7 +671,7 @@ inline bool YamlParser::readValueChecked<bool>(const Node &node, bool &outValue)
return false;
case 2:
outValue = true;
return ((token.cstrref()[1] == 'n') | (token.cstrref()[1] == 'N'));
return ((token.cstrref()[1] == 'n') || (token.cstrref()[1] == 'N'));
case 3:
outValue = false;
return equalsCaseInsensitive(ConstStringRef("ff"), ConstStringRef(token.cstrref().begin() + 1, 2));

View File

@@ -435,12 +435,10 @@ bool DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchCommandBuffer(BatchBuffe
size_t cycleSize = getSizeSwitchRingBufferSection();
size_t requiredMinimalSize = dispatchSize + cycleSize + getSizeEnd();
bool buffersSwitched = false;
getCommandBufferPositionGpuAddress(ringCommandStream.getSpace(0));
if (ringCommandStream.getAvailableSpace() < requiredMinimalSize) {
switchRingBuffers();
buffersSwitched = true;
}
handleNewResourcesSubmission();

View File

@@ -113,7 +113,7 @@ void populateKernelDescriptor(KernelDescriptor &dst, const SPatchKernelAttribute
if (it != std::string::npos) {
it += attributeReqdSubGroupSizeBeg.size();
dst.kernelMetadata.requiredSubGroupSize = 0U;
while ((attributes[it] >= '0') & (attributes[it] <= '9')) {
while ((attributes[it] >= '0') && (attributes[it] <= '9')) {
dst.kernelMetadata.requiredSubGroupSize *= 10;
dst.kernelMetadata.requiredSubGroupSize += attributes[it] - '0';
++it;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2021 Intel Corporation
* Copyright (C) 2019-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -235,7 +235,7 @@ constexpr bool equalsCaseInsensitive(const ConstStringRef &lhs, const ConstStrin
constexpr auto caseDiff = 'a' - 'A';
for (size_t i = 0, e = lhs.size(); i < e; ++i) {
if ((lhs[i] != rhs[i]) & (lhs[i] + caseDiff != rhs[i]) & (lhs[i] != rhs[i] + caseDiff)) {
if ((lhs[i] != rhs[i]) && (lhs[i] + caseDiff != rhs[i]) && (lhs[i] != rhs[i] + caseDiff)) {
return false;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -205,7 +205,7 @@ TEST(YamlConsumeNumberOrSign, GivenInvalidCharacterThenReturnCurrentParsePositio
EXPECT_EQ(plusPlusSeven.begin() + 1, NEO::Yaml::consumeNumberOrSign(plusPlusSeven, plusPlusSeven.begin()));
for (int c = std::numeric_limits<char>::min(); c <= std::numeric_limits<char>::max(); ++c) {
bool isSignOrNumber = NEO::Yaml::isSign(static_cast<char>(c)) | NEO::Yaml::isNumber(static_cast<char>(c));
bool isSignOrNumber = NEO::Yaml::isSign(static_cast<char>(c)) || NEO::Yaml::isNumber(static_cast<char>(c));
char numberStr[] = {static_cast<char>(c), '\0'};
auto expected = numberStr + (isSignOrNumber ? 1 : 0);
EXPECT_EQ(expected, NEO::Yaml::consumeNumberOrSign(ConstStringRef::fromArray(numberStr), numberStr)) << c;