Skip to content

Commit bbafb47

Browse files
vmustyaArtem Gindinson
authored andcommitted
VC subtarget refactoring
Refactor VC subtargets to reduce copy-paste
1 parent 08fca25 commit bbafb47

File tree

11 files changed

+414
-373
lines changed

11 files changed

+414
-373
lines changed
Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1+
#=========================== begin_copyright_notice ============================
2+
#
3+
# Copyright (C) 2020-2022 Intel Corporation
4+
#
5+
# SPDX-License-Identifier: MIT
6+
#
7+
#============================ end_copyright_notice =============================
18

29
set(SUPPORTED_VC_PLATFORMS
3-
"BDW"
4-
"SKL"
5-
"BXT"
6-
"KBL"
7-
"GLK"
8-
"ICLLP"
9-
"TGLLP"
10-
"RKL"
11-
"DG1"
12-
"XEHP"
13-
"ADLP"
14-
"ADLS"
15-
"ADLN"
16-
"DG2"
17-
"PVC"
18-
"PVCXT_A0"
19-
"PVCXT"
20-
"MTL"
10+
"Gen8"
11+
"Gen9"
12+
"Gen9LP"
13+
"Gen11"
14+
"XeLP"
15+
"XeHP"
16+
"XeHPG"
17+
"XeLPG"
18+
"XeHPC"
2119
)

IGC/VectorCompiler/igcdeps/src/TranslationInterface.cpp

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,52 @@ std::unique_ptr<llvm::MemoryBuffer> getVCModuleBuffer() {
142142
false /* RequiresNullTerminator */);
143143
}
144144

145+
static std::pair<std::string, unsigned>
146+
getPlatformName(const PLATFORM &Platform) {
147+
constexpr unsigned ComputeTileMaskPVC = 7;
148+
auto Core = Platform.eRenderCoreFamily;
149+
auto Product = Platform.eProductFamily;
150+
unsigned DevId = Platform.usDeviceID;
151+
unsigned RevId = Platform.usRevId;
152+
153+
switch (Core) {
154+
case IGFX_GEN8_CORE:
155+
return {"Gen8", RevId};
156+
case IGFX_GEN9_CORE:
157+
if (Product == IGFX_BROXTON || Product == IGFX_GEMINILAKE)
158+
return {"Gen9LP", RevId};
159+
return {"Gen9", RevId};
160+
case IGFX_GEN11_CORE:
161+
case IGFX_GEN11LP_CORE:
162+
return {"Gen11", RevId};
163+
case IGFX_GEN12_CORE:
164+
case IGFX_GEN12LP_CORE:
165+
return {"XeLP", RevId};
166+
case IGFX_XE_HP_CORE:
167+
return {"XeHP", RevId};
168+
case IGFX_XE_HPG_CORE:
169+
if (Product == IGFX_DG2)
170+
return {"XeHPG", RevId};
171+
if (Product == IGFX_METEORLAKE)
172+
return {"XeLPG", RevId};
173+
break;
174+
case IGFX_XE_HPC_CORE:
175+
if (Product == IGFX_PVC)
176+
return {"XeHPC", RevId & ComputeTileMaskPVC};
177+
break;
178+
default:
179+
break;
180+
}
181+
IGC_ASSERT_EXIT_MESSAGE(0, "Unsupported platform");
182+
return {"Invalid", -1};
183+
}
184+
145185
static void adjustPlatform(const IGC::CPlatform &IGCPlatform,
146186
vc::CompileOptions &Opts) {
147187
auto &PlatformInfo = IGCPlatform.getPlatformInfo();
148-
unsigned RevId = PlatformInfo.usRevId;
149-
const char *PlatformStr =
150-
cmc::getPlatformStr(PlatformInfo, /* inout */ RevId);
151-
Opts.CPUStr = PlatformStr ? PlatformStr : "";
152-
Opts.RevId = RevId;
188+
189+
std::tie(Opts.CPUStr, Opts.RevId) = getPlatformName(PlatformInfo);
190+
153191
Opts.HasL1ReadOnlyCache = IGCPlatform.hasL1ReadOnlyCache();
154192
Opts.HasLocalMemFenceSupress = IGCPlatform.localMemFenceSupress();
155193
Opts.HasMultiTile = IGCPlatform.hasMultiTile();

IGC/VectorCompiler/lib/Driver/Driver.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,13 @@ static std::string getSubtargetFeatureString(const vc::CompileOptions &Opts) {
175175
if (Opts.HasHalfSIMDLSC)
176176
Features.AddFeature("feature_has_half_simd_lsc");
177177

178+
if (Opts.CPUStr == "XeHPC") {
179+
if (Opts.RevId < 3)
180+
Features.AddFeature("lightweight_i64_emulation", false);
181+
else if (Opts.RevId < 5)
182+
Features.AddFeature("add64", false);
183+
}
184+
178185
return Features.getString();
179186
}
180187

0 commit comments

Comments
 (0)