-
Notifications
You must be signed in to change notification settings - Fork 787
Add basic xmethod impl for accessor.operator[] #821
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
Add basic xmethod impl for accessor.operator[] #821
Conversation
Who we can test that we are in sync with the script? |
To simplify dependencies I think it should be possible to load this with upstream 8.3 GDB and test with a host device. This is one of snippets we use in the debugger test suite: struct user_type
{
int x;
};
int
main (int argc, char *argv[])
{
user_type data_in[2][2][2]
= { { { 1, 2 }, { 3, 4 } }, { { 5, 6 }, { 7, 8 } } };
user_type data_out[2][2][2];
{
cl::sycl::queue queue;
cl::sycl::buffer<user_type, 3> buffer_in
= { &data_in[0][0][0], cl::sycl::range<3> { 2, 2, 2 } };
cl::sycl::buffer<user_type, 3> buffer_out
= { &data_out[0][0][0], cl::sycl::range<3> { 2, 2, 2 } };
queue.submit ([&] (cl::sycl::handler &cgh)
{
auto input = buffer_in.get_access<cl::sycl::access::mode::read> (cgh);
auto output = buffer_out.get_access<cl::sycl::access::mode::write> (cgh);
cgh.single_task<class simple_kernel> ([=] ()
{
auto id = cl::sycl::id<3> (0, 0, 0);
output[id] = input[id];
user_type dummy = input[id]; /* kernel-line */
});
});
}
return 0;
} The test case itself is to break at the commented line and verify that Any suggestions how would it be better to integrate it with the compiler tests? |
Not sure it's good idea, but one of the option is to check that required accessor class methods and members are available in AST or IR. |
That should cover the issue of private fields but there will still be a potential desync of index calculation logic (https://github.com/intel/llvm/pull/821/files#diff-fbcdb91c2b27b0fe5eec1ccff6432ed1R29-R34) which I was warned about. |
Anyway, I will go with whatever approach you prefer. As long as this is not merged and we use gdb internal copy, it remains a ticking time bomb that is going to explode one release or another. |
@bader Do you have any idea how we can test it? |
3d0dbea
to
c208229
Compare
Ping |
I don't know. Eventually we might place this script to https://github.com/intel/llvm/tree/sycl/lldb/scripts and test it as part of lldb, but today, it is an overkill for this project. @mihails-strasuns-intel, are you going to be the primary maintainer of this script? |
Correct. I know nothing about the current CI setup here, but would it be that hard to simply run a shell script which calls host-installed gdb and checks the result status? We don't really need any fancy test suite facilities here, just a sanity check. |
We can't rely that test system has "host-installed gdb", so we need some the logic that skips the test if required dependencies are not present. |
But will there be at least one that is guaranteed to have it? If yes, that should be sufficient and all others can ignore the check indeed. |
As of today, there are no plans to provide such guarantees. I think we should apply Vlad's suggestion on checking SYCL accessors internal member names. Also you mentioned in the description that we should distribute this script with the compiler, so I suggest adding CMake logic for deploying the script. |
8d078d0
to
792a599
Compare
Sure. Can you please give some directions where to look?
Will something like 792a599 be sufficient? |
Ping |
@romanovvlad, could you elaborate on your proposal, please?
@vladimirlaz, could your confirm, please? |
Idea is to check that AST for some simple source code that use accessor on device side contains expected structure of accessor class[es] and expected names of the fields. See clang/test/AST/pragma-attribute-cxx-subject-match-rules.cpp which does similar things. |
Sorry for the delay, has to switch to other issues for a while :/
I need more help with this, as there doesn't seem to be a way to express a structured AST query with FileCheck. Consider trying to enforce presence of #include <CL/sycl/accessor.hpp>
// CHECK: CXXRecordDecl {{.*}} class accessor definition
// CHECK: FieldDecl {{.*}} referenced impl 'detail::AccessorImplDevice<AdjustedDim>' Is there any way to ensure that the |
Ping |
792a599
to
7160d25
Compare
Can you use substitution blocks to associate Another option to try:
|
Don't see how substitution may help here. The latter option may work in practice if you are fine with some false positives - i.e. it will wrongly fail if a nested struct definition will be added inside Will give it a try. |
Done, tested with |
Intended to address templated function/operator debugging problem in GDB. The added script is the currently used implementation in our gdb - it only covers single-index `accessor.operator[]` with multiple dimensions, that may be extended in the future depending on user experience requirements. It is much desirable to distribute this as part of compiler package because it depends on private implementation details of SYCL headers and must always be strictly in sync. Signed-off-by: Mihails Strasuns <[email protected]>
7160d25
to
a4a0535
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.
LGTM.
@AlexeySachkov Could you please take a look as well?
@AlexeySachkov ping |
LGTM |
Can please someone send me AST dump for |
Not sure it will be easy to find a person who works on windows :) |
a4a0535
to
494da35
Compare
In that case I will simply disable this test for Windows - debugger does not use xmethods for that platform and if dev setup is not common either, it will only end up being a maintenance burden. |
Ok, you can do it by adding something like this: |
494da35
to
a01f049
Compare
Updated. |
Signed-off-by: Mihails Strasuns <[email protected]>
Green! |
Thanks! |
Intended to address templated function/operator debugging problem in
GDB. The added script is the currently used implementation by our gdb
accessor.operator[]
with multipledimensions, that may be extended in the future depending on user
experience requirements.
It is much desirable to distribute this as part of compiler package
because it depends on private implementation details of SYCL headers and
must always be strictly in sync.
Signed-off-by: Mihails Strasuns [email protected]