Intel® oneAPI Data Parallel C++
Support for Intel® oneAPI DPC++ Compiler, Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and GDB*
Announcements
The Intel sign-in experience is changing in February to support enhanced security controls. If you sign in, click here for more information.

why local_accessor does not seem to work.

NewtonDynamics
New Contributor I
181 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
128 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....

 

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

 

Thanks and Regards,

Pendyala Sesha Srinivas

NewtonDynamics
New Contributor I
103 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. 

SeshaP_Intel
Moderator
79 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


Reply