Skip to content

Commit 5a155cc

Browse files
committed
Merge remote-tracking branch 'origin/sycl' into llvmspirv_pulldown
2 parents fa8612d + 205aa71 commit 5a155cc

File tree

118 files changed

+2210
-1400
lines changed

Some content is hidden

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

118 files changed

+2210
-1400
lines changed

.github/workflows/release-binaries.yml

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

302302
- name: Attest Build Provenance
303303
id: provenance
304-
uses: actions/attest-build-provenance@db473fddc028af60658334401dc6fa3ffd8669fd # v2.3.0
304+
uses: actions/attest-build-provenance@e8998f949152b193b063cb0ec769d69d929409be # v2.4.0
305305
with:
306306
subject-path: ${{ needs.prepare.outputs.release-binary-filename }}
307307

.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@db473fddc028af60658334401dc6fa3ffd8669fd # v2.3.0
95+
uses: actions/attest-build-provenance@e8998f949152b193b063cb0ec769d69d929409be # v2.4.0
9696
with:
9797
subject-path: "*.xz"
9898
- if: github.event_name != 'pull_request'

clang/include/clang/Sema/SemaSYCL.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ class SemaSYCL : public SemaBase {
265265

266266
llvm::DenseSet<const FunctionDecl *> SYCLKernelFunctions;
267267

268+
llvm::DenseSet<const FunctionDecl *> FreeFunctionDeclarations;
269+
268270
public:
269271
SemaSYCL(Sema &S);
270272

@@ -357,7 +359,9 @@ class SemaSYCL : public SemaBase {
357359
void ConstructOpenCLKernel(FunctionDecl *KernelCallerFunc, MangleContext &MC);
358360
void SetSYCLKernelNames();
359361
void MarkDevices();
362+
void processFreeFunctionDeclaration(const FunctionDecl *FD);
360363
void ProcessFreeFunction(FunctionDecl *FD);
364+
void finalizeFreeFunctionKernels();
361365

362366
/// Get the number of fields or captures within the parsed type.
363367
ExprResult ActOnSYCLBuiltinNumFieldsExpr(ParsedType PT);

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1934,7 +1934,7 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
19341934
// Implicit copy-assignment gets the same special treatment as implicit
19351935
// copy-constructors.
19361936
emitImplicitAssignmentOperatorBody(Args);
1937-
} else if (DeviceKernelAttr::isOpenCLSpelling(
1937+
} else if (getLangOpts().OpenCL && DeviceKernelAttr::isOpenCLSpelling(
19381938
FD->getAttr<DeviceKernelAttr>()) &&
19391939
GD.getKernelReferenceKind() == KernelReferenceKind::Kernel) {
19401940
CallArgList CallArgs;

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4360,7 +4360,7 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) {
43604360

43614361
// Ignore declarations, they will be emitted on their first use.
43624362
if (const auto *FD = dyn_cast<FunctionDecl>(Global)) {
4363-
if (DeviceKernelAttr::isOpenCLSpelling(FD->getAttr<DeviceKernelAttr>()) &&
4363+
if (LangOpts.OpenCL && DeviceKernelAttr::isOpenCLSpelling(FD->getAttr<DeviceKernelAttr>()) &&
43644364
FD->doesThisDeclarationHaveABody())
43654365
addDeferredDeclToEmit(GlobalDecl(FD, KernelReferenceKind::Stub));
43664366

clang/lib/CodeGen/TargetInfo.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,6 @@ unsigned TargetCodeGenInfo::getDeviceKernelCallingConv() const {
125125

126126
void TargetCodeGenInfo::setOCLKernelStubCallingConvention(
127127
const FunctionType *&FT) const {
128-
129-
if (getABIInfo().getContext().getLangOpts().SYCLIsNativeCPU)
130-
return;
131-
132128
FT = getABIInfo().getContext().adjustFunctionType(
133129
FT, FT->getExtInfo().withCallingConv(CC_C));
134130
}

clang/lib/CodeGen/Targets/SPIR.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,9 +394,6 @@ void SPIRVTargetCodeGenInfo::setCUDAKernelCallingConvention(
394394

395395
void CommonSPIRTargetCodeGenInfo::setOCLKernelStubCallingConvention(
396396
const FunctionType *&FT) const {
397-
// Disable kernel stub for sycl
398-
if (getABIInfo().getContext().getLangOpts().isSYCL())
399-
return;
400397
FT = getABIInfo().getContext().adjustFunctionType(
401398
FT, FT->getExtInfo().withCallingConv(CC_SpirFunction));
402399
}

clang/lib/Driver/Driver.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,19 +1571,6 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
15711571
}
15721572
}
15731573

1574-
// -fno-sycl-libspirv flag is reserved for very unusual cases where the
1575-
// libspirv library is not linked when using CUDA/HIP: so output appropriate
1576-
// warnings.
1577-
if (C.getInputArgs().hasArg(options::OPT_fno_sycl_libspirv)) {
1578-
for (auto &TT : UniqueSYCLTriplesVec) {
1579-
if (TT.isNVPTX() || TT.isAMDGCN()) {
1580-
Diag(diag::warn_flag_no_sycl_libspirv) << TT.getTriple();
1581-
continue;
1582-
}
1583-
Diag(diag::warn_drv_unsupported_option_for_target)
1584-
<< "-fno-sycl-libspirv" << TT.getTriple() << 0;
1585-
}
1586-
}
15871574
// -fsycl-fp64-conv-emu is valid only for AOT compilation with an Intel GPU
15881575
// target. For other scenarios, we emit a warning message.
15891576
if (C.getInputArgs().hasArg(options::OPT_fsycl_fp64_conv_emu)) {

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,18 @@ const char *SYCLInstallationDetector::findLibspirvPath(
210210
void SYCLInstallationDetector::addLibspirvLinkArgs(
211211
const llvm::Triple &DeviceTriple, const llvm::opt::ArgList &DriverArgs,
212212
const llvm::Triple &HostTriple, llvm::opt::ArgStringList &CC1Args) const {
213-
if (DriverArgs.hasArg(options::OPT_fno_sycl_libspirv) ||
214-
D.offloadDeviceOnly())
213+
DriverArgs.claimAllArgs(options::OPT_fno_sycl_libspirv);
214+
215+
if (D.offloadDeviceOnly())
216+
return;
217+
218+
if (DriverArgs.hasArg(options::OPT_fno_sycl_libspirv)) {
219+
// -fno-sycl-libspirv flag is reserved for very unusual cases where the
220+
// libspirv library is not linked when required by the device: so output
221+
// appropriate warnings.
222+
D.Diag(diag::warn_flag_no_sycl_libspirv) << DeviceTriple.str();
215223
return;
224+
}
216225

217226
if (const char *LibSpirvFile =
218227
findLibspirvPath(DeviceTriple, DriverArgs, HostTriple)) {

clang/lib/Sema/Sema.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,6 +1250,7 @@ void Sema::ActOnEndOfTranslationUnitFragment(TUFragmentKind Kind) {
12501250
}
12511251

12521252
if (getLangOpts().SYCLIsDevice) {
1253+
SYCL().finalizeFreeFunctionKernels();
12531254
// Set the names of the kernels, now that the names have settled down. This
12541255
// needs to happen before we generate the integration headers.
12551256
SYCL().SetSYCLKernelNames();

0 commit comments

Comments
 (0)