Skip to content

Commit 6ea82f0

Browse files
Merge branch 'intel:sycl' into CI-l0v2
2 parents 682a4ba + 0cdfaee commit 6ea82f0

37 files changed

+829
-320
lines changed

.github/workflows/sycl-check-ready-to-merge-prs.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,25 @@ jobs:
2727
days=3
2828
days_in_seconds=$((days*24*60*60))
2929
30-
gh repo set-default intel/llvm
31-
3230
# Function to ping gatekeepers and print debug info
3331
ping_gatekeepers() {
3432
pr_number=$1
35-
gh pr comment "$pr_number" --body "@intel/llvm-gatekeepers please consider merging"
33+
gh pr comment "$pr_number" --repo intel/llvm --body "@intel/llvm-gatekeepers please consider merging"
3634
echo "Pinged @intel/llvm-gatekeepers for https://github.com/intel/llvm/pull/$pr_number"
3735
}
3836
3937
# Get the list of suitable PRs
40-
prs=$(gh pr list --search "is:open review:approved draft:no status:success" --json number --jq '.[].number')
38+
prs=$(gh pr list --search "is:open review:approved draft:no status:success" --repo intel/llvm --json number --jq '.[].number')
4139
now=$(date -u +%s)
4240
for pr in $prs; do
4341
# Skip PRs that don't target the sycl branch
44-
pr_base=$(gh pr view $pr --json baseRefName -q .baseRefName)
42+
pr_base=$(gh pr view $pr --repo intel/llvm --json baseRefName -q .baseRefName)
4543
if [ "$pr_base" != "sycl" ]; then
4644
continue
4745
fi
4846
4947
# Get the timestamp of the latest comment mentioning @intel/llvm-gatekeepers
50-
latest_ts=$(gh pr view $pr --json comments \
48+
latest_ts=$(gh pr view $pr --repo intel/llvm --json comments \
5149
--jq '[.comments[] | select(.body | test("@intel/llvm-gatekeepers")) | .createdAt] | last')
5250
# If there is no previous mention, ping the gatekeepers
5351
if [[ -z "$latest_ts" ]]; then

.github/workflows/sycl-linux-run-tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,5 +380,4 @@ jobs:
380380
dry_run: ${{ inputs.benchmark_dry_run }}
381381
exit_on_failure: ${{ inputs.benchmark_exit_on_failure }}
382382
build_ref: ${{ inputs.repo_ref }}
383-
env:
384-
RUNNER_TAG: ${{ inputs.runner }}
383+
runner: ${{ inputs.runner }}

clang/include/clang/Sema/SemaSYCL.h

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ class SYCLIntegrationHeader {
6565
kind_work_group_memory,
6666
kind_dynamic_work_group_memory,
6767
kind_dynamic_accessor,
68-
kind_last = kind_dynamic_accessor
68+
kind_struct_with_special_type, // structs that contain special types
69+
kind_last = kind_struct_with_special_type
6970
};
7071

7172
public:
@@ -118,6 +119,9 @@ class SYCLIntegrationHeader {
118119
/// integration header is required.
119120
void addHostPipeRegistration() { NeedToEmitHostPipeRegistration = true; }
120121

122+
/// Set the ParentStruct field
123+
void setParentStruct(ParmVarDecl *parent);
124+
121125
private:
122126
// Kernel actual parameter descriptor.
123127
struct KernelParamDesc {
@@ -205,6 +209,20 @@ class SYCLIntegrationHeader {
205209
/// Keeps track of whether declaration of __sycl_host_pipe_registration
206210
/// type and __sycl_host_pipe_registrar variable are required to emit.
207211
bool NeedToEmitHostPipeRegistration = false;
212+
213+
// For free function kernels, keeps track of the parameter that is currently
214+
// being analyzed if it is a struct that contains special types.
215+
ParmVarDecl *ParentStruct = nullptr;
216+
217+
// For every struct that contains a special type which is given by
218+
// the ParentStruct field above, record the offset and size of its fields
219+
// at any nesting level. Store the information in the variable below.
220+
llvm::DenseMap<ParmVarDecl *, llvm::SmallVector<std::pair<size_t, size_t>>>
221+
OffsetSizeInfo;
222+
// Likewise for the kind of a field i.e accessor, std_layout etc...
223+
llvm::DenseMap<ParmVarDecl *,
224+
llvm::SmallVector<SYCLIntegrationHeader::kernel_param_kind_t>>
225+
KindInfo;
208226
};
209227

210228
class SYCLIntegrationFooter {
@@ -267,6 +285,10 @@ class SemaSYCL : public SemaBase {
267285

268286
llvm::DenseSet<const FunctionDecl *> FreeFunctionDeclarations;
269287

288+
// A map that keeps track of all structs encountered with
289+
// special types inside. Relevant for free function kernels only.
290+
llvm::DenseSet<const RecordDecl *> StructsWithSpecialTypes;
291+
270292
public:
271293
SemaSYCL(Sema &S);
272294

@@ -317,6 +339,13 @@ class SemaSYCL : public SemaBase {
317339
SYCLKernelFunctions.insert(FD);
318340
}
319341

342+
/// Add ParentStruct to StructsWithSpecialTypes.
343+
void addStructWithSpecialType(const RecordDecl *ParentStruct) {
344+
StructsWithSpecialTypes.insert(ParentStruct);
345+
}
346+
347+
auto &getStructsWithSpecialType() const { return StructsWithSpecialTypes; }
348+
320349
/// Lazily creates and returns SYCL integration header instance.
321350
SYCLIntegrationHeader &getSyclIntegrationHeader() {
322351
if (SyclIntHeader == nullptr)

clang/lib/AST/DeclPrinter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1927,7 +1927,8 @@ void DeclPrinter::VisitNonTypeTemplateParmDecl(
19271927
void DeclPrinter::VisitTemplateTemplateParmDecl(
19281928
const TemplateTemplateParmDecl *TTPD) {
19291929
VisitTemplateDecl(TTPD);
1930-
if (TTPD->hasDefaultArgument() && !TTPD->defaultArgumentWasInherited()) {
1930+
if (TTPD->hasDefaultArgument() && !Policy.SuppressDefaultTemplateArguments &&
1931+
!TTPD->defaultArgumentWasInherited()) {
19311932
Out << " = ";
19321933
TTPD->getDefaultArgument().getArgument().print(Policy, Out,
19331934
/*IncludeType=*/false);

clang/lib/Driver/Driver.cpp

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5061,14 +5061,19 @@ class OffloadingActionBuilder final {
50615061
llvm::zip(SYCLDeviceActions, SYCLTargetInfoList)) {
50625062
Action *&A = std::get<0>(TargetActionInfo);
50635063
auto &TargetInfo = std::get<1>(TargetActionInfo);
5064-
A = C.getDriver().ConstructPhaseAction(C, Args, CurPhase, A,
5065-
AssociatedOffloadKind);
5066-
if (SYCLDeviceOnly)
5064+
Action *PreprocAction = C.getDriver().ConstructPhaseAction(
5065+
C, Args, CurPhase, A, AssociatedOffloadKind);
5066+
if (SYCLDeviceOnly) {
5067+
A = PreprocAction;
50675068
continue;
5069+
}
50685070
// Add an additional compile action to generate the integration
5069-
// header.
5071+
// header. This action compiles the source file instead of the
5072+
// generated preprocessed file to allow for control of the
5073+
// diagnostics that could come from the system headers.
50705074
Action *CompileAction =
50715075
C.MakeAction<CompileJobAction>(A, types::TY_Nothing);
5076+
A = PreprocAction;
50725077
DA.add(*CompileAction, *TargetInfo.TC, TargetInfo.BoundArch,
50735078
Action::OFK_SYCL);
50745079
}
@@ -8001,8 +8006,15 @@ Action *Driver::BuildOffloadingActions(Compilation &C,
80018006
if (isa<PreprocessJobAction>(A)) {
80028007
PackagerActions.push_back(OA);
80038008
A->setCannotBeCollapsedWithNextDependentAction();
8004-
Action *CompileAction =
8005-
C.MakeAction<CompileJobAction>(A, types::TY_Nothing);
8009+
// The input to the compilation job is the preprocessed job.
8010+
// Take that input action (it should be one input) which is
8011+
// the source file and compile that file to generate the
8012+
// integration header/footer.
8013+
ActionList PreprocInputs = A->getInputs();
8014+
assert(PreprocInputs.size() == 1 &&
8015+
"Single input size to preprocess action expected.");
8016+
Action *CompileAction = C.MakeAction<CompileJobAction>(
8017+
PreprocInputs.front(), types::TY_Nothing);
80068018
DDeps.add(*CompileAction, *TC, BoundArch, Action::OFK_SYCL);
80078019
}
80088020
});

0 commit comments

Comments
 (0)