refactor: Use else if instead of nested else-if conditions

Replaces nested else-if with else if for consistency and readability.
No functional changes.

Signed-off-by: Vysochyn, Illia <illia.vysochyn@intel.com>
This commit is contained in:
Vysochyn, Illia
2025-09-11 13:43:40 +00:00
committed by Compute-Runtime-Automation
parent ed15408592
commit f4bd4e603d
18 changed files with 71 additions and 113 deletions

View File

@@ -805,10 +805,8 @@ ze_result_t KernelImp::setArgBuffer(uint32_t argIndex, size_t argSize, const voi
}
}
}
} else {
if (argInfo.isSetToNullptr) {
return ZE_RESULT_SUCCESS;
}
} else if (argInfo.isSetToNullptr) {
return ZE_RESULT_SUCCESS;
}
const auto &allArgs = getImmutableData()->getDescriptor().payloadMappings.explicitArgs;

View File

@@ -844,11 +844,9 @@ void MutableCommandListCoreFamily<gfxCoreFamily>::storeSignalEventVariable(Mutab
if (mutableEventParams.l3FlushEvent) {
mutableEventParams.l3FlushEventTimestampSyncCmds = true;
}
} else {
if (mutableEventParams.l3FlushEvent) {
launchParams.outSyncCommand = &mutableEventParams.signalCmd;
mutableEventParams.l3FlushEventSyncCmd = true;
}
} else if (mutableEventParams.l3FlushEvent) {
launchParams.outSyncCommand = &mutableEventParams.signalCmd;
mutableEventParams.l3FlushEventSyncCmd = true;
}
}
launchParams.omitAddingEventResidency |= (mutableEventParams.l3FlushEvent || mutableEventParams.counterBasedTimestampEvent);

View File

@@ -797,10 +797,8 @@ bool checkExtensionIsPresent(ze_driver_handle_t &driverHandle, std::vector<ze_dr
std::cout << "Checked extension version: " << ZE_MAJOR_VERSION(version) << "." << ZE_MINOR_VERSION(version) << " is equal or lower than present." << std::endl;
}
numMatchedExtensions++;
} else {
if (verbose) {
std::cout << "Checked extension version: " << ZE_MAJOR_VERSION(version) << "." << ZE_MINOR_VERSION(version) << " is greater than present." << std::endl;
}
} else if (verbose) {
std::cout << "Checked extension version: " << ZE_MAJOR_VERSION(version) << "." << ZE_MINOR_VERSION(version) << " is greater than present." << std::endl;
}
}
}

View File

@@ -198,10 +198,8 @@ int main(int argc, char *argv[]) {
if (expectedResult != *(int *)resultBuffer) {
std::cout << "Result:" << *(int *)resultBuffer << " invalid\n";
outputValidationSuccessful = false;
} else {
if (LevelZeroBlackBoxTests::verbose) {
std::cout << "Result Buffer is correct with a value of:" << *(int *)resultBuffer << "\n";
}
} else if (LevelZeroBlackBoxTests::verbose) {
std::cout << "Result Buffer is correct with a value of:" << *(int *)resultBuffer << "\n";
}
// Cleanup

View File

@@ -131,15 +131,13 @@ void executeKernelAndValidate(ze_context_handle_t &context,
outputValidationSuccessful = false;
break;
}
} else {
if (dstCharBuffer[i] != srcCharBuffer[i]) {
std::cout << "dstBuffer[" << i << "] = "
<< std::dec << static_cast<unsigned int>(dstCharBuffer[i]) << " not equal to "
<< "srcBuffer[" << i << "] = "
<< std::dec << static_cast<unsigned int>(srcCharBuffer[i]) << "\n";
outputValidationSuccessful = false;
break;
}
} else if (dstCharBuffer[i] != srcCharBuffer[i]) {
std::cout << "dstBuffer[" << i << "] = "
<< std::dec << static_cast<unsigned int>(dstCharBuffer[i]) << " not equal to "
<< "srcBuffer[" << i << "] = "
<< std::dec << static_cast<unsigned int>(srcCharBuffer[i]) << "\n";
outputValidationSuccessful = false;
break;
}
}

View File

@@ -1659,10 +1659,8 @@ void find3dBtdCommand(LinearStream &cmdStream, size_t offset, size_t size, uint6
if (expectToFind) {
ASSERT_NE(0u, size);
} else {
if (size == 0) {
return;
}
} else if (size == 0) {
return;
}
bool btdCommandFound = false;

View File

@@ -85,10 +85,8 @@ struct MockDiagFsAccess : public L0::Sysman::FsAccessInterface {
ze_result_t write(const std::string file, std::string val) override {
if (checkErrorAfterCount) {
checkErrorAfterCount--;
} else {
if (mockWriteError != ZE_RESULT_SUCCESS) {
return mockWriteError;
}
} else if (mockWriteError != ZE_RESULT_SUCCESS) {
return mockWriteError;
}
if (!file.compare(mockSlotPath1 + "power")) {
return ZE_RESULT_SUCCESS;
@@ -148,10 +146,8 @@ struct MockDiagSysfsAccess : public L0::Sysman::SysFsAccessInterface {
ze_result_t write(const std::string file, const int val) override {
if (checkErrorAfterCount) {
checkErrorAfterCount--;
} else {
if (mockError != ZE_RESULT_SUCCESS) {
return mockError;
}
} else if (mockError != ZE_RESULT_SUCCESS) {
return mockError;
}
if (std::string::npos != file.find(mockQuiescentGpuFile)) {
if (checkErrorAfterCount) {

View File

@@ -570,10 +570,8 @@ ze_result_t DebugSessionImp::resume(ze_device_thread_t thread) {
if (connectedDevice->getNEODevice()->isSubDevice()) {
deviceIndex = Math::log2(static_cast<uint32_t>(connectedDevice->getNEODevice()->getDeviceBitfield().to_ulong()));
} else {
if (thread.slice != UINT32_MAX) {
deviceIndex = getDeviceIndexFromApiThread(thread);
}
} else if (thread.slice != UINT32_MAX) {
deviceIndex = getDeviceIndexFromApiThread(thread);
}
auto result = resumeThreadsWithinDevice(deviceIndex, thread);

View File

@@ -391,10 +391,8 @@ ze_result_t IpSamplingMetricGroupImp::calculateMetricValuesExp(const zet_metric_
if (!calculateCountOnly) {
pMetricCounts[0] = *pTotalMetricValueCount;
}
} else {
if (!calculateCountOnly) {
pMetricCounts[0] = 0;
}
} else if (!calculateCountOnly) {
pMetricCounts[0] = 0;
}
return result;

View File

@@ -80,10 +80,8 @@ struct MockDiagFsAccess : public FsAccess {
ze_result_t write(const std::string file, std::string val) override {
if (checkErrorAfterCount) {
checkErrorAfterCount--;
} else {
if (mockWriteError != ZE_RESULT_SUCCESS) {
return mockWriteError;
}
} else if (mockWriteError != ZE_RESULT_SUCCESS) {
return mockWriteError;
}
if (!file.compare(mockSlotPath1 + "power")) {
return ZE_RESULT_SUCCESS;
@@ -143,10 +141,8 @@ struct MockDiagSysfsAccess : public SysfsAccess {
ze_result_t write(const std::string file, const int val) override {
if (checkErrorAfterCount) {
checkErrorAfterCount--;
} else {
if (mockError != ZE_RESULT_SUCCESS) {
return mockError;
}
} else if (mockError != ZE_RESULT_SUCCESS) {
return mockError;
}
if (std::string::npos != file.find(mockQuiescentGpuFile)) {
if (checkErrorAfterCount) {
@@ -258,4 +254,4 @@ class PublicLinuxDiagnosticsImp : public L0::LinuxDiagnosticsImp {
using LinuxDiagnosticsImp::waitForQuiescentCompletion;
};
} // namespace ult
} // namespace L0
} // namespace L0