- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If I try
double* ptr1; double* ptr2; __assume_aligned(ptr1, 64); __assume_aligned(ptr2, 64); #pragma simd for (int i=0; i<n; ++i) ptr1 = ptr2;
it will vectorise the loop with aligned access, but gives a warning that #pragma simd is deprecated.
If I swap "simd" for "vector aligned", it does not vectorise and the optimisation report says "use the simd directive".
The documentation for #pragma simd (https://software.intel.com/en-us/cpp-compiler-developer-guide-and-reference-simd) doesn't mention deprecation or any alternatives.
Is there any documentation/articles that tells us how we are supposed to do this these days?
- Tags:
- CC++
- Development Tools
- General Support
- Intel® C++ Compiler
- Intel® Parallel Studio XE
- Intel® System Studio
- Optimization
- Parallel Computing
- Vectorization
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
You can follow this link which will help to understand including SIMD in your codes.
I hope it will solve your problem.
-Abhishek
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Can you please send us the details of the compiler which you are using?
-Abhishek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Abhishek,
I am using:
Microsoft Visual Studio Community 2017 Version 15.9.18
VisualStudio.15.Release/15.9.18+28307.960
Intel® Parallel Studio XE 2019 Update 5 Composer Edition for C++ Windows* Package ID: w_comp_lib_2019.5.281
Intel® Parallel Studio XE 2019 Update 5 Composer Edition for C++ Windows* Integration for Microsoft* Visual Studio* 2017, Version 19.0.6.15
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
You can follow this link which will help to understand including SIMD in your codes.
I hope it will solve your problem.
-Abhishek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
At issue here is the pointers you have declared may overlap with respect the SIMD vector width. Use of #pragma simd stated "you don't care if they overlap, vectoreize regardless of possibility of overlapping". What you need is a means of assuring the compiler that these pointers will not point to memory that will overlap when used by a vector read from one, operator, vector write to the other. For this, there is the restrict keyword.
double* restrict ptr1; // *** or __restrict depending on compiler vendor and/or option double* restrict ptr2; // *** or __restrict depending on compiler vendor and/or option __assume_aligned(ptr1, 64); __assume_aligned(ptr2, 64); for (int i=0; i<n; ++i) ptr1 = ptr2;
Note, the availability of the restrict keyword may depend upon the choice of C++ standard selection or other compiler option.
https://software.intel.com/en-us/cpp-compiler-developer-guide-and-reference-restrict-qrestrict
Additionally, see: https://en.wikipedia.org/wiki/Restrict and https://gcc.gnu.org/onlinedocs/gcc/Restricted-Pointers.html
You may need to use __restrict, __restrict__, __declspec(restrict)
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you can try to use "#pragma omp simd" instead of "#pragma simd".
Vladimir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks guys,
The documentation link was what I was looking for - searching the Intel web-site produced great articles from 2013 and prior, but I had no idea what was currently recommended practice.
Jim's restrict option makes the most sense to me, but it drives Intellisense and Resharper crazy, even though it compiles and works.
So I will switch to Vladimir's omp simd for now and hope VS catches up with restrict.
Thanks again
Roger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, Roger for your confirmation can we close this thread?
You are always welcome to post a new thread if you have any issues.
-Abhishek

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page