Skip to content

Add the remaining diagnostics to device_global implementation #5809

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 35 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0251bfb
[SYCL] Add clang support for device_global
schittir Feb 7, 2022
117de59
Remove unused lines i.e., Merge attribute method calls and SYCLUniqueID
schittir Feb 16, 2022
a96d57a
Address some comments, fix format, remove unused lines
schittir Feb 16, 2022
f2230af
Add Sema test; address more comments
schittir Feb 17, 2022
0fb176d
Some fixes in order to pass CodeGen test
Fznamznon Feb 25, 2022
e4c15c4
Refactor isSyclGlobalVariableAllowedType
schittir Feb 25, 2022
af8a294
Fix some test cases; address some comments
schittir Feb 18, 2022
feb841b
Remove explicit attribute handling; change diagnostic message; add test
schittir Mar 1, 2022
df337a7
Add diagnostic to test
schittir Mar 1, 2022
748e8ce
Address Mariya's comments
schittir Mar 1, 2022
d84428c
Fix typo; Refactor methods;
schittir Mar 1, 2022
0343158
Fix quotes, update diag messages, report private members
Fznamznon Mar 2, 2022
6d6d7dd
Change DeviceGlobalType checking call
schittir Mar 3, 2022
679b5f0
Move isSyclGlobalType definition to header
schittir Mar 3, 2022
5ecd545
Address latest comments
schittir Mar 3, 2022
e51530d
Merge remote-tracking branch 'intel_llvm_remote/sycl' into SYCL_devic…
schittir Mar 3, 2022
aef34f9
Add back attribute to CodeGenSYCL/Inputs/sycl.hpp after merge
schittir Mar 3, 2022
4cac80e
Remove additional definition of SYCLDeviceGlobal
schittir Mar 3, 2022
3f79c5e
Add test description; Remove unsupported test cases
schittir Mar 3, 2022
2664869
Fix format
schittir Mar 3, 2022
0469d18
clang-format again!
schittir Mar 4, 2022
d25c816
Fix lit tests; Address comments
schittir Mar 4, 2022
19f62a5
Fix lint
schittir Mar 4, 2022
0354ea5
Lint again :(
schittir Mar 4, 2022
b45159d
Fix build failure; Add comment; Fix indentation
schittir Mar 7, 2022
3baff38
Fix lit test SemaSYCL/explicit-cast-to-generic.cpp
schittir Mar 9, 2022
5bced1a
Emit generic addrspace in llvm.used and llvm.global_ctors
Fznamznon Mar 9, 2022
505a4f2
Fix format
schittir Mar 9, 2022
4905d70
Add comments; rename method; add separate AST test
schittir Mar 10, 2022
3817bf0
Fix lint that git-clang-format didn't catch :(
schittir Mar 10, 2022
1c53934
Add case where device_global attributes are applied to the wrong subject
schittir Mar 11, 2022
e489d50
Attribute doesn't apply to this type
schittir Mar 11, 2022
0709448
Add comments in CodeGenModule.cpp
schittir Mar 11, 2022
d4647f6
Change comments
schittir Mar 14, 2022
e4ab3bd
More diagnostic work
schittir Mar 15, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
More diagnostic work
  • Loading branch information
schittir committed Mar 15, 2022
commit e4ab3bd7b29a4ad77e4f60c75e72d366f5e693bb
34 changes: 33 additions & 1 deletion clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1517,8 +1517,29 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D,

// Only add this if we aren't instantiating a variable template. We'll end up
// adding the VarTemplateSpecializationDecl later.
if (!InstantiatingVarTemplate)
if (!InstantiatingVarTemplate) {
SemaRef.addSyclVarDecl(Var);
if (SemaRef.getLangOpts().SYCLIsDevice) {
if (SemaRef.isDecoratedWithDeclAttribute<SYCLDeviceGlobalAttr>(Var->getType())) {
if (!Var->hasGlobalStorage() || Var->isLocalVarDeclOrParm()) {
SemaRef.Diag(D->getLocation(),
diag::err_sycl_device_global_incorrect_scope);
}

if (Var->isStaticLocal()) {
const DeclContext *DeclCtx = Var->getDeclContext();
while (!DeclCtx->isTranslationUnit()) {
if (isa<FunctionDecl>(DeclCtx)) {
SemaRef.Diag(D->getLocation(),
diag::err_sycl_device_global_incorrect_scope);
break;
}
DeclCtx = DeclCtx->getParent();
}
}
}
}
}
return Var;
}

Expand Down Expand Up @@ -1607,6 +1628,17 @@ Decl *TemplateDeclInstantiator::VisitFieldDecl(FieldDecl *D) {

Field->setImplicit(D->isImplicit());
Field->setAccess(D->getAccess());
// Static members are not processed here, so error out if we have a device
// global without checking access modifier.
if (SemaRef.getLangOpts().SYCLIsDevice) {
if (auto Value = dyn_cast<ValueDecl>(Field)) {
if (SemaRef.isDecoratedWithDeclAttribute<SYCLDeviceGlobalAttr>(Value->getType())) {
SemaRef.Diag(D->getLocation(),
diag::err_sycl_device_global_incorrect_scope)
<< Value;
}
}
}
Owner->addDecl(Field);

return Field;
Expand Down