From 11405af267068737911c100d50ec73b1fcbcac98 Mon Sep 17 00:00:00 2001 From: Zbigniew Zdanowicz Date: Tue, 3 Sep 2024 16:30:48 +0000 Subject: [PATCH] performance: use simple if operation instead of std max Signed-off-by: Zbigniew Zdanowicz --- .../core/source/cmdlist/cmdlist_hw_xehp_and_later.inl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl b/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl index b6d133060b..76253c3fe8 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl @@ -131,8 +131,13 @@ ze_result_t CommandListCoreFamily::appendLaunchKernelWithParams(K bool kernelNeedsScratchSpace = false; if (!launchParams.makeKernelCommandView) { for (uint32_t slotId = 0u; slotId < 2; slotId++) { - auto currentPerThreadScratchSize = std::max(launchParams.externalPerThreadScratchSize[slotId], kernelDescriptor.kernelAttributes.perThreadScratchSize[slotId]); - commandListPerThreadScratchSize[slotId] = std::max(commandListPerThreadScratchSize[slotId], currentPerThreadScratchSize); + auto currentPerThreadScratchSize = kernelDescriptor.kernelAttributes.perThreadScratchSize[slotId]; + if (launchParams.externalPerThreadScratchSize[slotId] > currentPerThreadScratchSize) { + currentPerThreadScratchSize = launchParams.externalPerThreadScratchSize[slotId]; + } + if (currentPerThreadScratchSize > commandListPerThreadScratchSize[slotId]) { + commandListPerThreadScratchSize[slotId] = currentPerThreadScratchSize; + } if (commandListPerThreadScratchSize[slotId] > 0) { needScratchSpace = true; }