Skip to content

Commit 2f0b0fc

Browse files
author
Konstantin Vladimirov
committed
Introducing DG2 and PVC support for CM
New platforms support in CM compiler
1 parent 4494ce3 commit 2f0b0fc

31 files changed

+3732
-11
lines changed

include/clang/Basic/Builtins.def

+2
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,8 @@ BUILTIN(cm_scoreboard_bti, "Ui","ni")
872872
BUILTIN(cm_scoreboard_deltas, "Q16c", "ni")
873873
BUILTIN(cm_scoreboard_depcnt, "UiUi", "ni")
874874
BUILTIN(cm_sbarrier, "vUi", "ni")
875+
BUILTIN(cm_nbarrier_init, "vUc", "ni")
876+
BUILTIN(cm_nbarrier_wait, "vUc", "ni")
875877
BUILTIN(cm_yield, "v", "ni")
876878
BUILTIN(cm_print_buffer, "LUi", "ni")
877879
BUILTIN(cm_print_format_index, "icC*", "ni")

include/clang/Basic/TargetOptions.h

+3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ class TargetOptions {
3939
/// If given, the name of the target CPU to generate code for.
4040
std::string CPU;
4141

42+
/// If given, the name of the stepping to generate code for.
43+
std::string Stepping;
44+
4245
// If given, revision id to pass to ocloc
4346
int RevId;
4447

include/clang/Driver/CMOptions.td

+7
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,13 @@ def dump_stats_cwd : Flag<["-"], "dump-stats">, Group<cm_Group>,
238238
HelpText<"Alias for -dump-stats=cwd">, Alias<dump_stats>, AliasArgs<["cwd"]>,
239239
Flags<[CMOption, CC1Option, CC1AsOption]>;
240240

241+
def Qxcm_doubleGRF : CMIgnoredFlag<"Qxcm_doubleGRF">,
242+
HelpText<"increase total GRF number to 256">;
243+
244+
def Qxcm_stepping: CMJoined<"Qxcm_stepping">,
245+
HelpText<"Generate code taking platform stepping into account. "
246+
"Valid only for some platforms">;
247+
241248
def Qxcm_revid: CMCC1Joined<"Qxcm_revid=">,
242249
HelpText<"Pass specified revision ID to libocloc "
243250
"Valid only for some platforms">;

lib/Basic/Targets/GenX.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,19 @@ bool GenXTargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
6161
.Case("RKL", false)
6262
.Case("TGLLP", false)
6363
.Case("DG1", false)
64+
.Case("ADLS", false)
65+
.Case("ADLP", false)
66+
.Case("DG2", false)
6467
.Default(true);
6568

6669
NativeDoubleSupport = llvm::StringSwitch<bool>(CPU)
6770
.Case("ICLLP", false)
6871
.Case("TGLLP", false)
6972
.Case("RKL", false)
7073
.Case("DG1", false)
74+
.Case("ADLS", false)
75+
.Case("ADLP", false)
76+
.Case("DG2", false)
7177
.Default(true);
7278

7379
// OCL runtime specific headers support
@@ -92,6 +98,11 @@ bool GenXTargetInfo::setCPU(const std::string &Name) {
9298
.Case("RKL", true)
9399
.Case("DG1", true)
94100
.Case("XEHP_SDV", true)
101+
.Case("ADLP", true)
102+
.Case("ADLS", true)
103+
.Case("DG2", true)
104+
.Case("PVC", true)
105+
.Case("PVCXT", true)
95106
.Default(false);
96107

97108
if (CPUKnown)

lib/CodeGen/CGBuiltin.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -2295,6 +2295,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
22952295
case Builtin::BIcm_scoreboard_deltas:
22962296
case Builtin::BIcm_scoreboard_depcnt:
22972297
case Builtin::BIcm_sbarrier:
2298+
case Builtin::BIcm_nbarrier_init:
2299+
case Builtin::BIcm_nbarrier_wait:
22982300
case Builtin::BIcm_yield :
22992301
case Builtin::BIcm_print_buffer :
23002302
case Builtin::BIcm_print_format_index:

lib/CodeGen/CGCM.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -1423,7 +1423,9 @@ void CGCMRuntime::EmitCMKernelMetadata(const FunctionDecl *FD,
14231423
getMD(llvm::ConstantInt::getNullValue(I32Ty)),
14241424
getMD(llvm::ConstantInt::getNullValue(I32Ty)), // placeholder for arg offsets
14251425
IOKinds,
1426-
ArgDescs
1426+
ArgDescs,
1427+
getMD(llvm::ConstantInt::getNullValue(I32Ty)),
1428+
getMD(llvm::ConstantInt::getNullValue(I32Ty))
14271429
};
14281430

14291431
// Add this kernel to the root.

lib/CodeGen/CGCM.h

+21
Original file line numberDiff line numberDiff line change
@@ -634,12 +634,31 @@ class CGCMRuntime {
634634

635635
/// \brief Postprocess cm_bfn implementation builtin
636636
llvm::Value *HandleBuiltinBFNImpl(CMCallInfo &CallInfo, CMBuiltinKind Kind);
637+
638+
/// \brief Postprocess cm_srnd implementation builtin
639+
llvm::Value *HandleBuiltinSRNDImpl(CMCallInfo &CallInfo, CMBuiltinKind Kind);
637640
/// \brief Postprocess dpas implementation builtin.
638641
llvm::Value *HandleBuiltinDPASImpl(CMCallInfo &CallInfo, CMBuiltinKind Kind);
639642
/// \brief Postprocess dpas2 implementation builtin.
640643
llvm::Value *HandleBuiltinDPAS2Impl(CMCallInfo &CallInfo, CMBuiltinKind Kind);
641644
/// \brief Postprocess builtin cm_bf_cvt.
642645
llvm::Value *HandleBuiltinBFCVTImpl(CMCallInfo &CallInfo, CMBuiltinKind Kind);
646+
/// \brief Postprocess builtin cm_qf_cvt.
647+
llvm::Value *HandleBuiltinQFCVTImpl(CMCallInfo &CallInfo, CMBuiltinKind Kind);
648+
/// \brief Postprocess builtin cm_tf32_cvt.
649+
llvm::Value *HandleBuiltinTF32CVTImpl(CMCallInfo &CallInfo, CMBuiltinKind Kind);
650+
/// \brief Postprocess block 2d builtins load/store/prefetch.
651+
llvm::Value *HandleBuiltinLSC2dImpl(CMCallInfo &CallInfo, CMBuiltinKind Kind);
652+
653+
/// \brief Postprocess wave 2.5 load/store
654+
llvm::Value *HandleBuiltinLSCWaveImpl(CMCallInfo &CallInfo, CMBuiltinKind Kind);
655+
656+
/// \brief Postprocess BTI-based load/store/prefetch
657+
llvm::Value *HandleBuiltinLSCImpl(CMCallInfo &CallInfo, CMBuiltinKind Kind);
658+
659+
/// \brief Postprocess cm_lsc_fence implementation builtins.
660+
llvm::Value *HandleBuiltinLscFenceImpl(CMCallInfo &CallInfo,
661+
CMBuiltinKind Kind);
643662

644663
/// \brief Emit 1D/2D select expression.
645664
LValue EmitSelect(CodeGenFunction &CGF, const CMSelectExpr *E, LValue Base);
@@ -712,6 +731,8 @@ class CGCMRuntime {
712731
/// Emit cm_slm_free builtin call.
713732
llvm::Value *EmitBuiltinSLMFree(CodeGenFunction &CGF, const CallExpr *E);
714733

734+
/// Emit cm_nbarrier_init builtin call.
735+
void EmitBuiltinNBarrierInit(CodeGenFunction &CGF, const CallExpr *E);
715736

716737
/// \brief Emit one of scatter_scaled, scatter4_scaled.
717738
llvm::CallInst *EmitScatterScaled(CodeGenFunction &CGF, unsigned IntrinsicID,

0 commit comments

Comments
 (0)