Skip to content

Commit b7fa3f6

Browse files
committed
Merge remote-tracking branch 'intel_llvm/sycl' into jit_cache_2
2 parents 4db44a5 + 12e8549 commit b7fa3f6

File tree

337 files changed

+4878
-1181
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

337 files changed

+4878
-1181
lines changed

.github/CODEOWNERS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,8 @@ SYCLLowerIR/ @kbobrovs @DenisBakhvalov
114114
esimd/ @kbobrovs @DenisBakhvalov
115115
sycl/include/CL/sycl/INTEL/esimd.hpp @kbobrovs @DenisBakhvalov
116116
sycl/doc/extensions/ExplicitSIMD/ @kbobrovs
117+
118+
# ITT annotations
119+
llvm/lib/Transforms/Instrumentation/SPIRITTAnnotations.cpp @MrSidims
120+
llvm/include/llvm/Transforms/Instrumentation/SPIRITTAnnotations.h @MrSidims
121+

buildbot/dependency.conf

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[VERSIONS]
2-
# https://github.com/intel/llvm/releases/download/2021-WW10/oclcpuexp-2021.11.3.0.02_rel.tar.gz
3-
ocl_cpu_rt_ver=2021.11.3.0.02
4-
# https://github.com/intel/llvm/releases/download/2021-WW10/win-oclcpuexp-2021.11.3.0.02_rel.zip
5-
ocl_cpu_rt_ver_win=2021.11.3.0.02
2+
# https://github.com/intel/llvm/releases/download/2021-WW11/oclcpuexp-2021.11.3.0.09_rel.tar.gz
3+
ocl_cpu_rt_ver=2021.11.3.0.09
4+
# https://github.com/intel/llvm/releases/download/2021-WW11/win-oclcpuexp-2021.11.3.0.09_rel.zip
5+
ocl_cpu_rt_ver_win=2021.11.3.0.09
66
# Same GPU driver supports Level Zero and OpenCL
7-
# https://github.com/intel/compute-runtime/releases/tag/21.08.19096
8-
ocl_gpu_rt_ver=21.08.19096
7+
# https://github.com/intel/compute-runtime/releases/tag/21.09.19150
8+
ocl_gpu_rt_ver=21.09.19150
99
# Same GPU driver supports Level Zero and OpenCL
1010
# https://downloadmirror.intel.com/30266/a08/igfx_win10_100.9316.zip
1111
ocl_gpu_rt_ver_win=27.20.100.9316
@@ -19,21 +19,21 @@ tbb_ver=2021.2.0.236
1919
# https://github.com/oneapi-src/oneTBB/releases/download/v2021.1.1/oneapi-tbb-2021.1.1-win.zip
2020
tbb_ver_win=2021.2.0.221
2121

22-
# https://github.com/intel/llvm/releases/download/2021-WW10/fpgaemu-2021.11.3.0.02_rel.tar.gz
23-
ocl_fpga_emu_ver=2021.11.3.0.02
24-
# https://github.com/intel/llvm/releases/download/2021-WW10/win-fpgaemu-2021.11.3.0.02_rel.zip
25-
ocl_fpga_emu_ver_win=2021.11.3.0.02
26-
fpga_ver=20210205_000005
22+
# https://github.com/intel/llvm/releases/download/2021-WW11/fpgaemu-2021.11.3.0.09_rel.tar.gz
23+
ocl_fpga_emu_ver=2021.11.3.0.09
24+
# https://github.com/intel/llvm/releases/download/2021-WW11/win-fpgaemu-2021.11.3.0.09_rel.zip
25+
ocl_fpga_emu_ver_win=2021.11.3.0.09
26+
fpga_ver=20210205_000003
2727
fpga_ver_win=20210204_000003_signed_bom_fixed
2828
ocloc_ver_win=27.20.100.9168
2929

3030
[DRIVER VERSIONS]
31-
cpu_driver_lin=2021.11.3.0.02
32-
cpu_driver_win=2021.11.3.0.02
33-
gpu_driver_lin=21.08.19096
31+
cpu_driver_lin=2021.11.3.0.09
32+
cpu_driver_win=2021.11.3.0.09
33+
gpu_driver_lin=21.09.19150
3434
gpu_driver_win=27.20.100.9316
35-
fpga_driver_lin=2021.11.3.0.02
36-
fpga_driver_win=2021.11.3.0.02
35+
fpga_driver_lin=2021.11.3.0.09
36+
fpga_driver_win=2021.11.3.0.09
3737
# NVidia CUDA driver
3838
# TODO provide URL for CUDA driver
3939
nvidia_gpu_driver_lin=435.21

clang/include/clang/Basic/Attr.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2038,7 +2038,7 @@ def IntelFPGAMerge : Attr {
20382038
let Documentation = [IntelFPGAMergeAttrDocs];
20392039
}
20402040

2041-
def IntelFPGAMaxReplicates : Attr {
2041+
def IntelFPGAMaxReplicates : InheritableAttr {
20422042
let Spellings = [CXX11<"intelfpga","max_replicates">,
20432043
CXX11<"intel","max_replicates">];
20442044
let Args = [ExprArgument<"Value">];

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,9 @@ CODEGENOPT(PassByValueIsNoAlias, 1, 0)
417417
/// according to the field declaring type width.
418418
CODEGENOPT(AAPCSBitfieldWidth, 1, 1)
419419

420+
// Whether to instrument SPIR device code with ITT annotations
421+
CODEGENOPT(SPIRITTAnnotations, 1, 0)
422+
420423
#undef CODEGENOPT
421424
#undef ENUM_CODEGENOPT
422425
#undef VALUE_CODEGENOPT

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3195,6 +3195,9 @@ def warn_dllimport_dropped_from_inline_function : Warning<
31953195
InGroup<IgnoredAttributes>;
31963196
def warn_attribute_ignored : Warning<"%0 attribute ignored">,
31973197
InGroup<IgnoredAttributes>;
3198+
def warn_attribute_on_direct_kernel_callee_only : Warning<"%0 attribute allowed"
3199+
" only on a function directly called from a SYCL kernel function; attribute ignored">,
3200+
InGroup<IgnoredAttributes>;
31983201
def warn_nothrow_attribute_ignored : Warning<"'nothrow' attribute conflicts with"
31993202
" exception specification; attribute ignored">,
32003203
InGroup<IgnoredAttributes>;

clang/include/clang/Basic/LangOptions.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ LANGOPT(GPUMaxThreadsPerBlock, 32, 1024, "default max threads per block for kern
246246
LANGOPT(GPUDeferDiag, 1, 0, "defer host/device related diagnostic messages for CUDA/HIP")
247247
LANGOPT(GPUExcludeWrongSideOverloads, 1, 0, "always exclude wrong side overloads in overloading resolution for CUDA/HIP")
248248

249-
LANGOPT(SYCL , 1, 0, "SYCL")
250249
LANGOPT(SYCLIsDevice , 1, 0, "Generate code for SYCL device")
251250
LANGOPT(SYCLIsHost , 1, 0, "SYCL host compilation")
252251
LANGOPT(SYCLAllowFuncPtr , 1, 0, "Allow function pointers in SYCL device code")

clang/include/clang/Driver/Options.td

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2418,6 +2418,10 @@ def fsycl_device_code_lower_esimd : Flag<["-"], "fsycl-device-code-lower-esimd">
24182418
Flags<[CC1Option, CoreOption]>, HelpText<"Lower ESIMD-specific constructs">;
24192419
def fno_sycl_device_code_lower_esimd : Flag<["-"], "fno-sycl-device-code-lower-esimd">,
24202420
Flags<[CC1Option, CoreOption]>, HelpText<"Do not lower ESIMD-specific constructs">;
2421+
def fsycl_instrument_device_code : Flag<["-"], "fsycl-instrument-device-code">,
2422+
Group<sycl_Group>, Flags<[CC1Option, CoreOption]>,
2423+
HelpText<"Add ITT instrumentation intrinsics calls">,
2424+
MarshallingInfoFlag<CodeGenOpts<"SPIRITTAnnotations">>;
24212425
defm sycl_id_queries_fit_in_int: OptInFFlag<"sycl-id-queries-fit-in-int", "Assume", "Do not assume", " that SYCL ID queries fit within MAX_INT.", [CC1Option,CoreOption], LangOpts<"SYCLValueFitInMaxInt">>;
24222426
def fsycl_use_bitcode : Flag<["-"], "fsycl-use-bitcode">,
24232427
Flags<[CC1Option, CoreOption]>, HelpText<"Use LLVM bitcode instead of SPIR-V in fat objects">;
@@ -4287,19 +4291,14 @@ defm whole_file : BooleanFFlag<"whole-file">, Group<gfortran_Group>;
42874291
def reuse_exe_EQ : Joined<["-"], "reuse-exe=">, Flags<[CoreOption]>,
42884292
HelpText<"Speed up FPGA aoc compile if the device code in <exe> is unchanged.">,
42894293
MetaVarName<"<exe>">;
4290-
defm sycl : BoolOption<"f", "sycl",
4291-
LangOpts<"SYCL">, DefaultFalse,
4292-
PosFlag<SetTrue, [CC1Option], "Enable">, NegFlag<SetFalse, [], "Disable">,
4293-
BothFlags<[CoreOption], " SYCL kernels compilation for device">>,
4294-
Group<sycl_Group>;
4295-
def sycl_std_EQ : Joined<["-"], "sycl-std=">, Group<sycl_Group>, Flags<[CC1Option, NoArgumentUnused, CoreOption]>,
4296-
HelpText<"SYCL language standard to compile for.">, Values<"2020,2017,121,1.2.1,sycl-1.2.1">,
4297-
NormalizedValues<["SYCL_2020", "SYCL_2017", "SYCL_2017", "SYCL_2017", "SYCL_2017"]>, NormalizedValuesScope<"LangOptions">,
4298-
MarshallingInfoString<LangOpts<"SYCLVersion">, "SYCL_None">, ShouldParseIf<fsycl.KeyPath>, AutoNormalizeEnum;
4294+
def fsycl : Flag<["-"], "fsycl">, Flags<[NoXarchOption, CoreOption]>, Group<sycl_Group>,
4295+
HelpText<"Enables SYCL kernels compilation for device">;
4296+
def fno_sycl : Flag<["-"], "fno-sycl">, Flags<[NoXarchOption, CoreOption]>, Group<sycl_Group>,
4297+
HelpText<"Disables SYCL kernels compilation for device">;
42994298
defm sycl_esimd: BoolFOption<"sycl-explicit-simd",
43004299
LangOpts<"SYCLExplicitSIMD">, DefaultFalse,
43014300
PosFlag<SetTrue, [CC1Option], "Enable">, NegFlag<SetFalse, [], "Disable">,
4302-
BothFlags<[NoArgumentUnused, CoreOption], " SYCL explicit SIMD extension.">>;
4301+
BothFlags<[NoArgumentUnused, CoreOption], "SYCL explicit SIMD extension.">>;
43034302
defm sycl_early_optimizations : OptOutFFlag<"sycl-early-optimizations", "Enable", "Disable", " standard optimization pipeline for SYCL device compiler", [CoreOption]>;
43044303
def fsycl_dead_args_optimization : Flag<["-"], "fsycl-dead-args-optimization">,
43054304
Group<sycl_Group>, Flags<[NoArgumentUnused, CoreOption]>, HelpText<"Enables "
@@ -5513,8 +5512,7 @@ def fopenmp_host_ir_file_path : Separate<["-"], "fopenmp-host-ir-file-path">,
55135512

55145513
def fsycl_is_device : Flag<["-"], "fsycl-is-device">,
55155514
HelpText<"Generate code for SYCL device.">,
5516-
MarshallingInfoFlag<LangOpts<"SYCLIsDevice">>,
5517-
ShouldParseIf<fsycl.KeyPath>;
5515+
MarshallingInfoFlag<LangOpts<"SYCLIsDevice">>;
55185516
def fsycl_is_host : Flag<["-"], "fsycl-is-host">,
55195517
HelpText<"SYCL host compilation">,
55205518
MarshallingInfoFlag<LangOpts<"SYCLIsHost">>;
@@ -5533,6 +5531,16 @@ def fenable_sycl_dae : Flag<["-"], "fenable-sycl-dae">,
55335531

55345532
} // let Flags = [CC1Option, NoDriverOption]
55355533

5534+
def sycl_std_EQ : Joined<["-"], "sycl-std=">, Group<sycl_Group>,
5535+
Flags<[CC1Option, NoArgumentUnused, CoreOption]>,
5536+
HelpText<"SYCL language standard to compile for.">,
5537+
Values<"2020,2017,121,1.2.1,sycl-1.2.1">,
5538+
NormalizedValues<["SYCL_2020", "SYCL_2017", "SYCL_2017", "SYCL_2017", "SYCL_2017"]>,
5539+
NormalizedValuesScope<"LangOptions">,
5540+
MarshallingInfoString<LangOpts<"SYCLVersion">, "SYCL_None">,
5541+
AutoNormalizeEnum,
5542+
ShouldParseIf<!strconcat(fsycl_is_device.KeyPath, "||", fsycl_is_host.KeyPath)>;
5543+
55365544
defm cuda_approx_transcendentals : BoolFOption<"cuda-approx-transcendentals",
55375545
LangOpts<"CUDADeviceApproxTranscendentals">, DefaultFalse,
55385546
PosFlag<SetTrue, [CC1Option], "Use">, NegFlag<SetFalse, [], "Don't use">,

clang/include/clang/Sema/Sema.h

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10234,6 +10234,12 @@ class Sema final {
1023410234
Expr *E);
1023510235
SYCLIntelLoopFuseAttr *
1023610236
MergeSYCLIntelLoopFuseAttr(Decl *D, const SYCLIntelLoopFuseAttr &A);
10237+
void AddIntelFPGAPrivateCopiesAttr(Decl *D, const AttributeCommonInfo &CI,
10238+
Expr *E);
10239+
void AddIntelFPGAMaxReplicatesAttr(Decl *D, const AttributeCommonInfo &CI,
10240+
Expr *E);
10241+
IntelFPGAMaxReplicatesAttr *
10242+
MergeIntelFPGAMaxReplicatesAttr(Decl *D, const IntelFPGAMaxReplicatesAttr &A);
1023710243

1023810244
/// AddAlignedAttr - Adds an aligned attribute to a particular declaration.
1023910245
void AddAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E,
@@ -13017,6 +13023,7 @@ class Sema final {
1301713023

1301813024
bool isKnownGoodSYCLDecl(const Decl *D);
1301913025
void checkSYCLDeviceVarDecl(VarDecl *Var);
13026+
void copySYCLKernelAttrs(const CXXRecordDecl *KernelObj);
1302013027
void ConstructOpenCLKernel(FunctionDecl *KernelCallerFunc, MangleContext &MC);
1302113028
void MarkDevice();
1302213029

@@ -13093,13 +13100,6 @@ void Sema::addIntelSingleArgAttr(Decl *D, const AttributeCommonInfo &CI,
1309313100
return;
1309413101
E = ICE.get();
1309513102
int32_t ArgInt = ArgVal.getSExtValue();
13096-
if (CI.getParsedKind() == ParsedAttr::AT_IntelFPGAMaxReplicates) {
13097-
if (ArgInt <= 0) {
13098-
Diag(E->getExprLoc(), diag::err_attribute_requires_positive_integer)
13099-
<< CI << /*positive*/ 0;
13100-
return;
13101-
}
13102-
}
1310313103
if (CI.getParsedKind() == ParsedAttr::AT_SYCLIntelMaxGlobalWorkDim) {
1310413104
if (ArgInt < 0) {
1310513105
Diag(E->getExprLoc(), diag::err_attribute_requires_positive_integer)
@@ -13114,19 +13114,6 @@ void Sema::addIntelSingleArgAttr(Decl *D, const AttributeCommonInfo &CI,
1311413114
return;
1311513115
}
1311613116
}
13117-
if (CI.getParsedKind() == ParsedAttr::AT_IntelFPGAPrivateCopies) {
13118-
if (ArgInt < 0) {
13119-
Diag(E->getExprLoc(), diag::err_attribute_requires_positive_integer)
13120-
<< CI << /*non-negative*/ 1;
13121-
return;
13122-
}
13123-
}
13124-
}
13125-
13126-
if (CI.getParsedKind() == ParsedAttr::AT_IntelFPGAPrivateCopies) {
13127-
if (!D->hasAttr<IntelFPGAMemoryAttr>())
13128-
D->addAttr(IntelFPGAMemoryAttr::CreateImplicit(
13129-
Context, IntelFPGAMemoryAttr::Default));
1313013117
}
1313113118

1313213119
D->addAttr(::new (Context) AttrType(Context, CI, E));

clang/lib/AST/ASTContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2098,7 +2098,7 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) const {
20982098
Align = Target->getDoubleAlign();
20992099
break;
21002100
case BuiltinType::LongDouble:
2101-
if (((getLangOpts().SYCL && getLangOpts().SYCLIsDevice) ||
2101+
if ((getLangOpts().SYCLIsDevice ||
21022102
(getLangOpts().OpenMP && getLangOpts().OpenMPIsDevice)) &&
21032103
AuxTarget != nullptr &&
21042104
(Target->getLongDoubleWidth() != AuxTarget->getLongDoubleWidth() ||

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
#include "llvm/Transforms/Instrumentation/InstrProfiling.h"
7373
#include "llvm/Transforms/Instrumentation/MemProfiler.h"
7474
#include "llvm/Transforms/Instrumentation/MemorySanitizer.h"
75+
#include "llvm/Transforms/Instrumentation/SPIRITTAnnotations.h"
7576
#include "llvm/Transforms/Instrumentation/SanitizerCoverage.h"
7677
#include "llvm/Transforms/Instrumentation/ThreadSanitizer.h"
7778
#include "llvm/Transforms/ObjCARC.h"
@@ -948,6 +949,16 @@ void EmitAssemblyHelper::EmitAssembly(BackendAction Action,
948949
LangOpts.EnableDAEInSpirKernels)
949950
PerModulePasses.add(createDeadArgEliminationSYCLPass());
950951

952+
// Add SPIRITTAnnotations pass to the pass manager if
953+
// -fsycl-instrument-device-code option was passed. This option can be
954+
// used only with spir triple.
955+
if (CodeGenOpts.SPIRITTAnnotations) {
956+
if (!llvm::Triple(TheModule->getTargetTriple()).isSPIR())
957+
llvm::report_fatal_error(
958+
"ITT annotations can only by added to a module with spir target");
959+
PerModulePasses.add(createSPIRITTAnnotationsPass());
960+
}
961+
951962
switch (Action) {
952963
case Backend_EmitNothing:
953964
break;

clang/lib/CodeGen/TargetInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9999,7 +9999,7 @@ LangAS SPIRTargetCodeGenInfo::getGlobalVarAddressSpace(CodeGenModule &CGM,
99999999
LangAS AddrSpace = D->getType().getAddressSpace();
1000010000
assert(AddrSpace == LangAS::Default || isTargetAddressSpace(AddrSpace) ||
1000110001
// allow applying clang AST address spaces in SYCL mode
10002-
(CGM.getLangOpts().SYCL && CGM.getLangOpts().SYCLIsDevice));
10002+
CGM.getLangOpts().SYCLIsDevice);
1000310003
if (AddrSpace != LangAS::Default)
1000410004
return AddrSpace;
1000510005

0 commit comments

Comments
 (0)