Skip to content

Commit 15e62c2

Browse files
author
Erich Keane
authored
[SYCL] Implement no-decomposition for kernel types that don't need it. (#2477)
Kernel arguments don't need to be decomposed unless they contain a pointer or a special type, so we don't want to decompose structs/arrays containing these. This patch accomplishes that. First, we add a new attribute without a spelling that is added during the 'checking' stage, that the later vistiors can then check to see if decomposition is necessary. Next, we add a new checker to run during the checking stage that applies the attribute based on logic. Basically, a container doesn't need to be decomposed if all of its 'children' are acceptable, so we simply hold a stack of the containers to tell which need to be decomposed. This, of course, works recursively. Finally, we add some new calls to the visitor that handle the case of a 'simple array' and a 'simple struct', which are ones that don't require decomposition.
1 parent 97bec24 commit 15e62c2

12 files changed

+824
-319
lines changed

clang/include/clang/Basic/Attr.td

+8
Original file line numberDiff line numberDiff line change
@@ -1198,6 +1198,14 @@ def SYCLIntelBufferLocation : InheritableAttr {
11981198
let Documentation = [Undocumented];
11991199
}
12001200

1201+
def SYCLRequiresDecomposition : InheritableAttr {
1202+
// No spellings, as this is for internal use.
1203+
let Spellings = [];
1204+
let Subjects = SubjectList<[Named]>;
1205+
let LangOpts = [SYCLIsDevice, SYCLIsHost];
1206+
let Documentation = [Undocumented];
1207+
}
1208+
12011209
def SYCLIntelKernelArgsRestrict : InheritableAttr {
12021210
let Spellings = [ CXX11<"intel", "kernel_args_restrict"> ];
12031211
let Subjects = SubjectList<[Function], ErrorDiag>;

0 commit comments

Comments
 (0)