-
Notifications
You must be signed in to change notification settings - Fork 802
[Driver][SYCL] Make -std=c++17 the default for DPC++ #1662
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5078,6 +5078,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, | |
| options::OPT_fno_trigraphs)) | ||
| if (A != Std) | ||
| A->render(Args, CmdArgs); | ||
| } else if (IsSYCL && types::isCXX(InputType)) { | ||
| // For DPC++, we default to -std=c++17 for all compilations. Use of -std | ||
| // on the command line will override. | ||
| CmdArgs.push_back("-std=c++17"); | ||
|
|
||
| Args.AddLastArg(CmdArgs, options::OPT_ftrigraphs, | ||
| options::OPT_fno_trigraphs); | ||
|
||
| } else { | ||
| // Honor -std-default. | ||
| // | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,7 @@ | |
| // CHECK-NEXT: FieldDecl {{.*}} MAssociatedAccesors 'vector_class<detail::ArgDesc>':'std::vector<cl::sycl::detail::ArgDesc, std::allocator<cl::sycl::detail::ArgDesc>>' | ||
| // CHECK-NEXT: FieldDecl {{.*}} MRequirements 'vector_class<detail::Requirement *>':'std::vector<cl::sycl::detail::AccessorImplHost *, std::allocator<cl::sycl::detail::AccessorImplHost *>>' | ||
| // CHECK-NEXT: FieldDecl {{.*}} MNDRDesc 'detail::NDRDescT':'cl::sycl::detail::NDRDescT' | ||
| // CHECK-NEXT: FieldDecl {{.*}} MKernelName 'cl::sycl::string_class':'std::__cxx11::basic_string<char>' | ||
| // CHECK-NEXT: FieldDecl {{.*}} MKernelName 'cl::sycl::string_class':'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do I understand it correctly that if we compile the application with different
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bader it is, and it can be a problem if the two types mismatch. Consider this: // a.h
struct A {
#ifdef BAR
int foo;
#else
float foo;
#endif
};
// b.cpp
#define BAR
#include "a.h"
extern void baz(A &a);
int main() {
A a;
a.foo = 10;
baz(a);
}
// c.cpp
#include "a.h"
void baz(A &a) {
a.foo /= 2;
}The size of two objects is the same. The offsets of data are also the same. But we have changed the type of the field. So, in these two translation units those are really different types. And that's roughly what happens with handler fields. That being said, I doubt, there's a difference in the layout of
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We need to investigate what is going on here.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The difference is because of this in <bits/basic_string.tcc> With -std=c++17, we don't take the #if part of the macro (we skip the elif as well).
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe you should increment dev version of RT library along with this change.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is the revision set?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not clear to me why we need to do it. Are we changing library with this change? |
||
| // CHECK-NEXT: FieldDecl {{.*}} MKernel 'shared_ptr_class<detail::kernel_impl>':'std::shared_ptr<cl::sycl::detail::kernel_impl>' | ||
| // CHECK-NEXT: FieldDecl {{.*}} MCGType 'detail::CG::CGTYPE':'cl::sycl::detail::CG::CGTYPE' | ||
| // CHECK-NEXT: DeclRefExpr {{.*}} 'cl::sycl::detail::CG::CGTYPE' EnumConstant {{.*}} 'NONE' 'cl::sycl::detail::CG::CGTYPE' | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.