mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 00:24:58 +08:00
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:
committed by
Compute-Runtime-Automation
parent
ed15408592
commit
f4bd4e603d
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -546,13 +546,11 @@ cl_int Image::validatePlanarYUV(Context *context,
|
||||
if (!memoryProperties.flags.hostNoAccess) {
|
||||
errorCode = CL_INVALID_VALUE;
|
||||
break;
|
||||
} else {
|
||||
if (imageDesc->image_height % 4 ||
|
||||
imageDesc->image_width % 4 ||
|
||||
imageDesc->image_type != CL_MEM_OBJECT_IMAGE2D) {
|
||||
errorCode = CL_INVALID_IMAGE_DESCRIPTOR;
|
||||
break;
|
||||
}
|
||||
} else if (imageDesc->image_height % 4 ||
|
||||
imageDesc->image_width % 4 ||
|
||||
imageDesc->image_type != CL_MEM_OBJECT_IMAGE2D) {
|
||||
errorCode = CL_INVALID_IMAGE_DESCRIPTOR;
|
||||
break;
|
||||
}
|
||||
|
||||
pClDevice->getCap<CL_DEVICE_PLANAR_YUV_MAX_WIDTH_INTEL>(reinterpret_cast<const void *&>(maxWidth), srcSize, retSize);
|
||||
@@ -572,12 +570,10 @@ cl_int Image::validatePackedYUV(const MemoryProperties &memoryProperties, const
|
||||
if (!memoryProperties.flags.readOnly) {
|
||||
errorCode = CL_INVALID_VALUE;
|
||||
break;
|
||||
} else {
|
||||
if (imageDesc->image_width % 2 != 0 ||
|
||||
imageDesc->image_type != CL_MEM_OBJECT_IMAGE2D) {
|
||||
errorCode = CL_INVALID_IMAGE_DESCRIPTOR;
|
||||
break;
|
||||
}
|
||||
} else if (imageDesc->image_width % 2 != 0 ||
|
||||
imageDesc->image_type != CL_MEM_OBJECT_IMAGE2D) {
|
||||
errorCode = CL_INVALID_IMAGE_DESCRIPTOR;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
* Copyright (C) 2018-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -268,19 +268,17 @@ int drmQueryItem(NEO::Query *query) {
|
||||
queryItemArg->length = static_cast<int32_t>(sizeof(NEO::QueryTopologyInfo) + dataSize);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if (queryItemArg->queryId == DRM_I915_QUERY_TOPOLOGY_INFO) {
|
||||
auto topologyArg = reinterpret_cast<NEO::QueryTopologyInfo *>(queryItemArg->dataPtr);
|
||||
topologyArg->maxSlices = 1;
|
||||
topologyArg->maxSubslices = 1;
|
||||
topologyArg->maxEusPerSubslice = 3;
|
||||
topologyArg->subsliceOffset = 1;
|
||||
topologyArg->subsliceStride = 1;
|
||||
topologyArg->euOffset = 2;
|
||||
topologyArg->euStride = 1;
|
||||
memset(topologyArg->data, 0xFF, dataSize);
|
||||
return failOnEuTotal || failOnSubsliceTotal;
|
||||
}
|
||||
} else if (queryItemArg->queryId == DRM_I915_QUERY_TOPOLOGY_INFO) {
|
||||
auto topologyArg = reinterpret_cast<NEO::QueryTopologyInfo *>(queryItemArg->dataPtr);
|
||||
topologyArg->maxSlices = 1;
|
||||
topologyArg->maxSubslices = 1;
|
||||
topologyArg->maxEusPerSubslice = 3;
|
||||
topologyArg->subsliceOffset = 1;
|
||||
topologyArg->subsliceStride = 1;
|
||||
topologyArg->euOffset = 2;
|
||||
topologyArg->euStride = 1;
|
||||
memset(topologyArg->data, 0xFF, dataSize);
|
||||
return failOnEuTotal || failOnSubsliceTotal;
|
||||
}
|
||||
|
||||
return drmQuery(query);
|
||||
|
||||
@@ -1067,10 +1067,8 @@ TEST_F(ImageTransfer, GivenNonZeroCopyNonZeroRowPitchWithExtraBytes1DArrayImageW
|
||||
if (row[pixelInRow] != pixelInRow) {
|
||||
EXPECT_FALSE(1) << "Data under host_ptr did not validate, row: " << pixelInRow << " array: " << arrayIndex << "\n";
|
||||
}
|
||||
} else {
|
||||
if (row[pixelInRow] != 55) {
|
||||
EXPECT_FALSE(1) << "Data under host_ptr corrupted in extra bytes, row: " << pixelInRow << " array: " << arrayIndex << "\n";
|
||||
}
|
||||
} else if (row[pixelInRow] != 55) {
|
||||
EXPECT_FALSE(1) << "Data under host_ptr corrupted in extra bytes, row: " << pixelInRow << " array: " << arrayIndex << "\n";
|
||||
}
|
||||
}
|
||||
row = row + imageRowPitchInPixels;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
* Copyright (C) 2021-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -24,10 +24,8 @@ struct StreamPropertyType {
|
||||
value = newValue;
|
||||
isDirty = true;
|
||||
}
|
||||
} else {
|
||||
if (newValue != initValue) {
|
||||
value = newValue;
|
||||
}
|
||||
} else if (newValue != initValue) {
|
||||
value = newValue;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -30,11 +30,9 @@ bool createCompilerCachePath(std::string &cacheDir) {
|
||||
if (NEO::SysCalls::mkdir(joinPath(cacheDir, "neo_compiler_cache")) == 0) {
|
||||
cacheDir = joinPath(cacheDir, "neo_compiler_cache");
|
||||
return true;
|
||||
} else {
|
||||
if (errno == EEXIST) {
|
||||
cacheDir = joinPath(cacheDir, "neo_compiler_cache");
|
||||
return true;
|
||||
}
|
||||
} else if (errno == EEXIST) {
|
||||
cacheDir = joinPath(cacheDir, "neo_compiler_cache");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,4 +91,4 @@ bool isAnyIgcEnvVarSet() {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} // namespace NEO
|
||||
} // namespace NEO
|
||||
|
||||
@@ -77,13 +77,11 @@ void StateBaseAddressHelper<GfxFamily>::programStateBaseAddress(
|
||||
args.stateBaseAddressCmd->setBindlessSurfaceStateBaseAddressModifyEnable(true);
|
||||
args.stateBaseAddressCmd->setBindlessSurfaceStateBaseAddress(args.globalHeapsBaseAddress);
|
||||
args.stateBaseAddressCmd->setBindlessSurfaceStateSize(surfaceStateCount);
|
||||
} else {
|
||||
if (args.dsh) {
|
||||
args.stateBaseAddressCmd->setDynamicStateBaseAddressModifyEnable(true);
|
||||
args.stateBaseAddressCmd->setDynamicStateBufferSizeModifyEnable(true);
|
||||
args.stateBaseAddressCmd->setDynamicStateBaseAddress(args.dsh->getHeapGpuBase());
|
||||
args.stateBaseAddressCmd->setDynamicStateBufferSize(args.dsh->getHeapSizeInPages());
|
||||
}
|
||||
} else if (args.dsh) {
|
||||
args.stateBaseAddressCmd->setDynamicStateBaseAddressModifyEnable(true);
|
||||
args.stateBaseAddressCmd->setDynamicStateBufferSizeModifyEnable(true);
|
||||
args.stateBaseAddressCmd->setDynamicStateBaseAddress(args.dsh->getHeapGpuBase());
|
||||
args.stateBaseAddressCmd->setDynamicStateBufferSize(args.dsh->getHeapSizeInPages());
|
||||
}
|
||||
|
||||
if (args.ssh) {
|
||||
|
||||
@@ -99,11 +99,9 @@ bool adjustGfxPartitionLayout(GMM_GFX_PARTITIONING &partitionLayout, uint64_t gp
|
||||
|
||||
if (false == readPartitionLayoutWithinProcess(wddm, partitionLayout)) {
|
||||
return false;
|
||||
} else {
|
||||
if (partitionLayout.Standard64KB.Limit != 0) {
|
||||
// already partitioned
|
||||
return true;
|
||||
}
|
||||
} else if (partitionLayout.Standard64KB.Limit != 0) {
|
||||
// already partitioned
|
||||
return true;
|
||||
}
|
||||
|
||||
partitionLayout.SVM.Base = minAllowedAddress;
|
||||
|
||||
@@ -897,10 +897,8 @@ HWTEST2_F(MemoryManagerDirectSubmissionImplicitScalingTest, givenDirectSubmissio
|
||||
if (multiTile) {
|
||||
EXPECT_EQ(MemoryPool::localMemory, allocation->getMemoryPool());
|
||||
EXPECT_EQ(firstTileMask, allocation->storageInfo.getMemoryBanks());
|
||||
} else {
|
||||
if (allocationType != AllocationType::commandBuffer) {
|
||||
EXPECT_NE(firstTileMask, allocation->storageInfo.getMemoryBanks());
|
||||
}
|
||||
} else if (allocationType != AllocationType::commandBuffer) {
|
||||
EXPECT_NE(firstTileMask, allocation->storageInfo.getMemoryBanks());
|
||||
}
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user