Intel® oneAPI DPC++/C++ Compiler
Talk to fellow users of Intel® oneAPI DPC++/C++ Compiler and companion tools like Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and Intel® Distribution for GDB*

why local_accessor does not seem to work.

NewtonDynamics
New Contributor I
1,996 Views

I am trying to create a local share memory buffer, and sycl::accessor constructor say that the local option is deprecated and say to use local_accesor.

local __SYCL2020_DEPRECATED("use `local_accessor` instead") = 2016,

but local_accessor class doesn't even compile. for what I can see it has not constructor, 

I try many different combinations of parameters, none compiled. 

 

 

 

		range<1> xxxxx(D_COUNTING_SORT_LOCAL_BLOCK_SIZE);
		handler.parallel_for_work_group(workGroupCountRange, workGroupSizeRange, [=](group<1> group)
		{
			// make local shared memory buffers
			//sycl::local_accessor<unsigned, 1, sycl::access::mode::read_write, sycl::access::target::local> cacheSortedKey(D_COUNTING_SORT_LOCAL_BLOCK_SIZE, handler);
			
			//sycl::local_accessor<unsigned> cacheSortedKey(xxxxx, handler);
			sycl::accessor<unsigned, 1, sycl::access::mode::read_write, sycl::access::target::local> cacheSortedKey(xxxxx, handler);
			//sycl::local_accessor<unsigned, 1> cacheSortedKey(xxxxx, handler);

 

 

 

so how can I use local shared memory in a code block that look like the on below

 

 

 

handler.parallel_for_work_group(workGroupCountRange, workGroupSizeRange, [=](group<1> group)
{
        // some shared memory buffer here,
        ...
        ...
        group.parallel_for_work_item([&](h_item<1> item)
	{
	});
}
	

 

 

I am going by the krohnos doc file:

https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#subsec:accessors

 it states this: 

To allocate local memory within a kernel, the user can either pass a sycl::local_accessor object as a argument to an ND-range kernel (that has a user-defined work-group size), or can define a variable in work-group scope inside sycl::parallel_for_work_group.

Any variable defined inside a sycl::parallel_for scope or sycl::parallel_for_work_item scope will be allocated in private memory. Any variable defined inside a sycl::parallel_for_work_group scope will be allocated in local memory.

 

 

Thanks.

 

0 Kudos
3 Replies
SeshaP_Intel
Moderator
1,943 Views

Hi,

 

Thank you for posting in Intel Communities.

Please try with the below local_accessor command, as 'target::local' is deprecated.

local_accessor<unsigned, 1> cacheSortedKey(xxxxx, handler);

 

Please refer to the Intel oneAPI DPC++/C++ compiler release notes link below.

https://www.intel.com/content/www/us/en/developer/articles/release-notes/intel-oneapi-dpc-c-compiler-release-notes.html#:~:text=Added%20support%20for%C2%A0local_accessor.%20Deprecated%C2%A0target%3A%3Alocal.

 

Could you please try it on your end and let us know if you face any issues?

 

Thanks and Regards,

Pendyala Sesha Srinivas

0 Kudos
NewtonDynamics
New Contributor I
1,918 Views

ah thank, I actually discovered that last Sunday.

 

after typing like this

sycl::accessor<T, 1> srcAccessor(src, handler);
sycl::accessor<int, 1> scanAccessor(scansBuffer, handler);
sycl::local_accessor<int, 1> counters(D_COUNTING_SORT_LOCAL_BLOCK_SIZE, handler);

It compiles fine, 

I learned that I can no realize on default template parameters, 

It is my own fault, since I never use default parameters for anything on any code I write, 

but here I am. 

 

thank you very much. 

0 Kudos
SeshaP_Intel
Moderator
1,894 Views

Hi,


Glad to know that your issue is resolved. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.


Thanks and Regards,

Pendyala Sesha Srinivas


0 Kudos
Reply