refactor: apply clang-format's InsertBraces rule

Formats code before InsertBraces rule is enabled.

Signed-off-by: Radoslaw Jablonski <radoslaw.jablonski@intel.com>
This commit is contained in:
Radoslaw Jablonski
2025-10-06 12:28:48 +00:00
committed by Compute-Runtime-Automation
parent 9d1da44e08
commit 54de14a9dc
184 changed files with 1286 additions and 690 deletions

View File

@@ -386,20 +386,21 @@ void BinaryDecoder::processKernel(const void *&ptr, size_t sectionSize, std::str
ptmFile << "KernelBinaryHeader:\n";
for (const auto &v : kernelHeader.fields) {
if (v.name == kernelPatchListSize.name)
if (v.name == kernelPatchListSize.name) {
kernelPatchListSize.size = readUnaligned<uint32_t>(ptr);
else if (v.name == kernelNameSize.name)
} else if (v.name == kernelNameSize.name) {
kernelNameSize.size = readUnaligned<uint32_t>(ptr);
else if (v.name == kernelHeapSize.name)
} else if (v.name == kernelHeapSize.name) {
kernelHeapSize.size = readUnaligned<uint32_t>(ptr);
else if (v.name == kernelHeapUnpaddedSize.name)
} else if (v.name == kernelHeapUnpaddedSize.name) {
kernelHeapUnpaddedSize.size = readUnaligned<uint32_t>(ptr);
else if (v.name == generalStateHeapSize.name)
} else if (v.name == generalStateHeapSize.name) {
generalStateHeapSize.size = readUnaligned<uint32_t>(ptr);
else if (v.name == dynamicStateHeapSize.name)
} else if (v.name == dynamicStateHeapSize.name) {
dynamicStateHeapSize.size = readUnaligned<uint32_t>(ptr);
else if (v.name == surfaceStateHeapSize.name)
} else if (v.name == surfaceStateHeapSize.name) {
surfaceStateHeapSize.size = readUnaligned<uint32_t>(ptr);
}
dumpField(ptr, v, ptmFile);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 Intel Corporation
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -36,8 +36,9 @@ int MultiCommand::singleBuild(const std::vector<std::string> &args) {
outFileName += ".bin";
}
if (retVal == OCLOC_SUCCESS) {
if (!quiet)
if (!quiet) {
argHelper->printf("Build succeeded.\n");
}
} else {
argHelper->printf("Build failed with error code: %d\n", retVal);
}
@@ -90,8 +91,9 @@ void MultiCommand::addAdditionalOptionsToSingleCommandLine(std::vector<std::stri
outFileName = "build_no_" + std::to_string(buildId + 1);
singleLineWithArguments.push_back(outFileName);
}
if (quiet)
if (quiet) {
singleLineWithArguments.push_back("-q");
}
}
int MultiCommand::initialize(const std::vector<std::string> &args) {

View File

@@ -137,8 +137,9 @@ class OclocArgHelper {
std::ostringstream os;
for (const auto *acronyms : {std::addressof(args)...}) {
for (const auto &acronym : *acronyms) {
if (os.tellp())
if (os.tellp()) {
os << ", ";
}
os << acronym.str();
}
}

View File

@@ -291,13 +291,15 @@ int buildFatBinaryForTarget(int retVal, const std::vector<std::string> &argsCopy
argHelper->printf("%s\n", buildLog.c_str());
}
if (retVal == 0) {
if (!pCompiler->isQuiet())
if (!pCompiler->isQuiet()) {
argHelper->printf("Build succeeded for : %s.\n", product.c_str());
}
} else {
argHelper->printf("Build failed for : %s with error code: %d\n", product.c_str(), retVal);
argHelper->printf("Command was:");
for (const auto &arg : argsCopy)
for (const auto &arg : argsCopy) {
argHelper->printf(" %s", arg.c_str());
}
argHelper->printf("\n");
}
}

View File

@@ -159,8 +159,9 @@ int compile(OclocArgHelper *argHelper, const std::vector<std::string> &args) {
}
if (retVal == OCLOC_SUCCESS) {
if (!pCompiler->isQuiet())
if (!pCompiler->isQuiet()) {
argHelper->printf("Build succeeded.\n");
}
} else {
argHelper->printf("Build failed with error code: %d\n", retVal);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2024 Intel Corporation
* Copyright (C) 2024-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -93,8 +93,9 @@ std::string SupportedDevicesHelper::serialize(std::string_view oclocName, const
oss << " " << family << ": [";
for (size_t i = 0; i < ipVersions.size(); ++i) {
oss << "0x" << std::hex << ipVersions[i];
if (i < ipVersions.size() - 1)
if (i < ipVersions.size() - 1) {
oss << ", ";
}
}
oss << "]\n";
}
@@ -105,8 +106,9 @@ std::string SupportedDevicesHelper::serialize(std::string_view oclocName, const
oss << " " << release << ": [";
for (size_t i = 0; i < ipVersions.size(); ++i) {
oss << "0x" << std::hex << ipVersions[i];
if (i < ipVersions.size() - 1)
if (i < ipVersions.size() - 1) {
oss << ", ";
}
}
oss << "]\n";
}

View File

@@ -454,8 +454,9 @@ int OfflineCompiler::queryAcronymIds(size_t numArgs, const std::vector<std::stri
std::ostringstream os;
for (const auto &prefix : matchedVersions) {
if (os.tellp())
if (os.tellp()) {
os << "\n";
}
os << prefix;
}
helper->printf("Matched ids:\n%s\n", os.str().c_str());
@@ -620,8 +621,9 @@ int OfflineCompiler::buildSourceCode() {
} else {
pBuildInfo->intermediateRepresentation = (this->intermediateRepresentation != IGC::CodeType::undefined) ? this->intermediateRepresentation : this->preferredIntermediateRepresentation;
retVal = buildToIrBinary();
if (retVal != OCLOC_SUCCESS)
if (retVal != OCLOC_SUCCESS) {
return retVal;
}
}
const std::string igcRevision = igcFacade->getIgcRevision();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2020 Intel Corporation
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -10,8 +10,9 @@
std::string getCurrentDirectoryOwn(std::string outDirForBuilds) {
char buf[256];
if (getcwd(buf, sizeof(buf)) != NULL)
if (getcwd(buf, sizeof(buf)) != NULL) {
return std::string(buf) + "/" + outDirForBuilds + "/";
else
} else {
return std::string("./") + outDirForBuilds + "/";
}
}

View File

@@ -53,12 +53,15 @@ struct CmdServicesMemTraceVersion {
return 4;
}
bool matchesHeader() const {
if (instructionType != 0x7)
if (instructionType != 0x7) {
return false;
if (instructionOpcode != 0x2e)
}
if (instructionOpcode != 0x2e) {
return false;
if (instructionSubOpcode != 0xe)
}
if (instructionSubOpcode != 0xe) {
return false;
}
return true;
}
void setHeader() {
@@ -157,12 +160,15 @@ struct CmdServicesMemTraceRegisterCompare {
return 4;
}
bool matchesHeader() const {
if (instructionType != 0x7)
if (instructionType != 0x7) {
return false;
if (instructionOpcode != 0x2e)
}
if (instructionOpcode != 0x2e) {
return false;
if (instructionSubOpcode != 0x1)
}
if (instructionSubOpcode != 0x1) {
return false;
}
return true;
}
void setHeader() {
@@ -231,12 +237,15 @@ struct CmdServicesMemTraceRegisterPoll {
return 4;
}
bool matchesHeader() const {
if (instructionType != 0x7)
if (instructionType != 0x7) {
return false;
if (instructionOpcode != 0x2e)
}
if (instructionOpcode != 0x2e) {
return false;
if (instructionSubOpcode != 0x2)
}
if (instructionSubOpcode != 0x2) {
return false;
}
return true;
}
void setHeader() {
@@ -306,12 +315,15 @@ struct CmdServicesMemTraceRegisterWrite {
return 4;
}
bool matchesHeader() const {
if (instructionType != 0x7)
if (instructionType != 0x7) {
return false;
if (instructionOpcode != 0x2e)
}
if (instructionOpcode != 0x2e) {
return false;
if (instructionSubOpcode != 0x3)
}
if (instructionSubOpcode != 0x3) {
return false;
}
return true;
}
void setHeader() {
@@ -383,12 +395,15 @@ struct CmdServicesMemTraceMemoryCompare {
return 4;
}
bool matchesHeader() const {
if (instructionType != 0x7)
if (instructionType != 0x7) {
return false;
if (instructionOpcode != 0x2e)
}
if (instructionOpcode != 0x2e) {
return false;
if (instructionSubOpcode != 0x4)
}
if (instructionSubOpcode != 0x4) {
return false;
}
return true;
}
void setHeader() {
@@ -529,12 +544,15 @@ struct CmdServicesMemTraceMemoryPoll {
return 5;
}
bool matchesHeader() const {
if (instructionType != 0x7)
if (instructionType != 0x7) {
return false;
if (instructionOpcode != 0x2e)
}
if (instructionOpcode != 0x2e) {
return false;
if (instructionSubOpcode != 0x5)
}
if (instructionSubOpcode != 0x5) {
return false;
}
return true;
}
void setHeader() {
@@ -665,12 +683,15 @@ struct CmdServicesMemTraceMemoryWrite {
return 4;
}
bool matchesHeader() const {
if (instructionType != 0x7)
if (instructionType != 0x7) {
return false;
if (instructionOpcode != 0x2e)
}
if (instructionOpcode != 0x2e) {
return false;
if (instructionSubOpcode != 0x6)
}
if (instructionSubOpcode != 0x6) {
return false;
}
return true;
}
void setHeader() {
@@ -818,12 +839,15 @@ struct CmdServicesMemTraceMemoryWriteDiscontiguous {
return 190;
}
bool matchesHeader() const {
if (instructionType != 0x7)
if (instructionType != 0x7) {
return false;
if (instructionOpcode != 0x2e)
}
if (instructionOpcode != 0x2e) {
return false;
if (instructionSubOpcode != 0xb)
}
if (instructionSubOpcode != 0xb) {
return false;
}
return true;
}
void setHeader() {
@@ -947,12 +971,15 @@ struct CmdServicesMemTraceFrameBegin {
return 1;
}
bool matchesHeader() const {
if (instructionType != 0x7)
if (instructionType != 0x7) {
return false;
if (instructionOpcode != 0x2e)
}
if (instructionOpcode != 0x2e) {
return false;
if (instructionSubOpcode != 0x7)
}
if (instructionSubOpcode != 0x7) {
return false;
}
return true;
}
void setHeader() {
@@ -994,12 +1021,15 @@ struct CmdServicesMemTraceComment {
return 1;
}
bool matchesHeader() const {
if (instructionType != 0x7)
if (instructionType != 0x7) {
return false;
if (instructionOpcode != 0x2e)
}
if (instructionOpcode != 0x2e) {
return false;
if (instructionSubOpcode != 0x8)
}
if (instructionSubOpcode != 0x8) {
return false;
}
return true;
}
void setHeader() {
@@ -1033,12 +1063,15 @@ struct CmdServicesMemTraceDelay {
return 1;
}
bool matchesHeader() const {
if (instructionType != 0x7)
if (instructionType != 0x7) {
return false;
if (instructionOpcode != 0x2e)
}
if (instructionOpcode != 0x2e) {
return false;
if (instructionSubOpcode != 0x9)
}
if (instructionSubOpcode != 0x9) {
return false;
}
return true;
}
void setHeader() {
@@ -1086,12 +1119,15 @@ struct CmdServicesMemTraceMemoryDump {
return 5;
}
bool matchesHeader() const {
if (instructionType != 0x7)
if (instructionType != 0x7) {
return false;
if (instructionOpcode != 0x2e)
}
if (instructionOpcode != 0x2e) {
return false;
if (instructionSubOpcode != 0xa)
}
if (instructionSubOpcode != 0xa) {
return false;
}
return true;
}
void setHeader() {
@@ -1139,12 +1175,15 @@ struct CmdServicesMemTraceTestPhaseMarker {
return 1;
}
bool matchesHeader() const {
if (instructionType != 0x7)
if (instructionType != 0x7) {
return false;
if (instructionOpcode != 0x2e)
}
if (instructionOpcode != 0x2e) {
return false;
if (instructionSubOpcode != 0xc)
}
if (instructionSubOpcode != 0xc) {
return false;
}
return true;
}
void setHeader() {
@@ -1193,12 +1232,15 @@ struct CmdServicesMemTraceMemoryContinuousRegion {
return 4;
}
bool matchesHeader() const {
if (instructionType != 0x7)
if (instructionType != 0x7) {
return false;
if (instructionOpcode != 0x2e)
}
if (instructionOpcode != 0x2e) {
return false;
if (instructionSubOpcode != 0xd)
}
if (instructionSubOpcode != 0xd) {
return false;
}
return true;
}
void setHeader() {
@@ -1236,12 +1278,15 @@ struct CmdServicesMemTracePredicate {
return 4;
}
bool matchesHeader() const {
if (instructionType != 0x7)
if (instructionType != 0x7) {
return false;
if (instructionOpcode != 0x2e)
}
if (instructionOpcode != 0x2e) {
return false;
if (instructionSubOpcode != 0xf)
}
if (instructionSubOpcode != 0xf) {
return false;
}
return true;
}
void setHeader() {
@@ -1354,12 +1399,15 @@ struct CmdServicesMemTraceDumpCompress {
return 19;
}
bool matchesHeader() const {
if (instructionType != 0x7)
if (instructionType != 0x7) {
return false;
if (instructionOpcode != 0x2e)
}
if (instructionOpcode != 0x2e) {
return false;
if (instructionSubOpcode != 0x10)
}
if (instructionSubOpcode != 0x10) {
return false;
}
return true;
}
void setHeader() {

View File

@@ -34,10 +34,11 @@ void EncodeSurfaceState<Family>::disableCompressionFlags(R_SURFACE_STATE *surfac
template <typename Family>
void EncodeSurfaceState<Family>::setAuxParamsForMCSCCS(R_SURFACE_STATE *surfaceState, const ReleaseHelper *releaseHelper) {
if (releaseHelper && releaseHelper->isAuxSurfaceModeOverrideRequired())
if (releaseHelper && releaseHelper->isAuxSurfaceModeOverrideRequired()) {
surfaceState->setAuxiliarySurfaceMode(AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
else
} else {
surfaceState->setAuxiliarySurfaceMode(AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_MCS_LCE);
}
}
template <typename Family>

View File

@@ -745,8 +745,9 @@ IndirectHeap &CommandStreamReceiver::getIndirectHeap(IndirectHeap::Type heapType
auto &heap = indirectHeap[heapType];
GraphicsAllocation *heapMemory = nullptr;
if (heap)
if (heap) {
heapMemory = heap->getGraphicsAllocation();
}
if (heap && heap->getAvailableSpace() < minRequiredSize && heapMemory) {
internalAllocationStorage->storeAllocation(std::unique_ptr<GraphicsAllocation>(heapMemory), REUSABLE_ALLOCATION);
@@ -811,8 +812,9 @@ void CommandStreamReceiver::releaseIndirectHeap(IndirectHeap::Type heapType) {
if (heap) {
auto heapMemory = heap->getGraphicsAllocation();
if (heapMemory != nullptr)
if (heapMemory != nullptr) {
internalAllocationStorage->storeAllocation(std::unique_ptr<GraphicsAllocation>(heapMemory), REUSABLE_ALLOCATION);
}
heap->replaceBuffer(nullptr, 0);
heap->replaceGraphicsAllocation(nullptr);
}

View File

@@ -63,8 +63,9 @@ bool CommandStreamReceiverSimulatedCommonHw<GfxFamily>::getParametersForMemory(G
size = graphicsAllocation.getDefaultGmm()->gmmResourceInfo->getSizeAllocation();
}
if (size == 0)
if (size == 0) {
return false;
}
if (cpuAddress == nullptr && graphicsAllocation.isAllocationLockable()) {
cpuAddress = this->getMemoryManager()->lockResource(&graphicsAllocation);

View File

@@ -49,8 +49,9 @@ DebugSettingsManager<debugLevel>::DebugSettingsManager(const char *registryPath)
dumpFlags();
translateDebugSettings(flags);
while (isLoopAtDriverInitEnabled())
while (isLoopAtDriverInitEnabled()) {
;
}
}
template <DebugFunctionalityLevel debugLevel>

View File

@@ -47,9 +47,11 @@ bool isTargetProductConfigCompatibleWithProductConfig(const AOT::PRODUCT_CONFIG
const AOT::PRODUCT_CONFIG &productConfig) {
auto compatProdConfPairItr = AOT::getCompatibilityMapping().find(productConfig);
if (compatProdConfPairItr != AOT::getCompatibilityMapping().end()) {
for (auto &compatibleConfig : compatProdConfPairItr->second)
if (targetDeviceProductConfig == compatibleConfig)
for (auto &compatibleConfig : compatProdConfPairItr->second) {
if (targetDeviceProductConfig == compatibleConfig) {
return true;
}
}
}
return false;
}
@@ -64,12 +66,13 @@ bool validateTargetDevice(const TargetDevice &targetDevice, Elf::ElfIdentifierCl
if (productConfig != AOT::UNKNOWN_ISA) {
auto targetDeviceProductConfig = static_cast<AOT::PRODUCT_CONFIG>(targetDevice.aotConfig.value);
if (targetDeviceProductConfig == productConfig)
if (targetDeviceProductConfig == productConfig) {
return true;
else if (debugManager.flags.EnableCompatibilityMode.get() == true) {
} else if (debugManager.flags.EnableCompatibilityMode.get() == true) {
return isTargetProductConfigCompatibleWithProductConfig(targetDeviceProductConfig, productConfig);
} else
} else {
return false;
}
}
if (gfxCore == IGFX_UNKNOWN_CORE && productFamily == IGFX_UNKNOWN) {

View File

@@ -231,8 +231,9 @@ bool DirectSubmissionController::isDirectSubmissionIdle(CommandStreamReceiver *c
for (auto &entry : directSubmissions) {
auto *otherCsr = entry.first;
if (otherCsr == csr)
if (otherCsr == csr) {
continue; // Skip self
}
auto otherKey = ContextGroupKey{otherCsr->getRootDeviceIndex(), otherCsr->getContextGroupId()};
if (otherKey == myKey) {

View File

@@ -411,8 +411,9 @@ void EncodeDispatchKernel<Family>::encodeThreadData(WalkerType &walkerCmd,
if (executionMask == 0) {
auto remainderSimdLanes = localWorkSize & (simd - 1);
executionMask = maxNBitValue(remainderSimdLanes);
if (!executionMask)
if (!executionMask) {
executionMask = ~executionMask;
}
}
constexpr uint32_t maxDword = std::numeric_limits<uint32_t>::max();

View File

@@ -125,8 +125,9 @@ inline bool GfxCoreHelperHw<Family>::isFusedEuDispatchEnabled(const HardwareInfo
auto fusedEuDispatchEnabled = !hwInfo.workaroundTable.flags.waDisableFusedThreadScheduling;
fusedEuDispatchEnabled &= hwInfo.capabilityTable.fusedEuEnabled;
if (disableEUFusionForKernel)
if (disableEUFusionForKernel) {
fusedEuDispatchEnabled = false;
}
if (debugManager.flags.CFEFusedEUDispatch.get() != -1) {
fusedEuDispatchEnabled = (debugManager.flags.CFEFusedEUDispatch.get() == 0);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -113,15 +113,17 @@ inline uint16_t float2Half(float f) {
// overflow
if (x >= std::ldexp(1.0f, 16)) {
if (x == posInfinity.f)
if (x == posInfinity.f) {
return 0x7c00 | fsign;
}
return 0x7bff | fsign;
}
// underflow
if (x < std::ldexp(1.0f, -24))
if (x < std::ldexp(1.0f, -24)) {
return fsign; // The halfway case can return 0x0001 or 0. 0 is even.
}
// half denormal
if (x < std::ldexp(1.0f, -14)) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -69,8 +69,9 @@ struct GetInfoHelper {
errCode = GetInfoStatus::invalidValue;
}
}
if (retVal)
if (retVal) {
*retVal = errCode;
}
return errCode;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -49,8 +49,9 @@ class Hash {
}
void update(const char *buff, size_t size) {
if (buff == nullptr)
if (buff == nullptr) {
return;
}
if ((reinterpret_cast<uintptr_t>(buff) & 0x3) != 0) {
const unsigned char *tmp = (const unsigned char *)buff;

View File

@@ -43,12 +43,14 @@ void (*hardwareInfoBaseSetup[IGFX_MAX_PRODUCT])(HardwareInfo *, bool, const Rele
bool getHwInfoForPlatformString(std::string &platform, const HardwareInfo *&hwInfoIn) {
std::transform(platform.begin(), platform.end(), platform.begin(), ::tolower);
if (platform == "unk")
if (platform == "unk") {
return true;
}
bool ret = false;
for (int j = 0; j < IGFX_MAX_PRODUCT; j++) {
if (hardwarePrefix[j] == nullptr)
if (hardwarePrefix[j] == nullptr) {
continue;
}
if (hardwarePrefix[j] == platform) {
hwInfoIn = hardwareInfoTable[j];
ret = true;

View File

@@ -103,19 +103,22 @@ void computePowerOfTwoLWS(const size_t workItems[3], WorkSizeInfo &workGroupInfo
if (workDim == 2) {
uint32_t xDim, yDim;
xDim = uint32_t(optimalLocalThreads * simdSize) / (canUseNx4 ? 4 : 1);
while (xDim > workItems[0])
while (xDim > workItems[0]) {
xDim = xDim >> 1;
}
yDim = canUseNx4 ? 4 : (uint32_t(optimalLocalThreads * simdSize) / xDim);
workGroupSize[0] = xDim;
workGroupSize[1] = yDim;
} else {
uint32_t xDim, yDim, zDim;
xDim = uint32_t(optimalLocalThreads * simdSize);
while (xDim > workItems[0])
while (xDim > workItems[0]) {
xDim = xDim >> 1;
}
yDim = uint32_t(optimalLocalThreads * simdSize) / xDim;
while (yDim > workItems[1])
while (yDim > workItems[1]) {
yDim = yDim >> 1;
}
UNRECOVERABLE_IF((xDim * yDim) == 0);
zDim = uint32_t(optimalLocalThreads * simdSize) / (xDim * yDim);
workGroupSize[0] = xDim;
@@ -246,8 +249,9 @@ void choosePrefferedWorkgroupSize(WorkSizeInfo &wsInfo, size_t workGroupSize[3],
// find all divisors for all dimensions
uint32_t xyzFactors[3][1024];
uint32_t xyzFactorsLen[3] = {};
for (int i = 0; i < 3; i++)
for (int i = 0; i < 3; i++) {
xyzFactors[i][xyzFactorsLen[i]++] = 1;
}
for (auto i = 0u; i < workDim; i++) {
for (auto j = 2u; j < wsInfo.maxWorkGroupSize; ++j) {
if ((workItems[i] % j) == 0) {
@@ -276,8 +280,9 @@ void computeWorkgroupSize2D(uint32_t maxWorkGroupSize, size_t workGroupSize[3],
uint32_t xDim;
uint32_t yDim;
for (int i = 0; i < 3; i++)
for (int i = 0; i < 3; i++) {
workGroupSize[i] = 1;
}
for (uint32_t i = 2; i <= maxWorkGroupSize; i++) {
if ((workItems[0] % i) == 0) {
@@ -325,39 +330,45 @@ void computeWorkgroupSize2D(uint32_t maxWorkGroupSize, size_t workGroupSize[3],
}
void computeWorkgroupSizeSquared(uint32_t maxWorkGroupSize, size_t workGroupSize[3], const size_t workItems[3], size_t simdSize, const uint32_t workDim) {
for (int i = 0; i < 3; i++)
for (int i = 0; i < 3; i++) {
workGroupSize[i] = 1;
}
size_t itemsPowerOfTwoDivisors[3] = {1, 1, 1};
for (auto i = 0u; i < workDim; i++) {
uint32_t requiredWorkItemsCount = maxWorkGroupSize;
while (requiredWorkItemsCount > 1 && !(Math::isDivisibleByPowerOfTwoDivisor(uint32_t(workItems[i]), requiredWorkItemsCount)))
while (requiredWorkItemsCount > 1 && !(Math::isDivisibleByPowerOfTwoDivisor(uint32_t(workItems[i]), requiredWorkItemsCount))) {
requiredWorkItemsCount >>= 1;
}
itemsPowerOfTwoDivisors[i] = requiredWorkItemsCount;
}
if (itemsPowerOfTwoDivisors[0] * itemsPowerOfTwoDivisors[1] >= maxWorkGroupSize) {
while (itemsPowerOfTwoDivisors[0] * itemsPowerOfTwoDivisors[1] > maxWorkGroupSize) {
if (itemsPowerOfTwoDivisors[0] > itemsPowerOfTwoDivisors[1])
if (itemsPowerOfTwoDivisors[0] > itemsPowerOfTwoDivisors[1]) {
itemsPowerOfTwoDivisors[0] >>= 1;
else
} else {
itemsPowerOfTwoDivisors[1] >>= 1;
}
}
for (auto i = 0u; i < 3; i++)
for (auto i = 0u; i < 3; i++) {
workGroupSize[i] = itemsPowerOfTwoDivisors[i];
}
return;
} else if (workItems[0] * workItems[1] > maxWorkGroupSize) {
computeWorkgroupSize2D(maxWorkGroupSize, workGroupSize, workItems, simdSize);
return;
} else {
for (auto i = 0u; i < workDim; i++)
for (auto i = 0u; i < workDim; i++) {
workGroupSize[i] = workItems[i];
}
return;
}
}
void computeWorkgroupSizeND(WorkSizeInfo &wsInfo, size_t workGroupSize[3], const size_t workItems[3], const uint32_t workDim) {
for (int i = 0; i < 3; i++)
for (int i = 0; i < 3; i++) {
workGroupSize[i] = 1;
}
UNRECOVERABLE_IF(wsInfo.simdSize == 0);
uint64_t totalNumberOfItems = workItems[0] * workItems[1] * workItems[2];
@@ -378,8 +389,9 @@ void computeWorkgroupSizeND(WorkSizeInfo &wsInfo, size_t workGroupSize[3], const
size_t itemsPowerOfTwoDivisors[3] = {1, 1, 1};
for (auto i = 0u; i < workDim; i++) {
uint32_t requiredWorkItemsCount = uint32_t(wsInfo.simdSize * optimalWgThreadCount);
while (requiredWorkItemsCount > 1 && !(Math::isDivisibleByPowerOfTwoDivisor(uint32_t(workItems[i]), requiredWorkItemsCount)))
while (requiredWorkItemsCount > 1 && !(Math::isDivisibleByPowerOfTwoDivisor(uint32_t(workItems[i]), requiredWorkItemsCount))) {
requiredWorkItemsCount >>= 1;
}
itemsPowerOfTwoDivisors[i] = requiredWorkItemsCount;
}
@@ -396,16 +408,18 @@ void computeWorkgroupSizeND(WorkSizeInfo &wsInfo, size_t workGroupSize[3], const
// If computed workgroup is at this point in correct size
else if (allItems >= wsInfo.simdSize) {
itemsPowerOfTwoDivisors[1] = canUseNx4 ? 4 : itemsPowerOfTwoDivisors[1];
for (auto i = 0u; i < workDim; i++)
for (auto i = 0u; i < workDim; i++) {
workGroupSize[i] = itemsPowerOfTwoDivisors[i];
}
return;
}
}
// If dimensions are not powers of two but total number of items is less than max work group size
if (totalNumberOfItems <= wsInfo.maxWorkGroupSize) {
for (auto i = 0u; i < workDim; i++)
for (auto i = 0u; i < workDim; i++) {
workGroupSize[i] = workItems[i];
}
return;
}

View File

@@ -62,8 +62,9 @@ void ProductConfigHelper::adjustClosedRangeDeviceLegacyAcronyms(std::string &ran
auto adjustFamilyAcronymToRelease = [&](std::string &device) {
AOT::FAMILY family = getFamilyFromDeviceName(device);
if (family == AOT::UNKNOWN_FAMILY)
if (family == AOT::UNKNOWN_FAMILY) {
return;
}
auto latestReleaseInFamily = AOT::UNKNOWN_RELEASE;
for (const auto &product : allSuppportedProducts) {
if (product.family == family) {
@@ -98,15 +99,17 @@ NEO::ConstStringRef ProductConfigHelper::getAcronymFromARelease(AOT::RELEASE rel
AOT::RELEASE ProductConfigHelper::getReleaseFromDeviceName(const std::string &device) const {
auto it = std::find_if(AOT::releaseAcronyms.begin(), AOT::releaseAcronyms.end(), findMapAcronymWithoutDash(device));
if (it == AOT::releaseAcronyms.end())
if (it == AOT::releaseAcronyms.end()) {
return AOT::UNKNOWN_RELEASE;
}
return isSupportedRelease(it->second) ? it->second : AOT::UNKNOWN_RELEASE;
}
AOT::FAMILY ProductConfigHelper::getFamilyFromDeviceName(const std::string &device) const {
auto it = std::find_if(AOT::familyAcronyms.begin(), AOT::familyAcronyms.end(), findMapAcronymWithoutDash(device));
if (it == AOT::familyAcronyms.end())
if (it == AOT::familyAcronyms.end()) {
return AOT::UNKNOWN_FAMILY;
}
return isSupportedFamily(it->second) ? it->second : AOT::UNKNOWN_FAMILY;
}
@@ -119,8 +122,9 @@ const std::string ProductConfigHelper::getAcronymForProductConfig(uint32_t confi
return it->deviceAcronyms.front().str();
} else if (!it->rtlIdAcronyms.empty()) {
return it->rtlIdAcronyms.front().str();
} else
} else {
return parseMajorMinorRevisionValue(it->aotConfig);
}
}
bool ProductConfigHelper::isSupportedFamily(uint32_t family) const {
@@ -219,16 +223,18 @@ PRODUCT_FAMILY ProductConfigHelper::getProductFamilyFromDeviceName(const std::st
} else {
it = std::find_if(deviceAotInfo.begin(), deviceAotInfo.end(), findAcronym(device));
}
if (it != deviceAotInfo.end())
if (it != deviceAotInfo.end()) {
return it->hwInfo->platform.eProductFamily;
}
return IGFX_UNKNOWN;
}
std::vector<NEO::ConstStringRef> ProductConfigHelper::getDeprecatedAcronyms() {
std::vector<NEO::ConstStringRef> prefixes{}, deprecatedAcronyms{};
for (int j = 0; j < IGFX_MAX_PRODUCT; j++) {
if (NEO::hardwarePrefix[j] == nullptr)
if (NEO::hardwarePrefix[j] == nullptr) {
continue;
}
prefixes.push_back(NEO::hardwarePrefix[j]);
}
@@ -236,8 +242,9 @@ std::vector<NEO::ConstStringRef> ProductConfigHelper::getDeprecatedAcronyms() {
std::string prefixCopy = prefix.str();
ProductConfigHelper::adjustDeviceName(prefixCopy);
if (std::any_of(deviceAotInfo.begin(), deviceAotInfo.end(), findAcronym(prefixCopy)))
if (std::any_of(deviceAotInfo.begin(), deviceAotInfo.end(), findAcronym(prefixCopy))) {
continue;
}
deprecatedAcronyms.push_back(prefix);
}
return deprecatedAcronyms;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -37,8 +37,9 @@ inline size_t strnlen_s(const char *str, size_t count) { // NOLINT(readability-i
}
for (size_t i = 0; i < count; ++i) {
if (str[i] == '\0')
if (str[i] == '\0') {
return i;
}
}
return count;

View File

@@ -88,8 +88,9 @@ TopologyInfo getTopologyInfo(const TopologyBitmap &topologyBitmap, const Topolog
TopologyInfo getTopologyInfoMultiTile(std::span<const TopologyBitmap> topologyBitmap, const TopologyLimits &topologyLimits, TopologyMap &topologyMap) {
const auto numTiles = std::ssize(topologyBitmap);
if (0 == numTiles)
if (0 == numTiles) {
return TopologyInfo{};
}
std::vector<TopologyInfo> topologyInfos;
topologyInfos.reserve(numTiles);

View File

@@ -115,8 +115,9 @@ void *DeferredDeleter::run(void *arg) {
void DeferredDeleter::drain(bool blocking, bool hostptrsOnly) {
clearQueue(hostptrsOnly);
if (blocking) {
while (!areElementsReleased(hostptrsOnly))
while (!areElementsReleased(hostptrsOnly)) {
;
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -25,8 +25,9 @@ class PageTable {
};
virtual ~PageTable() {
for (auto &e : entries)
for (auto &e : entries) {
delete e;
}
}
virtual uintptr_t map(uintptr_t vm, size_t size, uint64_t entryBits, uint32_t memoryBank);

View File

@@ -402,8 +402,9 @@ SVMAllocsManager::~SVMAllocsManager() = default;
void *SVMAllocsManager::createSVMAlloc(size_t size, const SvmAllocationProperties svmProperties,
const RootDeviceIndicesContainer &rootDeviceIndices,
const std::map<uint32_t, DeviceBitfield> &subdeviceBitfields) {
if (size == 0)
if (size == 0) {
return nullptr;
}
if (rootDeviceIndices.size() > 1) {
return createZeroCopySvmAllocation(size, svmProperties, rootDeviceIndices, subdeviceBitfields);

View File

@@ -93,8 +93,9 @@ bool DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(ExecutionE
hardwareInfo->platform.usDeviceID = aotInfo.deviceIds->front();
} else if (aotInfo.deviceIds->front() != hardwareInfo->platform.usDeviceID) {
std::stringstream devIds{};
for (auto id : *aotInfo.deviceIds)
for (auto id : *aotInfo.deviceIds) {
devIds << "0x" << std::hex << id << ", ";
}
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(),
stdout, "Info@ %s(): Mismatch of device ids. ForceDeviceId %s is used for platform with multiple deviceIds: [%s]. Consider using OverrideHwIpVersion flag.\n",
@@ -127,8 +128,9 @@ bool DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(ExecutionE
if (csrType == CommandStreamReceiverType::tbx || csrType == CommandStreamReceiverType::tbxWithAub) {
auto capsReader = productHelper.getDeviceCapsReader(*aubCenter->getAubManager());
if (capsReader) {
if (!productHelper.setupHardwareInfo(*hardwareInfo, *capsReader))
if (!productHelper.setupHardwareInfo(*hardwareInfo, *capsReader)) {
return false;
}
}
}
}

View File

@@ -108,10 +108,11 @@ class DrmAllocation : public GraphicsAllocation {
bool setMemPrefetch(Drm *drm, SubDeviceIdsVec &subDeviceIds);
void *getMmapPtr() {
if (this->importedMmapPtr)
if (this->importedMmapPtr) {
return this->importedMmapPtr;
else
} else {
return this->mmapPtr;
}
}
void setMmapPtr(void *ptr) { this->mmapPtr = ptr; }
void setImportedMmapPtr(void *ptr) { this->importedMmapPtr = ptr; }

View File

@@ -221,12 +221,14 @@ void DrmMemoryManager::pushSharedBufferObject(NEO::BufferObject *bo) {
}
uint32_t DrmMemoryManager::unreference(NEO::BufferObject *bo, bool synchronousDestroy) {
if (!bo)
if (!bo) {
return -1;
}
if (synchronousDestroy) {
while (bo->getRefCount() > 1)
while (bo->getRefCount() > 1) {
;
}
}
std::unique_lock<std::mutex> lock(mtx, std::defer_lock);
@@ -636,8 +638,9 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryWithGpuVa(const Allo
size_t alignedSize = alignUp(allocationData.size, minAlignment);
auto res = alignedMallocWrapper(alignedSize, minAlignment);
if (!res)
if (!res) {
return nullptr;
}
std::unique_ptr<BufferObject, BufferObject::Deleter> bo(allocUserptr(reinterpret_cast<uintptr_t>(res), alignedSize, allocationData.type, allocationData.rootDeviceIndex));
@@ -665,8 +668,9 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryWithGpuVa(const Allo
}
GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryForNonSvmHostPtr(const AllocationData &allocationData) {
if (allocationData.size == 0 || !allocationData.hostPtr)
if (allocationData.size == 0 || !allocationData.hostPtr) {
return nullptr;
}
auto rootDeviceEnvironment = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex].get();
auto &productHelper = rootDeviceEnvironment->getHelper<ProductHelper>();
auto alignedPtr = alignDown(allocationData.hostPtr, MemoryConstants::pageSize);
@@ -1596,8 +1600,9 @@ bool DrmMemoryManager::setDomainCpu(GraphicsAllocation &graphicsAllocation, bool
DEBUG_BREAK_IF(writeEnable); // unsupported path (for CPU writes call SW_FINISH ioctl in unlockResource)
auto bo = static_cast<DrmAllocation *>(&graphicsAllocation)->getBO();
if (bo == nullptr)
if (bo == nullptr) {
return false;
}
auto &drm = this->getDrm(graphicsAllocation.getRootDeviceIndex());
auto ioctlHelper = drm.getIoctlHelper();
@@ -1905,8 +1910,9 @@ bool DrmMemoryManager::copyMemoryToAllocationBanks(GraphicsAllocation *graphicsA
}
void DrmMemoryManager::unlockBufferObject(BufferObject *bo) {
if (bo == nullptr)
if (bo == nullptr) {
return;
}
releaseReservedCpuAddressRange(bo->peekLockedAddress(), bo->peekSize(), this->getRootDeviceIndex(bo->peekDrm()));

View File

@@ -521,8 +521,9 @@ int Drm::setupHardwareInfo(const DeviceDescriptor *device, bool setupFeatureTabl
auto &productHelper = rootDeviceEnvironment.getProductHelper();
auto capsReader = productHelper.getDeviceCapsReader(*this);
if (capsReader) {
if (!productHelper.setupHardwareInfo(*hwInfo, *capsReader))
if (!productHelper.setupHardwareInfo(*hwInfo, *capsReader)) {
return -1;
}
}
if (!queryMemoryInfo()) {

View File

@@ -58,8 +58,9 @@ auto getCopyEnginesMappingIterator(const NEO::RootDeviceEnvironment &rootDeviceE
uint32_t getBcsEngineMaskIndex(const aub_stream::EngineType *mappingCopyEngineIt) {
if (*mappingCopyEngineIt == aub_stream::EngineType::ENGINE_BCS) {
return 0u;
} else
} else {
return *mappingCopyEngineIt - aub_stream::EngineType::ENGINE_BCS1 + 1;
}
}
} // namespace

View File

@@ -18,8 +18,9 @@ namespace NEO {
OsLibrary *OsLibrary::load(const OsLibraryCreateProperties &properties) {
auto ptr = new (std::nothrow) Linux::OsLibrary(properties);
if (ptr == nullptr)
if (ptr == nullptr) {
return nullptr;
}
if (!ptr->isLoaded()) {
delete ptr;

View File

@@ -35,8 +35,9 @@ void RegistryReader::setUpProcessName() {
processName.assign(buff);
}
const char *RegistryReader::appSpecificLocation(const std::string &name) {
if (processName.length() > 0)
if (processName.length() > 0) {
return processName.c_str();
}
return name.c_str();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2023 Intel Corporation
* Copyright (C) 2020-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -43,8 +43,9 @@ DriverInfoWindows::~DriverInfoWindows() = default;
std::string DriverInfoWindows::trimRegistryKey(std::string path) {
std::string prefix("\\REGISTRY\\MACHINE\\");
auto pos = prefix.find(prefix);
if (pos != std::string::npos)
if (pos != std::string::npos) {
path.erase(pos, prefix.length());
}
return path;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -66,8 +66,9 @@ size_t simpleSprintf(char *output, size_t outputSize, const char *format, T valu
*formatCopy.rbegin() = 'f';
retVal = sprintf_s(output, outputSize, formatCopy.c_str(), value);
for (int i = 0; i < retVal; i++)
for (int i = 0; i < retVal; i++) {
output[i] = std::toupper(output[i]);
}
} else {
retVal = sprintf_s(output, outputSize, format, value);
}

View File

@@ -670,8 +670,9 @@ NTSTATUS Wddm::createAllocation(const void *cpuPtr, const Gmm *gmm, D3DKMT_HANDL
D3DDDI_ALLOCATIONINFO2 allocationInfo = {};
D3DKMT_CREATEALLOCATION createAllocation = {};
if (gmm == nullptr)
if (gmm == nullptr) {
return false;
}
allocationInfo.pSystemMem = gmm->gmmResourceInfo->getSystemMemPointer();
allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();

View File

@@ -65,8 +65,9 @@ WddmCommandStreamReceiver<GfxFamily>::WddmCommandStreamReceiver(ExecutionEnviron
template <typename GfxFamily>
WddmCommandStreamReceiver<GfxFamily>::~WddmCommandStreamReceiver() {
if (commandBufferHeader)
if (commandBufferHeader) {
delete commandBufferHeader;
}
}
template <typename GfxFamily>

View File

@@ -56,8 +56,9 @@ WddmMemoryManager::~WddmMemoryManager() = default;
WddmMemoryManager::WddmMemoryManager(ExecutionEnvironment &executionEnvironment) : MemoryManager(executionEnvironment) {
asyncDeleterEnabled = isDeferredDeleterEnabled();
if (asyncDeleterEnabled)
if (asyncDeleterEnabled) {
deferredDeleter = createDeferredDeleter();
}
mallocRestrictions.minAddress = 0u;
usmDeviceAllocationMode = toLocalMemAllocationMode(debugManager.flags.NEO_LOCAL_MEMORY_ALLOCATION_MODE.get());
@@ -620,10 +621,11 @@ bool WddmMemoryManager::isNTHandle(osHandle handle, uint32_t rootDeviceIndex) {
GraphicsAllocation *WddmMemoryManager::createGraphicsAllocationFromSharedHandle(const OsHandleData &osHandleData, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation, bool reuseSharedAllocation, void *mapPointer) {
auto allocation = std::make_unique<WddmAllocation>(properties.rootDeviceIndex, 1u /*num gmms*/, properties.allocationType, nullptr, 0, osHandleData.handle, MemoryPool::systemCpuInaccessible, maxOsContextCount, 0llu);
bool status;
if (verifyHandle(osHandleData.handle, properties.rootDeviceIndex, false))
if (verifyHandle(osHandleData.handle, properties.rootDeviceIndex, false)) {
status = getWddm(properties.rootDeviceIndex).openSharedHandle(osHandleData, allocation.get());
else
} else {
status = getWddm(properties.rootDeviceIndex).openNTHandle(osHandleData, allocation.get());
}
if (!status) {
return nullptr;
@@ -842,13 +844,15 @@ bool WddmMemoryManager::isMemoryBudgetExhausted() const {
}
bool WddmMemoryManager::validateAllocation(WddmAllocation *alloc) {
if (alloc == nullptr)
if (alloc == nullptr) {
return false;
}
if (alloc->isPhysicalMemoryReservation() && !alloc->isMappedPhysicalMemoryReservation()) {
return true;
}
if (alloc->getGpuAddress() == 0u || (alloc->getDefaultHandle() == 0 && alloc->fragmentsStorage.fragmentCount == 0))
if (alloc->getGpuAddress() == 0u || (alloc->getDefaultHandle() == 0 && alloc->fragmentsStorage.fragmentCount == 0)) {
return false;
}
return true;
}

View File

@@ -70,16 +70,18 @@ void PrintFormatter::printString(const char *formatString, const std::function<v
continue;
}
while (isConversionSpecifier(formatString[end++]) == false && end < length)
while (isConversionSpecifier(formatString[end++]) == false && end < length) {
;
}
memcpy_s(dataFormat.get(), length, formatString + i, end - i);
dataFormat[end - i] = '\0';
if (formatString[end - 1] == 's')
if (formatString[end - 1] == 's') {
cursor += printStringToken(output.get() + cursor, maxSinglePrintStringLength - cursor, dataFormat.get());
else
} else {
cursor += printToken(output.get() + cursor, maxSinglePrintStringLength - cursor, dataFormat.get());
}
i = end - 1;
} else {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 Intel Corporation
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -211,8 +211,9 @@ class ConstStringRef {
if (*i == separator) {
continue;
}
if (*i != *rhs)
if (*i != *rhs) {
return false;
}
++rhs;
}
return ('\0' == *rhs);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -105,8 +105,9 @@ std::string SettingsFileReader::getSetting(const char *settingName, const std::s
std::string SettingsFileReader::getSetting(const char *settingName, const std::string &value) {
std::string returnValue = value;
std::map<std::string, std::string>::iterator it = settingStringMap.find(std::string(settingName));
if (it != settingStringMap.end())
if (it != settingStringMap.end()) {
returnValue = it->second;
}
return returnValue;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -18,8 +18,9 @@ class SettingsReader {
virtual ~SettingsReader() = default;
static SettingsReader *create(const std::string &regKey) {
SettingsReader *readerImpl = createFileReader();
if (readerImpl != nullptr)
if (readerImpl != nullptr) {
return readerImpl;
}
return createOsReader(false, regKey);
}

View File

@@ -89,8 +89,9 @@ uint64_t HeapAllocator::allocateWithCustomAlignment(size_t &sizeToAllocate, size
}
void HeapAllocator::free(uint64_t ptr, size_t size) {
if (ptr == 0llu)
if (ptr == 0llu) {
return;
}
std::lock_guard<std::mutex> lock(mtx);
DBG_LOG(LogAllocationMemoryPool, __FUNCTION__, "Allocator usage == ", this->getUsage());

View File

@@ -56,8 +56,9 @@ inline int fprintf(FILE *fileDesc, char const *const formatStr, ...) {
inline bool getEnvToBool(const char *name) {
const char *env = getenvPtr(name);
if ((nullptr == env) || (0 == strcmp("0", env)))
if ((nullptr == env) || (0 == strcmp("0", env))) {
return false;
}
return (0 == strcmp("1", env));
}

View File

@@ -89,10 +89,11 @@ void FileLogger<debugLevel>::logApiCall(const char *function, bool enter, int32_
std::stringstream ss;
ss << "ThreadID: " << thisThread << " ";
if (enter)
if (enter) {
ss << "Function Enter: ";
else
} else {
ss << "Function Leave (" << errorCode << "): ";
}
ss << function << std::endl;
auto str = ss.str();
@@ -102,8 +103,9 @@ void FileLogger<debugLevel>::logApiCall(const char *function, bool enter, int32_
template <DebugFunctionalityLevel debugLevel>
size_t FileLogger<debugLevel>::getInput(const size_t *input, int32_t index) {
if (enabled() == false)
if (enabled() == false) {
return 0;
}
return input != nullptr ? input[index] : 0;
}

View File

@@ -87,8 +87,9 @@ void EncodeComputeMode<Family>::programComputeModeCommand(LinearStream &csr, Sta
template <>
void EncodeSurfaceState<Family>::setAuxParamsForMCSCCS(R_SURFACE_STATE *surfaceState, const ReleaseHelper *releaseHelper) {
if (releaseHelper && releaseHelper->isAuxSurfaceModeOverrideRequired())
if (releaseHelper && releaseHelper->isAuxSurfaceModeOverrideRequired()) {
surfaceState->setAuxiliarySurfaceMode(AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_MCS);
}
}
} // namespace NEO

View File

@@ -78,8 +78,9 @@ bool CompilerProductHelperHw<IGFX_PVC>::isMatrixMultiplyAccumulateSupported(cons
template <>
bool CompilerProductHelperHw<IGFX_PVC>::isMatrixMultiplyAccumulateTF32Supported(const HardwareInfo &hwInfo) const {
auto config = getProductConfigFromHwInfo(hwInfo);
if (config >= AOT::PVC_XT_B0 && config < AOT::PVC_XT_C0_VG)
if (config >= AOT::PVC_XT_B0 && config < AOT::PVC_XT_C0_VG) {
return true;
}
return false;
}

View File

@@ -32,8 +32,9 @@ inline bool GfxCoreHelperHw<Family>::isFusedEuDispatchEnabled(const HardwareInfo
auto fusedEuDispatchEnabled = !hwInfo.workaroundTable.flags.waDisableFusedThreadScheduling;
fusedEuDispatchEnabled &= hwInfo.capabilityTable.fusedEuEnabled;
if (disableEUFusionForKernel)
if (disableEUFusionForKernel) {
fusedEuDispatchEnabled = false;
}
if (debugManager.flags.CFEFusedEUDispatch.get() != -1) {
fusedEuDispatchEnabled = (debugManager.flags.CFEFusedEUDispatch.get() == 0);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2024 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -242,103 +242,123 @@ template <class T>
size_t CmdParse<T>::getCommandLength(void *cmd) {
{
auto pCmd = genCmdCast<STATE_BASE_ADDRESS *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<PIPE_CONTROL *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<MI_ARB_CHECK *>(cmd);
if (pCmd)
if (pCmd) {
return SIZE32(*pCmd);
}
}
{
auto pCmd = genCmdCast<MI_ATOMIC *>(cmd);
if (pCmd)
if (pCmd) {
return sizeof(MI_ATOMIC) / sizeof(uint32_t);
}
}
{
auto pCmd = genCmdCast<MI_BATCH_BUFFER_END *>(cmd);
if (pCmd)
if (pCmd) {
return SIZE32(*pCmd);
}
}
{
auto pCmd = genCmdCast<MI_BATCH_BUFFER_START *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<MI_LOAD_REGISTER_IMM *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<MI_LOAD_REGISTER_MEM *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<MI_STORE_REGISTER_MEM *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<MI_NOOP *>(cmd);
if (pCmd)
if (pCmd) {
return SIZE32(*pCmd);
}
}
{
auto pCmd = genCmdCast<PIPELINE_SELECT *>(cmd);
if (pCmd)
if (pCmd) {
return SIZE32(*pCmd);
}
}
{
auto pCmd = genCmdCast<MI_REPORT_PERF_COUNT *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<MI_MATH *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->DW0.BitField.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<MI_LOAD_REGISTER_REG *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<MI_SEMAPHORE_WAIT *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<MI_STORE_DATA_IMM *>(cmd);
if (pCmd)
if (pCmd) {
return SIZE32(*pCmd);
}
}
{
auto pCmd = genCmdCast<MI_FLUSH_DW *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<XY_COPY_BLT *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<XY_COLOR_BLT *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<MI_USER_INTERRUPT *>(cmd);
if (pCmd)
if (pCmd) {
return sizeof(MI_USER_INTERRUPT) / sizeof(uint32_t);
}
}
auto commandLengthHwSpecific = getCommandLengthHwSpecific(cmd);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2024 Intel Corporation
* Copyright (C) 2021-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -19,43 +19,51 @@ template <>
size_t CmdParse<GenGfxFamily>::getCommandLengthHwSpecific(void *cmd) {
{
auto pCmd = genCmdCast<STATE_COMPUTE_MODE *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<COMPUTE_WALKER *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<CFE_STATE *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<_3DSTATE_BINDING_TABLE_POOL_ALLOC *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<MI_SET_PREDICATE *>(cmd);
if (pCmd)
if (pCmd) {
return 1;
}
}
{
auto pCmd = genCmdCast<_3DSTATE_BTD *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<STATE_SIP *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<XY_BLOCK_COPY_BLT *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
return 0;

View File

@@ -19,28 +19,33 @@ template <>
size_t CmdParse<GenGfxFamily>::getCommandLengthHwSpecific(void *cmd) {
{
auto pCmd = genCmdCast<STATE_COMPUTE_MODE *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<MI_SET_PREDICATE *>(cmd);
if (pCmd)
if (pCmd) {
return 1;
}
}
{
auto pCmd = genCmdCast<_3DSTATE_BTD *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<STATE_SIP *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<XY_BLOCK_COPY_BLT *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
return 0;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -21,8 +21,9 @@ template <typename Type>
static inline GenCmdList::iterator find(GenCmdList::iterator itorStart, GenCmdList::const_iterator itorEnd) {
GenCmdList::iterator itor = itorStart;
while (itor != itorEnd) {
if (genCmdCast<Type>(*itor))
if (genCmdCast<Type>(*itor)) {
break;
}
++itor;
}
return itor;
@@ -46,8 +47,9 @@ static inline GenCmdList::iterator findMmio(GenCmdList::iterator itorStart, GenC
GenCmdList::iterator itor = itorStart;
while (itor != itorEnd) {
auto cmd = genCmdCast<typename FamilyType::MI_LOAD_REGISTER_IMM *>(*itor);
if (cmd && cmd->getRegisterOffset() == regOffset)
if (cmd && cmd->getRegisterOffset() == regOffset) {
break;
}
++itor;
}
return itor;
@@ -80,8 +82,9 @@ template <typename Type>
static inline GenCmdList::reverse_iterator reverseFind(GenCmdList::reverse_iterator itorStart, GenCmdList::const_reverse_iterator itorEnd) {
GenCmdList::reverse_iterator itor = itorStart;
while (itor != itorEnd) {
if (genCmdCast<Type>(*itor))
if (genCmdCast<Type>(*itor)) {
break;
}
++itor;
}
return itor;

View File

@@ -93,8 +93,9 @@ std::string getRunPath(char *argv0) {
std::string res(argv0);
auto pos = res.rfind(fSeparator);
if (pos != std::string::npos)
if (pos != std::string::npos) {
res = res.substr(0, pos);
}
if (res == "." || pos == std::string::npos) {
char *cwd;
@@ -245,8 +246,9 @@ int main(int argc, char **argv) {
bool selectAllProducts = (strcmp("*", argv[i]) == 0);
productFamily = IGFX_UNKNOWN;
for (int j = 0; j < IGFX_MAX_PRODUCT; j++) {
if (hardwarePrefix[j] == nullptr)
if (hardwarePrefix[j] == nullptr) {
continue;
}
if ((strcmp(hardwarePrefix[j], argv[i]) == 0) || selectAllProducts) {
productFamily = static_cast<PRODUCT_FAMILY>(j);
selectedTestProducts.push_back(productFamily);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022-2023 Intel Corporation
* Copyright (C) 2022-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -54,12 +54,14 @@ struct MockElfBinaryPatchtokens {
enc.getElfFileHeader().identity = Elf::ElfFileHeaderIdentity(Elf::EI_CLASS_64);
enc.getElfFileHeader().type = NEO::Elf::ET_OPENCL_EXECUTABLE;
enc.appendSection(Elf::SHT_OPENCL_DEV_BINARY, Elf::SectionNamesOpenCl::deviceBinary, ArrayRef<const uint8_t>::fromAny(mockDevBinaryData, mockDevBinaryDataSize));
if (irFormat == EnabledIrFormat::spirv)
if (irFormat == EnabledIrFormat::spirv) {
enc.appendSection(Elf::SHT_OPENCL_SPIRV, Elf::SectionNamesOpenCl::spirvObject, ArrayRef<const uint8_t>::fromAny(mockSpirvBinaryData, mockSpirvBinaryDataSize));
else if (irFormat == EnabledIrFormat::llvm)
} else if (irFormat == EnabledIrFormat::llvm) {
enc.appendSection(Elf::SHT_OPENCL_LLVM_BINARY, Elf::SectionNamesOpenCl::llvmObject, ArrayRef<const uint8_t>::fromAny(mockLlvmBinaryData, mockLlvmBinaryDataSize));
if (false == buildOptions.empty())
}
if (false == buildOptions.empty()) {
enc.appendSection(Elf::SHT_OPENCL_OPTIONS, Elf::SectionNamesOpenCl::buildOptions, ArrayRef<const uint8_t>::fromAny(buildOptions.data(), buildOptions.size()));
}
storage = enc.encode();
}
static constexpr size_t mockDataSize = 0x10;

View File

@@ -25,12 +25,14 @@ size_t getAdditionalCommandLengthHwSpecific(void *cmd) {
using L3_CONTROL_WITHOUT_POST_SYNC = typename GenGfxFamily::L3_CONTROL;
auto pCmdWithPostSync = genCmdCast<L3_CONTROL_WITH_POST_SYNC *>(cmd);
if (pCmdWithPostSync)
if (pCmdWithPostSync) {
return pCmdWithPostSync->getBase().TheStructure.Common.Length + 2;
}
auto pCmdWithoutPostSync = genCmdCast<L3_CONTROL_WITHOUT_POST_SYNC *>(cmd);
if (pCmdWithoutPostSync)
if (pCmdWithoutPostSync) {
return pCmdWithoutPostSync->getBase().TheStructure.Common.Length + 2;
}
return 0;
}
@@ -54,38 +56,45 @@ template <>
size_t CmdParse<GenGfxFamily>::getCommandLengthHwSpecific(void *cmd) {
{
auto pCmd = genCmdCast<GPGPU_WALKER *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<MEDIA_INTERFACE_DESCRIPTOR_LOAD *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<MEDIA_VFE_STATE *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<MEDIA_STATE_FLUSH *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<STATE_COMPUTE_MODE *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<GPGPU_CSR_BASE_ADDRESS *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
{
auto pCmd = genCmdCast<STATE_SIP *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.DwordLength + 2;
}
}
return getAdditionalCommandLengthHwSpecific(cmd);

View File

@@ -147,11 +147,12 @@ class CCustomEventListener : public ::testing::TestEventListener {
testsRun,
testsPassed,
testsSkipped);
if (testsFailed > 0)
if (testsFailed > 0) {
fprintf(
stdout,
"Tests failed: %d\n",
testsFailed);
}
fprintf(
stdout,
@@ -162,14 +163,16 @@ class CCustomEventListener : public ::testing::TestEventListener {
timeElapsed,
paddingE.c_str());
for (auto failure : testFailures)
for (auto failure : testFailures) {
fprintf(
stdout,
"[ FAILED ][ %s ][ %u ] %s\n", hardwarePrefix.c_str(), failure.second, failure.first.c_str());
if (unitTest.Failed())
}
if (unitTest.Failed()) {
fprintf(
stdout,
"\n");
}
fflush(stdout);
}

View File

@@ -24,15 +24,19 @@ class StreamCapture {
public:
~StreamCapture() {
#ifdef _WIN32
if (pipefdStdout[0] != -1)
if (pipefdStdout[0] != -1) {
_close(pipefdStdout[0]);
if (pipefdStderr[0] != -1)
}
if (pipefdStderr[0] != -1) {
_close(pipefdStderr[0]);
}
#else
if (pipefdStdout[0] != -1)
if (pipefdStdout[0] != -1) {
close(pipefdStdout[0]);
if (pipefdStderr[0] != -1)
}
if (pipefdStderr[0] != -1) {
close(pipefdStderr[0]);
}
#endif
}
void captureStdout() {

View File

@@ -180,10 +180,11 @@ class DrmMock : public Drm {
return static_cast<uint32_t>(virtualMemoryIds.size());
}
bool useVMBindImmediate() const override {
if (isVMBindImmediateSupported.has_value())
if (isVMBindImmediateSupported.has_value()) {
return *isVMBindImmediateSupported;
else
} else {
return Drm::useVMBindImmediate();
}
}
int queryGttSize(uint64_t &gttSizeOutput, bool alignUpToFullRange) override {
gttSizeOutput = storedGTTSize;

View File

@@ -58,8 +58,9 @@ class MockIoctlHelper : public IoctlHelperPrelim20 {
}
std::optional<uint32_t> getVmAdviseAtomicAttribute() override {
if (callBaseVmAdviseAtomicAttribute)
if (callBaseVmAdviseAtomicAttribute) {
return IoctlHelperPrelim20::getVmAdviseAtomicAttribute();
}
return vmAdviseAtomicAttribute;
}

View File

@@ -154,10 +154,11 @@ class MockAubManager : public aub_stream::AubManager {
bool mapGpuVa(uint64_t gfxAddress, size_t size, aub_stream::PhysicalAllocationInfo physicalAllocInfo) override { return false; };
uint32_t readMMIO(uint32_t offset) override {
if (mmioData)
if (mmioData) {
return (*mmioData)[offset];
else
} else {
return ::aub_stream::AubManager::readMMIO(offset);
}
}
std::vector<aub_stream::AllocationParams> storedAllocationParams;

View File

@@ -246,8 +246,9 @@ class MockCommandStreamReceiver : public CommandStreamReceiver {
}
bool createAllocationForHostSurface(HostPtrSurface &surface, bool requiresL3Flush) override {
bool status = CommandStreamReceiver::createAllocationForHostSurface(surface, requiresL3Flush);
if (status)
if (status) {
surface.getAllocation()->hostPtrTaskCountAssignment--;
}
return status;
}
void postInitFlagsSetup() override {}

View File

@@ -53,16 +53,18 @@ class MockCsrBase : public UltCommandStreamReceiver<GfxFamily> {
bool isMadeResident(GraphicsAllocation *gfxAllocation) {
for (GraphicsAllocation *gfxAlloc : madeResidentGfxAllocations) {
if (gfxAlloc == gfxAllocation)
if (gfxAlloc == gfxAllocation) {
return true;
}
}
return false;
}
bool isMadeNonResident(GraphicsAllocation *gfxAllocation) {
for (GraphicsAllocation *gfxAlloc : madeNonResidentGfxAllocations) {
if (gfxAlloc == gfxAllocation)
if (gfxAlloc == gfxAllocation) {
return true;
}
}
return false;
}

View File

@@ -141,8 +141,9 @@ ExecutionEnvironment *MockDevice::prepareExecutionEnvironment(const HardwareInfo
}
bool MockDevice::verifyAdapterLuid() {
if (callBaseVerifyAdapterLuid)
if (callBaseVerifyAdapterLuid) {
return Device::verifyAdapterLuid();
}
return verifyAdapterLuidReturnValue;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022-2024 Intel Corporation
* Copyright (C) 2022-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -42,8 +42,9 @@ bool MockRootDeviceEnvironment::initOsInterface(std::unique_ptr<HwDeviceId> &&hw
bool MockRootDeviceEnvironment::initAilConfiguration() {
if (ailInitializationResult.has_value()) {
return *ailInitializationResult;
} else
} else {
return RootDeviceEnvironment::initAilConfiguration();
}
}
MockRootDeviceEnvironment::~MockRootDeviceEnvironment() {

View File

@@ -102,8 +102,9 @@ inline size_t mockFwrite(const void *ptr, size_t size, size_t nmemb, FILE *strea
}
inline int mockFflush(FILE *stream) {
if (stream == stdout || stream == stderr)
if (stream == stdout || stream == stderr) {
return fflush(stream);
}
return 0;
}

View File

@@ -51,8 +51,9 @@ class MockSettingsReader : public SettingsReader {
static SettingsReader *create(const std::string &regKey) {
SettingsReader *readerImpl = MockSettingsReader::createFileReader();
if (readerImpl != nullptr)
if (readerImpl != nullptr) {
return readerImpl;
}
return createOsReader(false, regKey);
}

View File

@@ -43,8 +43,9 @@ void Ioctls::reset() {
}
void DrmMockCustom::testIoctls() {
if (this->ioctlExpected.total == -1)
if (this->ioctlExpected.total == -1) {
return;
}
#define NEO_IOCTL_EXPECT_EQ(PARAM) \
if (this->ioctlExpected.PARAM >= 0) { \

View File

@@ -25,8 +25,9 @@ class DrmMockDefault : public DrmMock {
storedRetValForPooledEU = 0;
storedRetValForMinEUinPool = 0;
if (hwDeviceIdIn != nullptr)
if (hwDeviceIdIn != nullptr) {
this->hwDeviceId = std::move(hwDeviceIdIn);
}
}
};

View File

@@ -64,8 +64,9 @@ int DrmMockXe::ioctl(DrmIoctl request, void *arg) {
} break;
case DrmIoctl::gemVmDestroy: {
struct drm_xe_vm_destroy *v = static_cast<struct drm_xe_vm_destroy *>(arg);
if (v->vm_id == testValueVmId)
if (v->vm_id == testValueVmId) {
ret = 0;
}
} break;
case DrmIoctl::gemMmapOffset: {
gemMmapOffsetCalled++;

View File

@@ -273,8 +273,9 @@ DWORD getFileAttributesA(LPCSTR lpFileName) {
}
for (const auto &[path, attributes] : pathAttributes) {
if (path.empty())
if (path.empty()) {
continue;
}
std::string tempP2 = path;
if (tempP2.back() == PATH_SEPARATOR) {

View File

@@ -30,8 +30,9 @@ template <>
size_t CmdParse<GenGfxFamily>::getAdditionalCommandLength(void *cmd) {
{
auto pCmd = genCmdCast<L3_CONTROL *>(cmd);
if (pCmd)
if (pCmd) {
return pCmd->TheStructure.Common.Length + 2;
}
}
return 0;

View File

@@ -199,10 +199,12 @@ HWTEST_F(PrepareDeviceEnvironmentsTest, givenPrepareDeviceEnvironmentsForDepreca
for (i = 0; i < IGFX_MAX_PRODUCT; i++) {
auto hardwareInfo = hardwareInfoTable[i];
if (hardwareInfo == nullptr)
if (hardwareInfo == nullptr) {
continue;
if (hardwareInfoTable[i]->platform.eProductFamily == hwInfo->platform.eProductFamily)
}
if (hardwareInfoTable[i]->platform.eProductFamily == hwInfo->platform.eProductFamily) {
break;
}
}
EXPECT_TRUE(i < IGFX_MAX_PRODUCT);
@@ -379,10 +381,12 @@ HWTEST_F(PrepareDeviceEnvironmentsTest, givenPrepareDeviceEnvironmentsAndUnknown
EXPECT_NE(nullptr, hwInfo);
for (i = 0; i < IGFX_MAX_PRODUCT; i++) {
auto hardwareInfo = hardwareInfoTable[i];
if (hardwareInfo == nullptr)
if (hardwareInfo == nullptr) {
continue;
if (hardwareInfoTable[i]->platform.eProductFamily == hwInfo->platform.eProductFamily)
}
if (hardwareInfoTable[i]->platform.eProductFamily == hwInfo->platform.eProductFamily) {
break;
}
}
EXPECT_TRUE(i < IGFX_MAX_PRODUCT);
ASSERT_NE(nullptr, hardwarePrefix[i]);

View File

@@ -994,8 +994,9 @@ struct MyMockWddmDirectSubmission : public MockWddmDirectSubmission<GfxFamily, D
using BaseClass::MockWddmDirectSubmission;
void updateMonitorFenceValueForResidencyList(ResidencyContainer *allocationsForResidency) override {
lockInTesting = true;
while (lockInTesting)
while (lockInTesting) {
;
}
BaseClass::updateMonitorFenceValueForResidencyList(allocationsForResidency);
}
std::atomic<bool> lockInTesting = false;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2024 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -264,10 +264,11 @@ TYPED_TEST_SUITE(IsAlignedTests, IsAlignedTypes);
TYPED_TEST(IsAlignedTests, WhenCheckingForAlignmentThenReturnCorrectValue) {
TypeParam *ptr = reinterpret_cast<TypeParam *>(static_cast<uintptr_t>(0xdeadbeefu));
// one byte alignment should always return true
if (alignof(TypeParam) == 1)
if (alignof(TypeParam) == 1) {
EXPECT_TRUE(isAligned(ptr));
else
} else {
EXPECT_FALSE(isAligned(ptr));
}
auto ptr1 = reinterpret_cast<TypeParam *>(reinterpret_cast<uintptr_t>(ptr) & ~(alignof(TypeParam) - 1));
EXPECT_TRUE(isAligned(ptr1));
@@ -276,8 +277,9 @@ TYPED_TEST(IsAlignedTests, WhenCheckingForAlignmentThenReturnCorrectValue) {
EXPECT_TRUE(isAligned(ptr2));
// this is hard to align in the middle of byte aligned types
if (alignof(TypeParam) == 1)
if (alignof(TypeParam) == 1) {
return;
}
auto ptr3 = reinterpret_cast<TypeParam *>(reinterpret_cast<uintptr_t>(ptr) & ~((alignof(TypeParam) >> 1) - 1));
EXPECT_FALSE(isAligned(ptr3));

View File

@@ -440,8 +440,9 @@ struct LocalIdsLayoutForImagesTest : ::testing::TestWithParam<std::tuple<uint16_
uint16_t baseY = buffer[i * 3 * rowWidth + rowWidth];
uint16_t currentX = baseX;
for (int j = 1; j < simd; j++) {
if (simd * i + j == totalLocalIds)
if (simd * i + j == totalLocalIds) {
break;
}
if (simd == 32u && baseY + 8u > localWorkSize.at(1) && j == 16u) {
baseX += xDelta;
if (baseX == localWorkSize.at(0)) {
@@ -454,8 +455,9 @@ struct LocalIdsLayoutForImagesTest : ::testing::TestWithParam<std::tuple<uint16_
// validate Y row
for (int j = 0; j < simd; j++) {
if (simd * i + j == totalLocalIds)
if (simd * i + j == totalLocalIds) {
break;
}
uint16_t expectedY = baseY + ((j / xDelta) & 0b111);
if (expectedY >= localWorkSize.at(1)) {
expectedY -= (localWorkSize.at(1) - baseY);
@@ -465,8 +467,9 @@ struct LocalIdsLayoutForImagesTest : ::testing::TestWithParam<std::tuple<uint16_
// validate Z row
for (int j = 0; j < simd; j++) {
if (simd * i + j == totalLocalIds)
if (simd * i + j == totalLocalIds) {
break;
}
EXPECT_EQ(buffer[i * 3 * rowWidth + 2 * rowWidth + j], 0u);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -34,15 +34,17 @@ TEST(StringHelpers, GivenParamsWhenUsingStrncpyThenReturnIsCorrect) {
ret = strncpy_s(dst, 1024, src, strlen(src) / 2);
EXPECT_EQ(ret, 0);
EXPECT_EQ(0, memcmp(dst, src, strlen(src) / 2));
for (size_t i = strlen(src) / 2; i < sizeof(dst); i++)
for (size_t i = strlen(src) / 2; i < sizeof(dst); i++) {
EXPECT_EQ(0, dst[i]);
}
ret = strncpy_s(dst, 1024, src, 1024);
ASSERT_EQ(0, ret);
EXPECT_EQ(0, memcmp(dst, src, strlen(src)));
for (size_t i = strlen(src); i < sizeof(dst); i++)
for (size_t i = strlen(src); i < sizeof(dst); i++) {
EXPECT_EQ(0, dst[i]);
}
}
TEST(StringHelpers, GivenCountGreaterEqualToNumberOfElementsThenReturnErangeAndSetFirstStringToNullTerminator) {
@@ -126,8 +128,9 @@ TEST(StringHelpers, GivenParamsWhenUsingStrcpyThenReturnIsCorrect) {
EXPECT_EQ(ret, 0);
EXPECT_EQ(0, memcmp(dst, src, strlen(src)));
EXPECT_EQ(0, dst[strlen(src)]);
for (size_t i = strlen(src) + 1; i < sizeof(dst); i++)
for (size_t i = strlen(src) + 1; i < sizeof(dst); i++) {
EXPECT_EQ(pattern, dst[i]);
}
}
TEST(StringHelpers, GivenParamsWhenUsingStrnlenThenReturnIsCorrect) {
@@ -165,8 +168,9 @@ TEST(StringHelpers, GivenParamsWhenUsingMemcpyThenReturnIsCorrect) {
ret = memcpy_s(dst, sizeof(dst), src, strlen(src) / 2);
EXPECT_EQ(ret, 0);
EXPECT_EQ(0, memcmp(dst, src, strlen(src) / 2));
for (size_t i = strlen(src) / 2; i < sizeof(dst); i++)
for (size_t i = strlen(src) / 2; i < sizeof(dst); i++) {
EXPECT_EQ(0, dst[i]);
}
}
#endif

View File

@@ -66,8 +66,9 @@ TEST_F(DeferrableAllocationDeletionTest, givenDeferrableAllocationWhenApplyThenW
allocation->updateTaskCount(1u, defaultOsContextId);
*hwTag = 0u;
asyncDeleter->deferDeletion(new DeferrableAllocationDeletion(*memoryManager, *allocation));
while (!asyncDeleter->queue.peekIsEmpty()) // wait for async thread to get allocation from queue
while (!asyncDeleter->queue.peekIsEmpty()) { // wait for async thread to get allocation from queue
std::this_thread::yield();
}
EXPECT_EQ(0u, memoryManager->freeGraphicsMemoryCalled);
EXPECT_TRUE(allocation->isUsedByOsContext(defaultOsContextId));
@@ -76,8 +77,9 @@ TEST_F(DeferrableAllocationDeletionTest, givenDeferrableAllocationWhenApplyThenW
asyncDeleter->allowExit = true;
*hwTag = 1u; // allow to destroy allocation
while (!asyncDeleter->shouldStopReached)
while (!asyncDeleter->shouldStopReached) {
std::this_thread::yield();
}
EXPECT_EQ(1u, memoryManager->freeGraphicsMemoryCalled);
}
@@ -109,8 +111,9 @@ HWTEST_F(DeferrableAllocationDeletionTest, givenDeferrableAllocationDeletionWhen
auto deferrableAlloc = new DeferrableAllocationDeletionApplyCall(*memoryManager, *allocation);
EXPECT_FALSE(deferrableAlloc->applyCalled);
asyncDeleter->deferDeletion(deferrableAlloc);
while (!deferrableAlloc->applyCalled)
while (!deferrableAlloc->applyCalled) {
std::this_thread::yield();
}
*hwTag = 2u;
*nonDefaultCommandStreamReceiver.getTagAddress() = 2u;
EXPECT_FALSE(nonDefaultCommandStreamReceiver.flushBatchedSubmissionsCalled);
@@ -136,8 +139,9 @@ HWTEST_F(DeferrableAllocationDeletionTest, givenAllocationUsedByTwoOsContextsWhe
EXPECT_FALSE(device->getUltCommandStreamReceiver<FamilyType>().flushBatchedSubmissionsCalled);
EXPECT_FALSE(nonDefaultCommandStreamReceiver.flushBatchedSubmissionsCalled);
asyncDeleter->deferDeletion(new DeferrableAllocationDeletion(*memoryManager, *allocation));
while (allocation->isUsedByOsContext(nonDefaultOsContextId) && !device->getUltCommandStreamReceiver<FamilyType>().flushBatchedSubmissionsCalled) // wait for second context completion signal
while (allocation->isUsedByOsContext(nonDefaultOsContextId) && !device->getUltCommandStreamReceiver<FamilyType>().flushBatchedSubmissionsCalled) { // wait for second context completion signal
std::this_thread::yield();
}
EXPECT_EQ(0u, memoryManager->freeGraphicsMemoryCalled);
EXPECT_FALSE(nonDefaultCommandStreamReceiver.flushBatchedSubmissionsCalled);
asyncDeleter->allowExit = true;
@@ -155,8 +159,9 @@ HWTEST_F(DeferrableAllocationDeletionTest, givenDeferrableAllocationDeletionWhen
allocation->updateTaskCount(1u, defaultOsContextId);
auto used = nonDefaultCommandStreamReceiver.getCS(0u).getUsed();
asyncDeleter->deferDeletion(new DeferrableAllocationDeletion(*memoryManager, *allocation));
while (allocation->isUsedByOsContext(nonDefaultOsContextId) && !device->getUltCommandStreamReceiver<FamilyType>().flushBatchedSubmissionsCalled) // wait for second context completion signal
while (allocation->isUsedByOsContext(nonDefaultOsContextId) && !device->getUltCommandStreamReceiver<FamilyType>().flushBatchedSubmissionsCalled) { // wait for second context completion signal
std::this_thread::yield();
}
EXPECT_FALSE(nonDefaultCommandStreamReceiver.flushBatchedSubmissionsCalled);
EXPECT_EQ(used, nonDefaultCommandStreamReceiver.getCS(0u).getUsed());
asyncDeleter->allowExit = true;
@@ -167,14 +172,16 @@ TEST_F(DeferrableAllocationDeletionTest, givenNotUsedAllocationWhenApplyDeletion
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
EXPECT_FALSE(allocation->isUsed());
EXPECT_EQ(0u, memoryManager->freeGraphicsMemoryCalled);
while (!asyncDeleter->doWorkInBackground)
while (!asyncDeleter->doWorkInBackground) {
std::this_thread::yield(); // wait for start async thread work
}
std::unique_lock<std::mutex> lock(asyncDeleter->queueMutex);
asyncDeleter->allowExit = true;
lock.unlock();
asyncDeleter->deferDeletion(new DeferrableAllocationDeletion(*memoryManager, *allocation));
while (!asyncDeleter->shouldStopReached) // wait async thread job end
while (!asyncDeleter->shouldStopReached) { // wait async thread job end
std::this_thread::yield();
}
EXPECT_EQ(1u, memoryManager->freeGraphicsMemoryCalled);
}
@@ -189,8 +196,9 @@ TEST_F(DeferrableAllocationDeletionTest, givenTwoAllocationsUsedByOneOsContextsE
EXPECT_TRUE(allocation2->isUsed());
asyncDeleter->deferDeletion(new DeferrableAllocationDeletion(*memoryManager, *allocation1));
asyncDeleter->deferDeletion(new DeferrableAllocationDeletion(*memoryManager, *allocation2));
while (0u == memoryManager->freeGraphicsMemoryCalled) // wait for delete second allocation
while (0u == memoryManager->freeGraphicsMemoryCalled) { // wait for delete second allocation
std::this_thread::yield();
}
EXPECT_EQ(1u, memoryManager->freeGraphicsMemoryCalled);
asyncDeleter->allowExit = true;
*hwTag = 2u;

View File

@@ -273,8 +273,9 @@ TEST_F(InternalAllocationStorageTest, givenAllocationListWhenTwoThreadsCleanConc
storage->cleanAllocationList(2, TEMPORARY_ALLOCATION);
});
while (!allocation1->inDestructor)
while (!allocation1->inDestructor) {
;
}
lock.unlock();
allocationDeletionLock.unlock();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -79,9 +79,11 @@ class PPGTTPageTable : public std::conditional<is64bit, PML4, PDPE>::type {
EXPECT_EQ(ppgttEntries, entries.size());
}
bool isEmpty() {
for (const auto &e : entries)
if (e != nullptr)
for (const auto &e : entries) {
if (e != nullptr) {
return false;
}
}
return true;
}
};
@@ -92,9 +94,11 @@ class GGTTPageTable : public PDPE {
EXPECT_EQ(4u, entries.size());
}
bool isEmpty() {
for (const auto &e : entries)
if (e != nullptr)
for (const auto &e : entries) {
if (e != nullptr) {
return false;
}
}
return true;
}
};

View File

@@ -125,8 +125,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenCommandStreamWhenItIsFlush
auto bo = drmAllocation->getBO();
// spin until gem close worker finishes execution
while (bo->getRefCount() > 1)
while (bo->getRefCount() > 1) {
;
}
mm->freeGraphicsMemory(commandBuffer);
}

View File

@@ -2519,8 +2519,9 @@ HWTEST_TEMPLATED_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndThreeOsHandlesW
for (unsigned int i = 0; i < 3; ++i) {
expectedRefCount = i < 2 ? i + 1 : 1;
if (i == 2)
if (i == 2) {
this->mock->outputHandle = 3u;
}
AllocationProperties properties(rootDeviceIndex, false, MemoryConstants::pageSize, AllocationType::sharedBuffer, false, mockDeviceBitfield);
TestedDrmMemoryManager::OsHandleData osHandleData{handles[i]};
@@ -2550,8 +2551,9 @@ HWTEST_TEMPLATED_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndThreeOsHandlesW
for (const auto &it : graphicsAllocations) {
// Clang-tidy false positive WA
if (it != nullptr)
if (it != nullptr) {
memoryManager->freeGraphicsMemory(it);
}
}
}

View File

@@ -60,8 +60,9 @@ struct DrmMockXeCcs : public DrmMockCustom {
} break;
case DrmIoctl::gemVmDestroy: {
struct drm_xe_vm_destroy *v = static_cast<struct drm_xe_vm_destroy *>(arg);
if (v->vm_id == testValueVmId)
if (v->vm_id == testValueVmId) {
ret = 0;
}
} break;
case DrmIoctl::gemMmapOffset: {
gemMmapOffsetCalled++;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2024 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -65,8 +65,9 @@ DWORD WINAPI getModuleFileNameAMock(HMODULE hModule, LPSTR lpFilename, DWORD nSi
}
HMODULE WINAPI loadLibraryExAMock(LPCSTR lpFileName, HANDLE hFile, DWORD dwFlags) {
if (mockWillFailInNonSystem32 && dwFlags != LOAD_LIBRARY_SEARCH_SYSTEM32)
if (mockWillFailInNonSystem32 && dwFlags != LOAD_LIBRARY_SEARCH_SYSTEM32) {
return NULL;
}
char fName[MAX_PATH];
auto lenFn = strlen(lpFileName);

View File

@@ -614,10 +614,11 @@ TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandlesWhenCreateGraphicsAllocation
EXPECT_EQ(4096u, wddmAllocation->getDefaultGmm()->gmmResourceInfo->getSizeAllocation());
if (i % 2)
if (i % 2) {
EXPECT_EQ(GMM_RESOURCE_USAGE_OCL_IMAGE, reinterpret_cast<MockGmmResourceInfo *>(wddmAllocation->getDefaultGmm()->gmmResourceInfo.get())->getResourceUsage());
else
} else {
EXPECT_EQ(GMM_RESOURCE_USAGE_OCL_BUFFER, reinterpret_cast<MockGmmResourceInfo *>(wddmAllocation->getDefaultGmm()->gmmResourceInfo.get())->getResourceUsage());
}
mm.freeGraphicsMemory(graphicsAllocation);
auto destroyWithResourceHandleCalled = 0u;

View File

@@ -2843,10 +2843,11 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleIs
EXPECT_EQ(NT_ALLOCATION_HANDLE, wddmAlloc->getDefaultHandle());
EXPECT_EQ(AllocationType::sharedImage, wddmAlloc->getAllocationType());
if (i % 2)
if (i % 2) {
EXPECT_EQ(GMM_RESOURCE_USAGE_OCL_IMAGE, reinterpret_cast<MockGmmResourceInfo *>(wddmAlloc->getDefaultGmm()->gmmResourceInfo.get())->getResourceUsage());
else
} else {
EXPECT_EQ(GMM_RESOURCE_USAGE_OCL_BUFFER, reinterpret_cast<MockGmmResourceInfo *>(wddmAlloc->getDefaultGmm()->gmmResourceInfo.get())->getResourceUsage());
}
memoryManager->freeGraphicsMemory(gpuAllocation);
}

View File

@@ -91,9 +91,9 @@ class PrintFormatterTest : public testing::Test {
void storeData(T value) {
T *valuePointer = reinterpret_cast<T *>(underlyingBuffer + offset);
if (isAligned(valuePointer))
if (isAligned(valuePointer)) {
*valuePointer = value;
else {
} else {
memcpy_s(valuePointer, sizeof(underlyingBuffer) - offset, &value, sizeof(T));
}
@@ -443,8 +443,9 @@ TEST_P(PrintfDoubleTest, GivenFormatContainingDoubleWhenPrintingThenValueIsInser
printFormatter->printKernelOutput([&actualOutput](char *str) { strncpy_s(actualOutput, maxPrintfOutputLength, str, maxPrintfOutputLength - 1); });
if (input.format[input.format.length() - 1] == 'F')
if (input.format[input.format.length() - 1] == 'F') {
input.format[input.format.length() - 1] = 'f';
}
snprintf(referenceOutput, sizeof(referenceOutput), input.format.c_str(), input.value);
@@ -623,8 +624,9 @@ TEST_F(PrintFormatterTest, GivenVector2WhenPrintingThenAllValuesAreInserted) {
storeData(channelCount);
// channel values
for (int i = 0; i < channelCount; i++)
for (int i = 0; i < channelCount; i++) {
storeData(i + 1);
}
char actualOutput[maxPrintfOutputLength];
@@ -644,8 +646,9 @@ TEST_F(PrintFormatterTest, GivenVector4WhenPrintingThenAllValuesAreInserted) {
storeData(channelCount);
// channel values
for (int i = 0; i < channelCount; i++)
for (int i = 0; i < channelCount; i++) {
storeData(i + 1);
}
char actualOutput[maxPrintfOutputLength];
@@ -665,8 +668,9 @@ TEST_F(PrintFormatterTest, GivenVector8WhenPrintingThenAllValuesAreInserted) {
storeData(channelCount);
// channel values
for (int i = 0; i < channelCount; i++)
for (int i = 0; i < channelCount; i++) {
storeData(i + 1);
}
char actualOutput[maxPrintfOutputLength];
@@ -686,8 +690,9 @@ TEST_F(PrintFormatterTest, GivenVector16WhenPrintingThenAllValuesAreInserted) {
storeData(channelCount);
// channel values
for (int i = 0; i < channelCount; i++)
for (int i = 0; i < channelCount; i++) {
storeData(i + 1);
}
char actualOutput[maxPrintfOutputLength];
@@ -901,24 +906,28 @@ TEST_F(PrintFormatterTest, Given2ByteVectorsWhenPrintingThenDataBufferParsedProp
storeData(channelCount);
// channel values
for (int i = 0; i < channelCount; i++)
for (int i = 0; i < channelCount; i++) {
storeData(static_cast<int8_t>(i + 1));
}
// filler, should not be printed
for (int i = 0; i < 12; i++)
for (int i = 0; i < 12; i++) {
storeData(static_cast<int8_t>(0));
}
storeData(PrintfDataType::vectorByteType);
// channel count
storeData(channelCount);
// channel values
for (int i = 0; i < channelCount; i++)
for (int i = 0; i < channelCount; i++) {
storeData(static_cast<int8_t>(i + 1));
}
// filler, should not be printed
for (int i = 0; i < 12; i++)
for (int i = 0; i < 12; i++) {
storeData(static_cast<int8_t>(0));
}
char actualOutput[maxPrintfOutputLength];

View File

@@ -736,8 +736,9 @@ TEST(HeapAllocatorTest, WhenMemoryIsAllocatedThenAllocationsDoNotOverlap) {
sizes[i] = sizeToAllocate;
ptrs[i] = heapAllocator->allocate(sizes[i]);
if (ptrs[i] == 0llu)
if (ptrs[i] == 0llu) {
break;
}
uint8_t *pTemp = reinterpret_cast<uint8_t *>(ptrs[i]);
for (uint32_t j = 0; j < sizes[i] / 4096; j++) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -35,8 +35,9 @@ TEST(SpinLockTest, givenTwoThreadsThenVerifyThatTheySynchronizeWithSpinLock) {
});
// Wait till worker thread is started
while (!threadStarted)
while (!threadStarted) {
;
}
sharedCount++;
EXPECT_EQ(1, sharedCount);
@@ -44,8 +45,9 @@ TEST(SpinLockTest, givenTwoThreadsThenVerifyThatTheySynchronizeWithSpinLock) {
lock1.unlock();
// Wait till worker thread finishes
while (!threadFinished)
while (!threadFinished) {
;
}
EXPECT_EQ(2, sharedCount);
workerThread.join();
}