Skip to content

Commit 761a0ef

Browse files
committed
Merge remote-tracking branch 'intel/sycl' into fix_aspect_ext_intel_free_memory_ignored
2 parents b2d30ba + 130a901 commit 761a0ef

File tree

210 files changed

+2302
-495
lines changed

Some content is hidden

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

210 files changed

+2302
-495
lines changed

.github/workflows/release-binaries.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ jobs:
436436

437437
- name: Attest Build Provenance
438438
id: provenance
439-
uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3
439+
uses: actions/attest-build-provenance@ef244123eb79f2f7a7e75d99086184180e6d0018 # v1.4.4
440440
with:
441441
subject-path: ${{ needs.prepare.outputs.release-binary-filename }}
442442

.github/workflows/release-sources.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ jobs:
9292
- name: Attest Build Provenance
9393
if: github.event_name != 'pull_request'
9494
id: provenance
95-
uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3
95+
uses: actions/attest-build-provenance@ef244123eb79f2f7a7e75d99086184180e6d0018 # v1.4.4
9696
with:
9797
subject-path: "*.xz"
9898
- if: github.event_name != 'pull_request'

.github/workflows/scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@ jobs:
5757

5858
# Upload the results to GitHub's code scanning dashboard.
5959
- name: "Upload to code-scanning"
60-
uses: github/codeql-action/upload-sarif@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0
60+
uses: github/codeql-action/upload-sarif@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
6161
with:
6262
sarif_file: results.sarif

.github/workflows/sycl-nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ jobs:
198198
echo "TAG=$(date +'%Y-%m-%d')-${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
199199
fi
200200
- name: Upload binaries
201-
uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8
201+
uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974
202202
with:
203203
files: |
204204
sycl_linux.tar.gz

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,6 +1789,9 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
17891789
if (SyclOptReport.HasOptReportInfo(FD)) {
17901790
llvm::OptimizationRemarkEmitter ORE(Fn);
17911791
for (auto ORI : llvm::enumerate(SyclOptReport.GetInfo(FD))) {
1792+
// Temporarily apply arg location to ensure SourceLocToDebugLoc
1793+
// picks up the expected file.
1794+
ApplyDebugLocation TempApplyLoc(*this, ORI.value().KernelArgLoc);
17921795
llvm::DiagnosticLocation DL =
17931796
SourceLocToDebugLoc(ORI.value().KernelArgLoc);
17941797
StringRef NameInDesc = ORI.value().KernelArgDescName;

clang/lib/Driver/OffloadBundler.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -687,12 +687,12 @@ class ObjectFileHandler final : public FileHandler {
687687
if (Error Err = Symbol.printName(NameOS))
688688
return std::move(Err);
689689

690-
// If we are dealing with a bitcode file do not add special globals
691-
// llvm.used and llvm.compiler.used and __AsanDeviceGlobalMetadata to
690+
// If we are dealing with a bitcode file do not add special globals to
692691
// the list of defined symbols.
693692
if (SF->isIR() &&
694693
(Name == "llvm.used" || Name == "llvm.compiler.used" ||
695-
Name == "__AsanDeviceGlobalMetadata"))
694+
Name == "__AsanDeviceGlobalMetadata" ||
695+
Name == "__AsanKernelMetadata"))
696696
continue;
697697

698698
// Add symbol name with the target prefix to the buffer.

clang/lib/Driver/SanitizerArgs.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,6 +1197,9 @@ void SanitizerArgs::addArgs(const ToolChain &TC, const llvm::opt::ArgList &Args,
11971197

11981198
CmdArgs.push_back("-mllvm");
11991199
CmdArgs.push_back("-asan-mapping-scale=4");
1200+
1201+
addSpecialCaseListOpt(Args, CmdArgs,
1202+
"-fsanitize-ignorelist=", UserIgnorelistFiles);
12001203
}
12011204
return;
12021205
}

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,29 @@ SYCL::getDeviceLibraries(const Compilation &C, const llvm::Triple &TargetTriple,
576576
}
577577
};
578578

579+
addLibraries(SYCLDeviceWrapperLibs);
580+
if (IsSpirvAOT)
581+
addLibraries(SYCLDeviceFallbackLibs);
582+
583+
bool NativeBfloatLibs;
584+
bool NeedBfloatLibs = selectBfloatLibs(TargetTriple, C, NativeBfloatLibs);
585+
if (NeedBfloatLibs) {
586+
// Add native or fallback bfloat16 library.
587+
if (NativeBfloatLibs)
588+
addLibraries(SYCLDeviceBfloat16NativeLib);
589+
else
590+
addLibraries(SYCLDeviceBfloat16FallbackLib);
591+
}
592+
593+
// Link in ITT annotations library unless fsycl-no-instrument-device-code
594+
// is specified. This ensures that we are ABI-compatible with the
595+
// instrumented device code, which was the default not so long ago.
596+
if (Args.hasFlag(options::OPT_fsycl_instrument_device_code,
597+
options::OPT_fno_sycl_instrument_device_code, true))
598+
addLibraries(SYCLDeviceAnnotationLibs);
599+
600+
#if !defined(_WIN32)
601+
579602
auto addSingleLibrary = [&](const DeviceLibOptInfo &Lib) {
580603
if (!DeviceLibLinkInfo[Lib.DeviceLibOption])
581604
return;
@@ -636,28 +659,6 @@ SYCL::getDeviceLibraries(const Compilation &C, const llvm::Triple &TargetTriple,
636659
return JIT;
637660
};
638661

639-
addLibraries(SYCLDeviceWrapperLibs);
640-
if (IsSpirvAOT)
641-
addLibraries(SYCLDeviceFallbackLibs);
642-
643-
bool NativeBfloatLibs;
644-
bool NeedBfloatLibs = selectBfloatLibs(TargetTriple, C, NativeBfloatLibs);
645-
if (NeedBfloatLibs) {
646-
// Add native or fallback bfloat16 library.
647-
if (NativeBfloatLibs)
648-
addLibraries(SYCLDeviceBfloat16NativeLib);
649-
else
650-
addLibraries(SYCLDeviceBfloat16FallbackLib);
651-
}
652-
653-
// Link in ITT annotations library unless fsycl-no-instrument-device-code
654-
// is specified. This ensures that we are ABI-compatible with the
655-
// instrumented device code, which was the default not so long ago.
656-
if (Args.hasFlag(options::OPT_fsycl_instrument_device_code,
657-
options::OPT_fno_sycl_instrument_device_code, true))
658-
addLibraries(SYCLDeviceAnnotationLibs);
659-
660-
#if !defined(_WIN32)
661662
std::string SanitizeVal;
662663
size_t sanitizer_lib_idx = getSingleBuildTarget();
663664
if (Arg *A = Args.getLastArg(options::OPT_fsanitize_EQ,
@@ -1618,6 +1619,23 @@ static std::vector<OptSpecifier> getUnsupportedOpts(void) {
16181619
return UnsupportedOpts;
16191620
}
16201621

1622+
// Currently supported options by SYCL NativeCPU device compilation
1623+
static inline bool SupportedByNativeCPU(const SYCLToolChain &TC,
1624+
const OptSpecifier &Opt) {
1625+
if (!TC.IsSYCLNativeCPU)
1626+
return false;
1627+
1628+
switch (Opt.getID()) {
1629+
case options::OPT_fcoverage_mapping:
1630+
case options::OPT_fno_coverage_mapping:
1631+
case options::OPT_fprofile_instr_generate:
1632+
case options::OPT_fprofile_instr_generate_EQ:
1633+
case options::OPT_fno_profile_instr_generate:
1634+
return true;
1635+
}
1636+
return false;
1637+
}
1638+
16211639
SYCLToolChain::SYCLToolChain(const Driver &D, const llvm::Triple &Triple,
16221640
const ToolChain &HostTC, const ArgList &Args)
16231641
: ToolChain(D, Triple, Args), HostTC(HostTC),
@@ -1629,6 +1647,9 @@ SYCLToolChain::SYCLToolChain(const Driver &D, const llvm::Triple &Triple,
16291647
// Diagnose unsupported options only once.
16301648
for (OptSpecifier Opt : getUnsupportedOpts()) {
16311649
if (const Arg *A = Args.getLastArg(Opt)) {
1650+
// Native CPU can support options unsupported by other targets.
1651+
if (SupportedByNativeCPU(*this, Opt))
1652+
continue;
16321653
// All sanitizer options are not currently supported, except
16331654
// AddressSanitizer
16341655
if (A->getOption().getID() == options::OPT_fsanitize_EQ &&
@@ -1669,6 +1690,9 @@ SYCLToolChain::TranslateArgs(const llvm::opt::DerivedArgList &Args,
16691690
bool Unsupported = false;
16701691
for (OptSpecifier UnsupportedOpt : getUnsupportedOpts()) {
16711692
if (Opt.matches(UnsupportedOpt)) {
1693+
// NativeCPU should allow most normal cpu options.
1694+
if (SupportedByNativeCPU(*this, Opt.getID()))
1695+
continue;
16721696
if (Opt.getID() == options::OPT_fsanitize_EQ &&
16731697
A->getValues().size() == 1) {
16741698
std::string SanitizeVal = A->getValue();

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3625,8 +3625,11 @@ class SyclKernelBodyCreator : public SyclKernelFieldHandler {
36253625
BodyStmts.insert(BodyStmts.end(), FinalizeStmts.begin(),
36263626
FinalizeStmts.end());
36273627

3628+
SourceLocation LL = NewBody ? NewBody->getBeginLoc() : SourceLocation();
3629+
SourceLocation LR = NewBody ? NewBody->getEndLoc() : SourceLocation();
3630+
36283631
return CompoundStmt::Create(SemaSYCLRef.getASTContext(), BodyStmts,
3629-
FPOptionsOverride(), {}, {});
3632+
FPOptionsOverride(), LL, LR);
36303633
}
36313634

36323635
void annotateHierarchicalParallelismAPICalls() {

clang/test/Driver/sycl-native-cpu.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,9 @@
2424

2525
// RUN: %clangxx -fsycl -fsycl-targets=spir64 %s -### 2>&1 | FileCheck -check-prefix=CHECK-NONATIVECPU %s
2626
// CHECK-NONATIVECPU-NOT: "-D" "__SYCL_NATIVE_CPU__"
27+
28+
// Checking that coverage testing options are accepted by native_cpu, and that device and host compilation invocations receive the same options
29+
// RUN: %clangxx -fsycl -fsycl-targets=native_cpu -Werror -fno-profile-instr-generate -fprofile-instr-generate -fno-coverage-mapping -fcoverage-mapping -### %s 2>&1 | FileCheck %s --check-prefix=CHECK_COV_INVO
30+
// CHECK_COV_INVO:{{.*}}clang{{.*}}-fsycl-is-device{{.*}}"-fsycl-is-native-cpu" "-D" "__SYCL_NATIVE_CPU__"{{.*}}"-fprofile-instrument=clang"{{.*}}"-fcoverage-mapping" "-fcoverage-compilation-dir={{.*}}"
31+
// CHECK_COV_INVO:{{.*}}clang{{.*}}"-fsycl-is-host"{{.*}}"-fprofile-instrument=clang"{{.*}}"-fcoverage-mapping" "-fcoverage-compilation-dir={{.*}}"
32+

0 commit comments

Comments
 (0)