Skip to content

Commit 1639e6e

Browse files
committed
resolve merge conflict
2 parents f6a926c + f6420c7 commit 1639e6e

File tree

75 files changed

+2122
-1565
lines changed

Some content is hidden

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

75 files changed

+2122
-1565
lines changed

buildbot/configure.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ def do_configure(args):
7575
sycl_build_pi_hip_platform = args.hip_platform
7676
sycl_enabled_plugins.append("hip")
7777

78+
# all llvm compiler targets don't require 3rd party dependencies, so can be
79+
# built/tested even if specific runtimes are not available
80+
if args.enable_all_llvm_targets:
81+
llvm_targets_to_build += ';NVPTX;AMDGPU'
82+
7883
if args.werror or args.ci_defaults:
7984
sycl_werror = 'ON'
8085
xpti_enable_werror = 'ON'
@@ -210,6 +215,7 @@ def main():
210215
parser.add_argument("--hip-platform", type=str, choices=['AMD', 'NVIDIA'], default='AMD', help="choose hardware platform for HIP backend")
211216
parser.add_argument("--arm", action='store_true', help="build ARM support rather than x86")
212217
parser.add_argument("--enable-esimd-emulator", action='store_true', help="build with ESIMD emulation support")
218+
parser.add_argument("--enable-all-llvm-targets", action='store_true', help="build compiler with all supported targets, it doesn't change runtime build")
213219
parser.add_argument("--no-assertions", action='store_true', help="build without assertions")
214220
parser.add_argument("--docs", action='store_true', help="build Doxygen documentation")
215221
parser.add_argument("--werror", action='store_true', help="Treat warnings as errors")

buildbot/dependency.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ ocl_cpu_rt_ver=2022.13.3.0.16
44
# https://github.com/intel/llvm/releases/download/2022-WW13/win-oclcpuexp-2022.13.3.0.16_rel.zip
55
ocl_cpu_rt_ver_win=2022.13.3.0.16
66
# Same GPU driver supports Level Zero and OpenCL
7-
# https://github.com/intel/compute-runtime/releases/tag/22.19.23136
8-
ocl_gpu_rt_ver=22.19.23136
7+
# https://github.com/intel/compute-runtime/releases/tag/22.20.23198
8+
ocl_gpu_rt_ver=22.20.23198
99
# Same GPU driver supports Level Zero and OpenCL
1010
# https://downloadmirror.intel.com/723911/igfx_win_101.1404.zip
1111
ocl_gpu_rt_ver_win=101.1404
@@ -31,7 +31,7 @@ ocloc_ver_win=101.1404
3131
[DRIVER VERSIONS]
3232
cpu_driver_lin=2022.13.3.0.16
3333
cpu_driver_win=2022.13.3.0.16
34-
gpu_driver_lin=22.19.23136
34+
gpu_driver_lin=22.20.23198
3535
gpu_driver_win=101.1404
3636
fpga_driver_lin=2022.13.3.0.16
3737
fpga_driver_win=2022.13.3.0.16

clang/include/clang/Basic/LangOptions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,10 @@ class LangOptions : public LangOptionsBase {
470470
/// The seed used by the randomize structure layout feature.
471471
std::string RandstructSeed;
472472

473+
/// The name of the file to which the backend should save YAML optimization
474+
/// records.
475+
std::string OptRecordFile;
476+
473477
LangOptions();
474478

475479
/// Set language defaults for the given input language and

clang/include/clang/Driver/Options.td

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2774,10 +2774,10 @@ def fsycl_device_code_split_esimd : Flag<["-"], "fsycl-device-code-split-esimd">
27742774
Flags<[CoreOption]>, HelpText<"split ESIMD device code from SYCL into a separate device binary image (default). Has effect only for SPIR-based targets.">;
27752775
def fno_sycl_device_code_split_esimd : Flag<["-"], "fno-sycl-device-code-split-esimd">,
27762776
Flags<[CoreOption]>, HelpText<"do not split ESIMD and SYCL device code into separate device binary images. Has effect only for SPIR-based targets.">;
2777-
def fsycl_instrument_device_code : Flag<["-"], "fsycl-instrument-device-code">,
2778-
Group<sycl_Group>, Flags<[CC1Option, CoreOption]>,
2779-
HelpText<"Add ITT instrumentation intrinsics calls">,
2780-
MarshallingInfoFlag<CodeGenOpts<"SPIRITTAnnotations">>;
2777+
defm sycl_instrument_device_code : BoolFOption<"sycl-instrument-device-code",
2778+
CodeGenOpts<"SPIRITTAnnotations">, DefaultFalse,
2779+
PosFlag<SetTrue, [], "Add">, NegFlag<SetFalse, [], "Do not add">,
2780+
BothFlags<[CC1Option, CoreOption], " ITT instrumentation intrinsics calls">>;
27812781
defm sycl_id_queries_fit_in_int: BoolFOption<"sycl-id-queries-fit-in-int",
27822782
LangOpts<"SYCLValueFitInMaxInt">, DefaultTrue,
27832783
PosFlag<SetTrue, [], "Assume">, NegFlag<SetFalse, [], "Do not assume">,
@@ -4858,6 +4858,12 @@ def fno_sycl_device_lib_EQ : CommaJoined<["-"], "fno-sycl-device-lib=">, Group<s
48584858
Values<"libc, libm-fp32, libm-fp64, all">, HelpText<"Control exclusion of "
48594859
"device libraries from device binary linkage. Valid arguments "
48604860
"are libc, libm-fp32, libm-fp64, all">;
4861+
def fsycl_device_lib_online_link : Flag<["-"], "fsycl-device-lib-online-link">,
4862+
Group<sycl_Group>, Flags<[NoArgumentUnused, CoreOption]>, HelpText<"Enables "
4863+
"sycl device library online link (experimental)">;
4864+
def fno_sycl_device_lib_online_link : Flag<["-"], "fno-sycl-device-lib-online-link">,
4865+
Group<sycl_Group>, Flags<[NoArgumentUnused, CoreOption]>, HelpText<"Disables "
4866+
"sycl device library online link (experimental)">;
48614867
def fsycl_fp32_prec_sqrt : Flag<["-"], "fsycl-fp32-prec-sqrt">, Group<sycl_Group>, Flags<[CC1Option]>,
48624868
HelpText<"SYCL only. Specify that single precision floating-point sqrt is correctly rounded.">,
48634869
MarshallingInfoFlag<CodeGenOpts<"SYCLFp32PrecSqrt">>;
@@ -5901,7 +5907,7 @@ def arcmt_action_EQ : Joined<["-"], "arcmt-action=">, Flags<[CC1Option, NoDriver
59015907

59025908
def opt_record_file : Separate<["-"], "opt-record-file">,
59035909
HelpText<"File name to use for YAML optimization record output">,
5904-
MarshallingInfoString<CodeGenOpts<"OptRecordFile">>;
5910+
MarshallingInfoString<LangOpts<"OptRecordFile">>;
59055911
def opt_record_passes : Separate<["-"], "opt-record-passes">,
59065912
HelpText<"Only record remark information for passes whose names match the given regular expression">;
59075913
def opt_record_format : Separate<["-"], "opt-record-format">,

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
934934
// Add SPIRITTAnnotations pass to the pass manager if
935935
// -fsycl-instrument-device-code option was passed. This option can be used
936936
// only with spir triple.
937-
if (CodeGenOpts.SPIRITTAnnotations) {
937+
if (LangOpts.SYCLIsDevice && CodeGenOpts.SPIRITTAnnotations) {
938938
assert(llvm::Triple(TheModule->getTargetTriple()).isSPIR() &&
939939
"ITT annotations can only be added to a module with spir target");
940940
MPM.addPass(SPIRITTAnnotationsPass());

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,26 +1602,27 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
16021602

16031603
// Emit the standard function prologue.
16041604
StartFunction(GD, ResTy, Fn, FnInfo, Args, Loc, BodyRange.getBegin());
1605-
1606-
SyclOptReportHandler &SyclOptReport = CGM.getDiags().getSYCLOptReport();
1607-
if (Fn && SyclOptReport.HasOptReportInfo(FD)) {
1608-
llvm::OptimizationRemarkEmitter ORE(Fn);
1609-
for (auto ORI : llvm::enumerate(SyclOptReport.GetInfo(FD))) {
1610-
llvm::DiagnosticLocation DL =
1611-
SourceLocToDebugLoc(ORI.value().KernelArgLoc);
1612-
StringRef NameInDesc = ORI.value().KernelArgDescName;
1613-
StringRef ArgType = ORI.value().KernelArgType;
1614-
StringRef ArgDesc = ORI.value().KernelArgDesc;
1615-
unsigned ArgSize = ORI.value().KernelArgSize;
1616-
StringRef ArgDecomposedField = ORI.value().KernelArgDecomposedField;
1617-
1618-
llvm::OptimizationRemark Remark("sycl", "Region", DL,
1619-
&Fn->getEntryBlock());
1620-
Remark << "Arg " << llvm::ore::NV("Argument", ORI.index()) << ":"
1621-
<< ArgDesc << NameInDesc << " (" << ArgDecomposedField
1622-
<< "Type:" << ArgType << ", "
1623-
<< "Size: " << llvm::ore::NV("Argument", ArgSize) << ")";
1624-
ORE.emit(Remark);
1605+
if (!getLangOpts().OptRecordFile.empty()) {
1606+
SyclOptReportHandler &SyclOptReport = CGM.getDiags().getSYCLOptReport();
1607+
if (Fn && SyclOptReport.HasOptReportInfo(FD)) {
1608+
llvm::OptimizationRemarkEmitter ORE(Fn);
1609+
for (auto ORI : llvm::enumerate(SyclOptReport.GetInfo(FD))) {
1610+
llvm::DiagnosticLocation DL =
1611+
SourceLocToDebugLoc(ORI.value().KernelArgLoc);
1612+
StringRef NameInDesc = ORI.value().KernelArgDescName;
1613+
StringRef ArgType = ORI.value().KernelArgType;
1614+
StringRef ArgDesc = ORI.value().KernelArgDesc;
1615+
unsigned ArgSize = ORI.value().KernelArgSize;
1616+
StringRef ArgDecomposedField = ORI.value().KernelArgDecomposedField;
1617+
1618+
llvm::OptimizationRemark Remark("sycl", "Region", DL,
1619+
&Fn->getEntryBlock());
1620+
Remark << "Arg " << llvm::ore::NV("Argument", ORI.index()) << ":"
1621+
<< ArgDesc << NameInDesc << " (" << ArgDecomposedField
1622+
<< "Type:" << ArgType << ", "
1623+
<< "Size: " << llvm::ore::NV("Argument", ArgSize) << ")";
1624+
ORE.emit(Remark);
1625+
}
16251626
}
16261627
}
16271628

clang/lib/Driver/Driver.cpp

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4754,12 +4754,17 @@ class OffloadingActionBuilder final {
47544754
SYCLTC->SYCLInstallation.getSYCLDeviceLibPath(LibLocCandidates);
47554755
StringRef LibSuffix = isMSVCEnv ? ".obj" : ".o";
47564756
using SYCLDeviceLibsList = SmallVector<DeviceLibOptInfo, 5>;
4757+
47574758
const SYCLDeviceLibsList sycl_device_wrapper_libs = {
4758-
{"libsycl-crt", "libc"},
4759-
{"libsycl-complex", "libm-fp32"},
4760-
{"libsycl-complex-fp64", "libm-fp64"},
4761-
{"libsycl-cmath", "libm-fp32"},
4762-
{"libsycl-cmath-fp64", "libm-fp64"}};
4759+
{"libsycl-crt", "libc"},
4760+
{"libsycl-complex", "libm-fp32"},
4761+
{"libsycl-complex-fp64", "libm-fp64"},
4762+
{"libsycl-cmath", "libm-fp32"},
4763+
{"libsycl-cmath-fp64", "libm-fp64"},
4764+
#if defined(_WIN32)
4765+
{"libsycl-msvc-math", "libm-fp32"},
4766+
#endif
4767+
};
47634768
// For AOT compilation, we need to link sycl_device_fallback_libs as
47644769
// default too.
47654770
const SYCLDeviceLibsList sycl_device_fallback_libs = {
@@ -4806,7 +4811,8 @@ class OffloadingActionBuilder final {
48064811
addInputs(sycl_device_wrapper_libs);
48074812
if (isSpirvAOT)
48084813
addInputs(sycl_device_fallback_libs);
4809-
if (Args.hasArg(options::OPT_fsycl_instrument_device_code))
4814+
if (Args.hasFlag(options::OPT_fsycl_instrument_device_code,
4815+
options::OPT_fno_sycl_instrument_device_code, true))
48104816
addInputs(sycl_device_annotation_libs);
48114817
return NumOfDeviceLibLinked != 0;
48124818
}
@@ -4958,8 +4964,12 @@ class OffloadingActionBuilder final {
49584964
// device libraries are only needed when current toolchain is using
49594965
// AOT compilation.
49604966
if (isSPIR) {
4967+
bool UseOnlineLink =
4968+
Args.hasFlag(options::OPT_fsycl_device_lib_online_link,
4969+
options::OPT_fno_sycl_device_lib_online_link, false);
4970+
bool UseOfflineLink = isSpirvAOT || !UseOnlineLink;
49614971
SYCLDeviceLibLinked = addSYCLDeviceLibs(
4962-
TC, FullLinkObjects, isSpirvAOT,
4972+
TC, FullLinkObjects, UseOfflineLink,
49634973
C.getDefaultToolChain().getTriple().isWindowsMSVCEnvironment());
49644974
}
49654975

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4898,12 +4898,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
48984898

48994899
// Forward -fsycl-instrument-device-code option to cc1. This option will
49004900
// only be used for SPIR-V-based targets.
4901-
if (Arg *A =
4902-
Args.getLastArgNoClaim(options::OPT_fsycl_instrument_device_code))
4903-
if (Triple.isSPIR()) {
4904-
A->claim();
4901+
if (Triple.isSPIR())
4902+
if (Args.hasFlag(options::OPT_fsycl_instrument_device_code,
4903+
options::OPT_fno_sycl_instrument_device_code, true))
49054904
CmdArgs.push_back("-fsycl-instrument-device-code");
4906-
}
49074905

49084906
if (!SYCLStdArg) {
49094907
// The user had not pass SYCL version, thus we'll employ no-sycl-strict

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -130,21 +130,16 @@ void SYCL::constructLLVMForeachCommand(Compilation &C, const JobAction &JA,
130130
// The list should match pre-built SYCL device library files located in
131131
// compiler package. Once we add or remove any SYCL device library files,
132132
// the list should be updated accordingly.
133-
static llvm::SmallVector<StringRef, 16> SYCLDeviceLibList{
134-
"crt",
135-
"cmath",
136-
"cmath-fp64",
137-
"complex",
138-
"complex-fp64",
139-
"itt-compiler-wrappers",
140-
"itt-stubs",
141-
"itt-user-wrappers",
142-
"fallback-cassert",
143-
"fallback-cstring",
144-
"fallback-cmath",
145-
"fallback-cmath-fp64",
146-
"fallback-complex",
147-
"fallback-complex-fp64"};
133+
134+
static llvm::SmallVector<StringRef, 16> SYCLDeviceLibList {
135+
"crt", "cmath", "cmath-fp64", "complex", "complex-fp64",
136+
#if defined(_WIN32)
137+
"msvc-math",
138+
#endif
139+
"itt-compiler-wrappers", "itt-stubs", "itt-user-wrappers",
140+
"fallback-cassert", "fallback-cstring", "fallback-cmath",
141+
"fallback-cmath-fp64", "fallback-complex", "fallback-complex-fp64"
142+
};
148143

149144
const char *SYCL::Linker::constructLLVMLinkCommand(
150145
Compilation &C, const JobAction &JA, const InputInfo &Output,

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1946,6 +1946,8 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
19461946

19471947
bool NeedLocTracking = false;
19481948

1949+
Opts.OptRecordFile = LangOpts->OptRecordFile;
1950+
19491951
if (!Opts.OptRecordFile.empty())
19501952
NeedLocTracking = true;
19511953

@@ -3318,6 +3320,8 @@ void CompilerInvocation::GenerateLangArgs(const LangOptions &Opts,
33183320
GenerateArg(Args, OPT_pic_is_pie, SA);
33193321
for (StringRef Sanitizer : serializeSanitizerKinds(Opts.Sanitize))
33203322
GenerateArg(Args, OPT_fsanitize_EQ, Sanitizer, SA);
3323+
if (!Opts.OptRecordFile.empty())
3324+
GenerateArg(Args, OPT_opt_record_file, Opts.OptRecordFile, SA);
33213325

33223326
return;
33233327
}
@@ -3617,6 +3621,12 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
36173621
parseSanitizerKinds("-fsanitize=", Args.getAllArgValues(OPT_fsanitize_EQ),
36183622
Diags, Opts.Sanitize);
36193623

3624+
// OptRecordFile is used to generate the optimization record file should
3625+
// be set regardless of the input type.
3626+
if (Args.hasArg(OPT_opt_record_file))
3627+
Opts.OptRecordFile =
3628+
std::string(Args.getLastArgValue(OPT_opt_record_file));
3629+
36203630
return Diags.getNumErrors() == NumErrorsBefore;
36213631
}
36223632

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7623,14 +7623,17 @@ SYCLIntelFPGAMaxConcurrencyAttr *Sema::MergeSYCLIntelFPGAMaxConcurrencyAttr(
76237623
// Check to see if there's a duplicate attribute with different values
76247624
// already applied to the declaration.
76257625
if (const auto *DeclAttr = D->getAttr<SYCLIntelFPGAMaxConcurrencyAttr>()) {
7626-
const auto *DeclExpr = dyn_cast<ConstantExpr>(DeclAttr->getNThreadsExpr());
7627-
const auto *MergeExpr = dyn_cast<ConstantExpr>(A.getNThreadsExpr());
7628-
if (DeclExpr && MergeExpr &&
7629-
DeclExpr->getResultAsAPSInt() != MergeExpr->getResultAsAPSInt()) {
7630-
Diag(DeclAttr->getLoc(), diag::warn_duplicate_attribute) << &A;
7631-
Diag(A.getLoc(), diag::note_previous_attribute);
7626+
if (const auto *DeclExpr =
7627+
dyn_cast<ConstantExpr>(DeclAttr->getNThreadsExpr())) {
7628+
if (const auto *MergeExpr = dyn_cast<ConstantExpr>(A.getNThreadsExpr())) {
7629+
if (DeclExpr->getResultAsAPSInt() != MergeExpr->getResultAsAPSInt()) {
7630+
Diag(DeclAttr->getLoc(), diag::warn_duplicate_attribute) << &A;
7631+
Diag(A.getLoc(), diag::note_previous_attribute);
7632+
}
7633+
// Do not add a duplicate attribute.
7634+
return nullptr;
7635+
}
76327636
}
7633-
return nullptr;
76347637
}
76357638

76367639
return ::new (Context)
@@ -7654,14 +7657,21 @@ void Sema::AddSYCLIntelFPGAMaxConcurrencyAttr(Decl *D,
76547657
return;
76557658
}
76567659

7660+
// Check to see if there's a duplicate attribute with different values
7661+
// already applied to the declaration.
76577662
if (const auto *DeclAttr = D->getAttr<SYCLIntelFPGAMaxConcurrencyAttr>()) {
7658-
const auto *DeclExpr =
7659-
dyn_cast<ConstantExpr>(DeclAttr->getNThreadsExpr());
7660-
if (DeclExpr && ArgVal != DeclExpr->getResultAsAPSInt()) {
7661-
Diag(CI.getLoc(), diag::warn_duplicate_attribute) << CI;
7662-
Diag(DeclAttr->getLoc(), diag::note_previous_attribute);
7663+
// If the other attribute argument is instantiation dependent, we won't
7664+
// have converted it to a constant expression yet and thus we test
7665+
// whether this is a null pointer.
7666+
if (const auto *DeclExpr =
7667+
dyn_cast<ConstantExpr>(DeclAttr->getNThreadsExpr())) {
7668+
if (ArgVal != DeclExpr->getResultAsAPSInt()) {
7669+
Diag(CI.getLoc(), diag::warn_duplicate_attribute) << CI;
7670+
Diag(DeclAttr->getLoc(), diag::note_previous_attribute);
7671+
}
7672+
// Drop the duplicate attribute.
7673+
return;
76637674
}
7664-
return;
76657675
}
76667676
}
76677677

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3669,17 +3669,29 @@ void Sema::ConstructOpenCLKernel(FunctionDecl *KernelCallerFunc,
36693669
SyclOptReportCreator opt_report(*this, kernel_decl, KernelObj->getLocation());
36703670

36713671
KernelObjVisitor Visitor{*this};
3672-
Visitor.VisitRecordBases(KernelObj, kernel_decl, kernel_body, int_header,
3673-
int_footer, opt_report);
3674-
Visitor.VisitRecordFields(KernelObj, kernel_decl, kernel_body, int_header,
3675-
int_footer, opt_report);
3672+
3673+
// Visit handlers to generate information for optimization record only if
3674+
// optimization record is saved.
3675+
if (!getLangOpts().OptRecordFile.empty()) {
3676+
Visitor.VisitRecordBases(KernelObj, kernel_decl, kernel_body, int_header,
3677+
int_footer, opt_report);
3678+
Visitor.VisitRecordFields(KernelObj, kernel_decl, kernel_body, int_header,
3679+
int_footer, opt_report);
3680+
} else {
3681+
Visitor.VisitRecordBases(KernelObj, kernel_decl, kernel_body, int_header,
3682+
int_footer);
3683+
Visitor.VisitRecordFields(KernelObj, kernel_decl, kernel_body, int_header,
3684+
int_footer);
3685+
}
36763686

36773687
if (ParmVarDecl *KernelHandlerArg =
36783688
getSyclKernelHandlerArg(KernelCallerFunc)) {
36793689
kernel_decl.handleSyclKernelHandlerType();
36803690
kernel_body.handleSyclKernelHandlerType(KernelHandlerArg);
36813691
int_header.handleSyclKernelHandlerType(KernelHandlerArg->getType());
3682-
opt_report.handleSyclKernelHandlerType();
3692+
3693+
if (!getLangOpts().OptRecordFile.empty())
3694+
opt_report.handleSyclKernelHandlerType();
36833695
}
36843696
}
36853697

0 commit comments

Comments
 (0)