Skip to content

Commit 9293c9b

Browse files
Use isMidThreadPreemptionSupported helper in compiler interface
Signed-off-by: Kamil Kopryk <[email protected]>
1 parent 5330c9c commit 9293c9b

File tree

14 files changed

+60
-6
lines changed

14 files changed

+60
-6
lines changed

opencl/test/unit_test/offline_compiler/mock/mock_offline_compiler.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class MockOfflineCompiler : public OfflineCompiler {
3131
using OfflineCompiler::internalOptions;
3232
using OfflineCompiler::irBinary;
3333
using OfflineCompiler::irBinarySize;
34+
using OfflineCompiler::isMidThreadPreemptionSupported;
3435
using OfflineCompiler::isSpirV;
3536
using OfflineCompiler::options;
3637
using OfflineCompiler::outputDirectory;

opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,20 @@ TEST(OfflineCompilerTest, givenDefaultOfflineCompilerObjectWhenNoOptionsAreChang
10171017
EXPECT_FALSE(mockOfflineCompiler->inputFileSpirV);
10181018
}
10191019

1020+
TEST(OfflineCompilerTest, whenIsMidThreadPreemptionSupportedIsCalledThenCorrectResultIsReturned) {
1021+
MockOfflineCompiler offlineCompiler;
1022+
1023+
if (!hardwarePrefix[IGFX_SKYLAKE]) {
1024+
GTEST_SKIP();
1025+
}
1026+
offlineCompiler.getHardwareInfo("skl");
1027+
offlineCompiler.hwInfo.featureTable.ftrGpGpuMidThreadLevelPreempt = false;
1028+
EXPECT_FALSE(offlineCompiler.isMidThreadPreemptionSupported(offlineCompiler.hwInfo));
1029+
1030+
offlineCompiler.hwInfo.featureTable.ftrGpGpuMidThreadLevelPreempt = true;
1031+
EXPECT_TRUE(offlineCompiler.isMidThreadPreemptionSupported(offlineCompiler.hwInfo));
1032+
}
1033+
10201034
TEST(OfflineCompilerTest, givenIntermediateRepresentationInputWhenBuildSourceCodeIsCalledThenProperTranslationContextIsUsed) {
10211035
MockOfflineCompiler mockOfflineCompiler;
10221036
std::vector<std::string> argv = {

opencl/test/unit_test/os_interface/linux/hw_info_config_linux_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ HWTEST_F(HwInfoConfigTestLinuxDummy, GivenPreemptionDrmEnabledMidThreadOnWhenCon
320320
I915_SCHEDULER_CAP_PREEMPTION;
321321
drm->storedDeviceID = hwConfigTestMidThreadBit;
322322

323-
UnitTestHelper<FamilyType>::setExtraMidThreadPreemptionFlag(pInHwInfo);
323+
UnitTestHelper<FamilyType>::setExtraMidThreadPreemptionFlag(pInHwInfo, true);
324324

325325
int ret = hwConfig.configureHwInfoDrm(&pInHwInfo, &outHwInfo, osInterface);
326326
EXPECT_EQ(0, ret);

shared/offline_compiler/source/extra_settings.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@ void OfflineCompiler::resolveExtraSettings() {
1616
CompilerOptions::concatenateAppend(internalOptions, CompilerOptions::forceEmuInt32DivRemSP);
1717
}
1818
}
19+
20+
bool OfflineCompiler::isMidThreadPreemptionSupported(const HardwareInfo &hwInfo) {
21+
return hwInfo.featureTable.ftrGpGpuMidThreadLevelPreempt;
22+
}
23+
1924
} // namespace NEO

shared/offline_compiler/source/offline_compiler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ int OfflineCompiler::initialize(size_t numArgs, const std::vector<std::string> &
609609
igcFeWa.get()->SetFtrGTX(hwInfo.featureTable.ftrGTX);
610610
igcFeWa.get()->SetFtr5Slice(hwInfo.featureTable.ftr5Slice);
611611

612-
igcFeWa.get()->SetFtrGpGpuMidThreadLevelPreempt(hwInfo.featureTable.ftrGpGpuMidThreadLevelPreempt);
612+
igcFeWa.get()->SetFtrGpGpuMidThreadLevelPreempt(isMidThreadPreemptionSupported(hwInfo));
613613
igcFeWa.get()->SetFtrIoMmuPageFaulting(hwInfo.featureTable.ftrIoMmuPageFaulting);
614614
igcFeWa.get()->SetFtrWddm2Svm(hwInfo.featureTable.ftrWddm2Svm);
615615
igcFeWa.get()->SetFtrPooledEuEnabled(hwInfo.featureTable.ftrPooledEuEnabled);

shared/offline_compiler/source/offline_compiler.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ class OfflineCompiler {
9696
int parseCommandLine(size_t numArgs, const std::vector<std::string> &allArgs);
9797
void setStatelessToStatefullBufferOffsetFlag();
9898
void resolveExtraSettings();
99+
bool isMidThreadPreemptionSupported(const HardwareInfo &hwInfo);
99100
void parseDebugSettings();
100101
void storeBinary(char *&pDst, size_t &dstSize, const void *pSrc, const size_t srcSize);
101102
MOCKABLE_VIRTUAL int buildSourceCode();

shared/source/compiler_interface/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (C) 2019-2020 Intel Corporation
2+
# Copyright (C) 2019-2021 Intel Corporation
33
#
44
# SPDX-License-Identifier: MIT
55
#
@@ -13,6 +13,7 @@ set(NEO_COMPILER_INTERFACE
1313
${CMAKE_CURRENT_SOURCE_DIR}/compiler_interface.inl
1414
${CMAKE_CURRENT_SOURCE_DIR}/create_main.cpp
1515
${CMAKE_CURRENT_SOURCE_DIR}/default_cache_config.h
16+
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/compiler_extra_settings.cpp
1617
${CMAKE_CURRENT_SOURCE_DIR}/intermediate_representations.h
1718
${CMAKE_CURRENT_SOURCE_DIR}/linker.h
1819
${CMAKE_CURRENT_SOURCE_DIR}/linker.inl
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright (C) 2021 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#include "shared/source/compiler_interface/compiler_interface.h"
9+
10+
namespace NEO {
11+
12+
bool CompilerInterface::isMidThreadPreemptionSupported(const HardwareInfo &hwInfo) {
13+
return hwInfo.featureTable.ftrGpGpuMidThreadLevelPreempt;
14+
}
15+
16+
} // namespace NEO

shared/source/compiler_interface/compiler_interface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ IGC::IgcOclDeviceCtxTagOCL *CompilerInterface::getIgcDeviceCtx(const Device &dev
452452
igcFeWa.get()->SetFtrGTX(device.getHardwareInfo().featureTable.ftrGTX);
453453
igcFeWa.get()->SetFtr5Slice(device.getHardwareInfo().featureTable.ftr5Slice);
454454

455-
igcFeWa.get()->SetFtrGpGpuMidThreadLevelPreempt(device.getHardwareInfo().featureTable.ftrGpGpuMidThreadLevelPreempt);
455+
igcFeWa.get()->SetFtrGpGpuMidThreadLevelPreempt(isMidThreadPreemptionSupported(device.getHardwareInfo()));
456456
igcFeWa.get()->SetFtrIoMmuPageFaulting(device.getHardwareInfo().featureTable.ftrIoMmuPageFaulting);
457457
igcFeWa.get()->SetFtrWddm2Svm(device.getHardwareInfo().featureTable.ftrWddm2Svm);
458458
igcFeWa.get()->SetFtrPooledEuEnabled(device.getHardwareInfo().featureTable.ftrPooledEuEnabled);

shared/source/compiler_interface/compiler_interface.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,5 +183,7 @@ class CompilerInterface {
183183
bool requiresIgc = (IGC::CodeType::oclC != translationSrc) || ((IGC::CodeType::spirV != translationDst) && (IGC::CodeType::llvmBc != translationDst) && (IGC::CodeType::llvmLl != translationDst));
184184
return (isFclAvailable() || (false == requiresFcl)) && (isIgcAvailable() || (false == requiresIgc));
185185
}
186+
187+
bool isMidThreadPreemptionSupported(const HardwareInfo &hwInfo);
186188
};
187189
} // namespace NEO

0 commit comments

Comments
 (0)