Intel® oneAPI Base Toolkit
Support for the core tools and libraries within the base toolkit that are used to build and deploy high-performance data-centric applications.
419 Discussions

error: use of undeclared identifier '__assume_aligned'

gfichterpicometrix_c
4,232 Views

Is the clause __assume_aligned(x, y) deprecated in oneAPI?  This causes the error above, but seemed to be a valid statement in XE Compiler 19.2.

If it is still a valid clause, which section of the documention describes the correct usage?

Thanks, Greg

0 Kudos
1 Solution
6 Replies
ArpitaP_Intel
Moderator
4,212 Views

Hello Greg,

Thanks for reaching out to us.


assume_aligned(x,y) is not deprecated.

You can check the below link for further assistance

Function Annotations and the SIMD Directive for Vectorization (intel.com)

 

Can you please let us know by oneAPI which compiler are you referring?

The assume_aligned(x,y) works perfectly fine with icpc.

With icpx/dpcpp you can use  __builtin_assume_aligned (ptr, offset)

Eg : float* ax = (float*)__builtin_assume_aligned(x, 64);


or you can use __attribute__((assume_aligned(<alignment>[,<offset>])) on a function declaration to specify that the return value of the function (which must be a pointer type) has the specified offset, in bytes, from an address with the specified alignment. The offset is considered to be zero if omitted.


Regards,

Arpita


0 Kudos
gfichterpicometrix_c
4,195 Views

I am using icpc, and only seeing this error message when compiling within the Visual Studio 2019 environment.  Is there a declaration required for the Visual Studio environment to use this directive?

Thanks.

0 Kudos
ArpitaP_Intel
Moderator
4,166 Views

Hello Greg,


Basically, we do not need any directives included to use __assume_aligned(x, 64). You can try using __builtin_assume_aligned(x, 64) instead, because it does the same work.

May I know if you are using command line or the Visual Studio 2019 IDE . And also let me know if you have Intel oneAPI Base Toolkit or Intel oneAPI HPC Toolkit installed in your system? These inputs might help us in resolving the issue faster.


Regards,

Arpita


0 Kudos
gfichterpicometrix_c
4,161 Views
0 Kudos
ArpitaP_Intel
Moderator
4,135 Views

Hello Greg,


When we are compiling codes using Intel oneAPI DPC++ compiler, we can use __declspec(align(n)) prior to __assume_aligned(x,n).


There are various other ways to align data, you can follow the below link

https://software.intel.com/content/www/us/en/develop/documentation/oneapi-dpcpp-cpp-compiler-dev-guide-and-reference/top/optimization-and-programming-guide/vectorization/explicit-vector-programming/function-annotations-and-the-simd-directive-for-ve.html


While using __assume_aligned for C++ in Visual studio 2019 try switching to intel compiler i.e. Intel C++ compiler 19.2 .

You can do that by Right click on solution of project->Properties->General->Platform Toolset.

In the above case we can simply use __assume_align(a,n).


Please let us know if you require any other assistance from our side.


Regards,

Arpita


0 Kudos
ArpitaP_Intel
Moderator
4,097 Views

Hi,


Hope we were able to resolve your issue. If you need any additional information, please submit a new query as this thread will no longer be monitored.


Regards,

Arpita



0 Kudos
Reply