KseniyaTikhomirova wrote:

> @KseniyaTikhomirova,
> 
> > could you please clarify how arrays of local_accessors will be treated and 
> > passed to special_subobjects handling function?
> 
> Each array element will be passed as a separate argument. This is necessary, 
> in general, when the kernel object contains an array member with an element 
> type that has a member that requires reification.
> 
> ```c++
> struct S {
>   sycl::local_accessor<int> la;
> };
> void f(sycl::queue q) {
>   S s[2];
>   q.single_task<struct KN>([=] { s[0]; s[1]; });
> }
> ```
> 
> When the array element type is one that directly requires reification (e.g., 
> an array of `sycl::local_accessor`), we _could_ choose to pass a reference to 
> the array instead of each element individually. This would reduce the number 
> of arguments passed, but would mean that the function objects returned by 
> `sycl_kernel_launch()` and `sycl_reify_kernel_parameters()` would need to be 
> prepared to receive both references to single objects and references to 
> arrays. I suspect that added complexity isn't worthwhile, but let me know if 
> you feel otherwise.
> 
> Arrays aren't handled in the code at the moment; that is one of the things I 
> need to fix yet.

I think that passing elements individually is a clearer solution that proved 
itself in DPC++ as well. So I am ok with the planned design.

One more question. Can we have a guarantee that all subobjects passed to lambda 
are unique? I mean - no aliases to the same accessor so that we don't need to 
track them to decide if we need to skip object or to increase dynamic memory 
size. It seems this case was not properly handled in DPC++ by the way.

https://github.com/llvm/llvm-project/pull/243349
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to