Skip to content

Commit 467d8a9

Browse files
committed
resolve merge conflicts
Signed-off-by: jinge90 <[email protected]>
2 parents 8e434f6 + a37c10b commit 467d8a9

File tree

36 files changed

+860
-498
lines changed

36 files changed

+860
-498
lines changed

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.15.22905
8-
ocl_gpu_rt_ver=22.15.22905
7+
# https://github.com/intel/compute-runtime/releases/tag/22.19.23136
8+
ocl_gpu_rt_ver=22.19.23136
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.15.22905
34+
gpu_driver_lin=22.19.23136
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5903,7 +5903,7 @@ def arcmt_action_EQ : Joined<["-"], "arcmt-action=">, Flags<[CC1Option, NoDriver
59035903

59045904
def opt_record_file : Separate<["-"], "opt-record-file">,
59055905
HelpText<"File name to use for YAML optimization record output">,
5906-
MarshallingInfoString<CodeGenOpts<"OptRecordFile">>;
5906+
MarshallingInfoString<LangOpts<"OptRecordFile">>;
59075907
def opt_record_passes : Separate<["-"], "opt-record-passes">,
59085908
HelpText<"Only record remark information for passes whose names match the given regular expression">;
59095909
def opt_record_format : Separate<["-"], "opt-record-format">,

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: 10 additions & 5 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 = {

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/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

clang/test/Driver/sycl-device-lib-win.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
// SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-complex-fp64.obj" "-output={{.*}}libsycl-complex-fp64-{{.*}}.o" "-unbundle"
2525
// SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-cmath.obj" "-output={{.*}}libsycl-cmath-{{.*}}.o" "-unbundle"
2626
// SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-cmath-fp64.obj" "-output={{.*}}libsycl-cmath-fp64-{{.*}}.o" "-unbundle"
27+
// SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-msvc-math.obj" "-output={{.*}}libsycl-msvc-math-{{.*}}.o" "-unbundle"
2728
// SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-fallback-cassert.obj" "-output={{.*}}libsycl-fallback-cassert-{{.*}}.o" "-unbundle"
2829
// SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-fallback-cstring.obj" "-output={{.*}}libsycl-fallback-cstring-{{.*}}.o" "-unbundle"
2930
// SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-fallback-complex-fp64.obj" "-output={{.*}}libsycl-fallback-complex-{{.*}}.o" "-unbundle"
@@ -55,6 +56,7 @@
5556
// SYCL_DEVICE_LIB_UNBUNDLE_WITH_FP64-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-complex-fp64.obj" "-output={{.*}}libsycl-complex-fp64-{{.*}}.o" "-unbundle"
5657
// SYCL_DEVICE_LIB_UNBUNDLE_WITH_FP64-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-cmath.obj" "-output={{.*}}libsycl-cmath-{{.*}}.o" "-unbundle"
5758
// SYCL_DEVICE_LIB_UNBUNDLE_WITH_FP64-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-cmath-fp64.obj" "-output={{.*}}libsycl-cmath-fp64-{{.*}}.o" "-unbundle"
59+
// SYCL_DEVICE_LIB_UNBUNDLE_WITH_FP64-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-msvc-math.obj" "-output={{.*}}libsycl-msvc-math-{{.*}}.o" "-unbundle"
5860
// SYCL_DEVICE_LIB_UNBUNDLE_WITH_FP64-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-fallback-cassert.obj" "-output={{.*}}libsycl-fallback-cassert-{{.*}}.o" "-unbundle"
5961
// SYCL_DEVICE_LIB_UNBUNDLE_WITH_FP64-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-fallback-cstring.obj" "-output={{.*}}libsycl-fallback-cstring-{{.*}}.o" "-unbundle"
6062
// SYCL_DEVICE_LIB_UNBUNDLE_WITH_FP64-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-fallback-complex.obj" "-output={{.*}}libsycl-fallback-complex-{{.*}}.o" "-unbundle"
@@ -71,6 +73,7 @@
7173
// SYCL_DEVICE_LIB_UNBUNDLE_NO_LIBC: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-complex-fp64.obj" "-output={{.*}}libsycl-complex-fp64-{{.*}}.o" "-unbundle"
7274
// SYCL_DEVICE_LIB_UNBUNDLE_NO_LIBC-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-cmath.obj" "-output={{.*}}libsycl-cmath-{{.*}}.o" "-unbundle"
7375
// SYCL_DEVICE_LIB_UNBUNDLE_NO_LIBC-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-cmath-fp64.obj" "-output={{.*}}libsycl-cmath-fp64-{{.*}}.o" "-unbundle"
76+
// SYCL_DEVICE_LIB_UNBUNDLE_NO_LIBC-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-msvc-math.obj" "-output={{.*}}libsycl-msvc-math-{{.*}}.o" "-unbundle"
7477
// SYCL_DEVICE_LIB_UNBUNDLE_NO_LIBC-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-fallback-complex.obj" "-output={{.*}}libsycl-fallback-complex-{{.*}}.o" "-unbundle"
7578
// SYCL_DEVICE_LIB_UNBUNDLE_NO_LIBC-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-fallback-complex-fp64.obj" "-output={{.*}}libsycl-fallback-complex-fp64-{{.*}}.o" "-unbundle"
7679
// SYCL_DEVICE_LIB_UNBUNDLE_NO_LIBC-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-fallback-cmath.obj" "-output={{.*}}libsycl-fallback-cmath-{{.*}}.o" "-unbundle"
@@ -130,6 +133,7 @@
130133
// SYCL_LLVM_LINK_DEVICE_LIB-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-complex-fp64.obj" "-output={{.*}}libsycl-complex-fp64-{{.*}}.o" "-unbundle"
131134
// SYCL_LLVM_LINK_DEVICE_LIB-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-cmath.obj" "-output={{.*}}libsycl-cmath-{{.*}}.o" "-unbundle"
132135
// SYCL_LLVM_LINK_DEVICE_LIB-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-cmath-fp64.obj" "-output={{.*}}libsycl-cmath-fp64-{{.*}}.o" "-unbundle"
136+
// SYCL_LLVM_LINK_DEVICE_LIB-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-msvc-math.obj" "-output={{.*}}libsycl-msvc-math-{{.*}}.o" "-unbundle"
133137
// SYCL_LLVM_LINK_DEVICE_LIB-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-fallback-cassert.obj" "-output={{.*}}libsycl-fallback-cassert-{{.*}}.o" "-unbundle"
134138
// SYCL_LLVM_LINK_DEVICE_LIB-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-fallback-cstring.obj" "-output={{.*}}libsycl-fallback-cstring-{{.*}}.o" "-unbundle"
135139
// SYCL_LLVM_LINK_DEVICE_LIB-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown" "-input={{.*}}libsycl-fallback-complex.obj" "-output={{.*}}libsycl-fallback-complex-{{.*}}.o" "-unbundle"

libdevice/cmake/modules/SYCLLibdevice.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ add_devicelib_obj(libsycl-complex SRC complex_wrapper.cpp DEP ${complex_obj_deps
9898
add_devicelib_obj(libsycl-complex-fp64 SRC complex_wrapper_fp64.cpp DEP ${complex_obj_deps} )
9999
add_devicelib_obj(libsycl-cmath SRC cmath_wrapper.cpp DEP ${cmath_obj_deps})
100100
add_devicelib_obj(libsycl-cmath-fp64 SRC cmath_wrapper_fp64.cpp DEP ${cmath_obj_deps} )
101+
if(WIN32)
102+
add_devicelib_obj(libsycl-msvc-math SRC msvc_math.cpp DEP ${cmath_obj_deps})
103+
endif()
101104

102105
add_fallback_devicelib(libsycl-fallback-cassert SRC fallback-cassert.cpp DEP ${crt_obj_deps})
103106
add_fallback_devicelib(libsycl-fallback-cstring SRC fallback-cstring.cpp DEP ${crt_obj_deps})

0 commit comments

Comments
 (0)