-
Notifications
You must be signed in to change notification settings - Fork 768
[SYCL] Support the cases when accessor is wrapped to some class #82
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
Conversation
Sorry, looks like I found some possible problem in my patch. Will reopen once resolved. |
55c40e0
to
b4292a3
Compare
Current implementation supports only the cases when captured accessor is a top level object. But accessors could be wrapped to some classes. Frontend should properly handle this case and intialize accessors using appropriate kernel parameters. Signed-off-by: Artur Gainullin <artur.gainullin@intel.com>
b4292a3
to
1377dc6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like my review has been forgotten in the pending limbo for a few days... :-(
I submit it now, even if it is too late.
Expr *Base) { | ||
for (auto *WrapperFld : CRD->fields()) { | ||
QualType FldType = WrapperFld->getType(); | ||
CXXRecordDecl *WrapperFldCRD = FldType->getAsCXXRecordDecl(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto
instead of CXXRecordDecl
since the type is obvious?
} else { | ||
// Field is a structure or class so change the wrapper object | ||
// and recursively search for accessor field. | ||
DeclAccessPair WrapperFieldDAP = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto
instead of DeclAccessPair
since the type is obvious?
}; | ||
|
||
QualType FieldType = Field->getType(); | ||
CXXRecordDecl *CRD = FieldType->getAsCXXRecordDecl(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto
instead of CXXRecordDecl
since the type is obvious?
auto acc_wrapped = AccWrapper<decltype(acc)>{acc}; | ||
kernel<class wrapped_access>( | ||
[=]() { | ||
acc_wrapped.accessor.use(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I appreciate this feature, I have the feeling it is a kind of magical SYCL extension...
To discuss inside the SYCL committee...
|
||
template <typename Acc> struct Wrapper2 { | ||
Wrapper1 w1; | ||
AccWrapper<Acc> wrapped; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have the feeling that means something like "capture of non-static storage is allowed by copy if the object is trivially-copiable, standard layout, or a combination with accessors."
cgh.parallel_for<class wrapped_access3>( | ||
sycl::range<1>(buf.get_count()), [=](sycl::item<1> it) { | ||
auto idx = it.get_linear_id(); | ||
wr3.w2.wrapped.accessor[idx] = 333; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch! :-)
@@ -515,11 +515,52 @@ CreateSYCLKernelBody(Sema &S, FunctionDecl *KernelCallerFunc, DeclContext *DC) { | |||
S, ((*ParamItr++))->getOriginalType(), ParamDREs[2])); | |||
ParamStmts.push_back(getExprForRangeOrOffset( | |||
S, ((*ParamItr++))->getOriginalType(), ParamDREs[3])); | |||
// kernel_obj.accessor.__init(_ValueType*, range<int>, range<int>, | |||
// id<int>) | |||
// [kenrel_obj or wrapper object].accessor.__init(_ValueType*, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kenrel_obj
?
* remove duplicated files; * mark test unsupported if it requires level_zero headers and the headers are not availble.
…… (#67069) We noticed some performance issue while in lldb-vscode for grabing the name of the SBValue. Profiling shows SBValue::GetName() can cause synthetic children provider of shared/unique_ptr to deference underlying object and complete it type. This patch lazily moves the dereference from synthetic child provider's Update() method to GetChildAtIndex() so that SBValue::GetName() won't trigger the slow code path. Here is the culprit slow code path: ``` ... frame #59: 0x00007ff4102e0660 liblldb.so.15`SymbolFileDWARF::CompleteType(this=<unavailable>, compiler_type=0x00007ffdd9829450) at SymbolFileDWARF.cpp:1567:25 [opt] ... frame #67: 0x00007ff40fdf9bd4 liblldb.so.15`lldb_private::ValueObject::Dereference(this=0x0000022bb5dfe980, error=0x00007ffdd9829970) at ValueObject.cpp:2672:41 [opt] frame #68: 0x00007ff41011bb0a liblldb.so.15`(anonymous namespace)::LibStdcppSharedPtrSyntheticFrontEnd::Update(this=0x000002298fb94380) at LibStdcpp.cpp:403:40 [opt] frame #69: 0x00007ff41011af9a liblldb.so.15`lldb_private::formatters::LibStdcppSharedPtrSyntheticFrontEndCreator(lldb_private::CXXSyntheticChildren*, std::shared_ptr<lldb_private::ValueObject>) [inlined] (anonymous namespace)::LibStdcppSharedPtrSyntheticFrontEnd::LibStdcppSharedPtrSyntheticFrontEnd(this=0x000002298fb94380, valobj_sp=<unavailable>) at LibStdcpp.cpp:371:5 [opt] ... frame #78: 0x00007ff40fdf6e42 liblldb.so.15`lldb_private::ValueObject::CalculateSyntheticValue(this=0x000002296c66a500) at ValueObject.cpp:1836:27 [opt] frame #79: 0x00007ff40fdf1939 liblldb.so.15`lldb_private::ValueObject::GetSyntheticValue(this=<unavailable>) at ValueObject.cpp:1867:3 [opt] frame #80: 0x00007ff40fc89008 liblldb.so.15`ValueImpl::GetSP(this=0x0000022c71b90de0, stop_locker=0x00007ffdd9829d00, lock=0x00007ffdd9829d08, error=0x00007ffdd9829d18) at SBValue.cpp:141:46 [opt] frame #81: 0x00007ff40fc7d82a liblldb.so.15`lldb::SBValue::GetSP(ValueLocker&) const [inlined] ValueLocker::GetLockedSP(this=0x00007ffdd9829d00, in_value=<unavailable>) at SBValue.cpp:208:21 [opt] frame #82: 0x00007ff40fc7d817 liblldb.so.15`lldb::SBValue::GetSP(this=0x00007ffdd9829d90, locker=0x00007ffdd9829d00) const at SBValue.cpp:1047:17 [opt] frame #83: 0x00007ff40fc7da6f liblldb.so.15`lldb::SBValue::GetName(this=0x00007ffdd9829d90) at SBValue.cpp:294:32 [opt] ... ``` Differential Revision: https://reviews.llvm.org/D159542
Current implementation supports only the cases when captured accessor
is a top level object. But accessors could be wrapped to some classes.
Frontend should properly handle this case and intialize accessors using
appropriate kernel parameters.
Signed-off-by: Artur Gainullin artur.gainullin@intel.com