Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

3D transformations - matrix multiplication

Anonymous
Not applicable
1,831 Views

Will Intel create a single asm instruction packaging all instructions needed to do 3D transformation around XYZ axes ?

An entire 4×4 matrix can be stored inside a 512-bit register, thus a single instruction operating on two 512-bit registers can do the matrix multiplication as:

__m512 _mm512_mul_mat(__m512 MatA, __m512 MatB);

And same goes for the matrix vector multiplication:

__m128 _mm512_mul_matvec(__m512 Mat, __m512 Vec);

I actually do like this:

wqaxs36_0-1605360364910.png

wqaxs36_1-1605365886254.png

wqaxs36_2-1605360498861.pngwqaxs36_3-1605360518396.png

0 Kudos
1 Solution
PrasanthD_intel
Moderator
1,781 Views

Hi,

Thanks for reaching out us.

To my knowledge, there is no inbuilt functionality for matrix multiplication in Intrinsics and I will get back to you after contacting the internal team whether a new feature to be implemented or and if there is an existing function.


Meanwhile could you please try MKL (Intel math kernel library) which supports several math operations and also highly optimized.

To get started with MKL please refer the following article: https://software.intel.com/content/www/us/en/develop/documentation/get-started-with-mkl-for-windows/top.html



Regards

Prasanth


View solution in original post

7 Replies
Anonymous
Not applicable
1,825 Views

Mistake, it's __m128 _mm512_mul_matvec(__m512 Mat, __m128 Vec); instead

0 Kudos
PrasanthD_intel
Moderator
1,782 Views

Hi,

Thanks for reaching out us.

To my knowledge, there is no inbuilt functionality for matrix multiplication in Intrinsics and I will get back to you after contacting the internal team whether a new feature to be implemented or and if there is an existing function.


Meanwhile could you please try MKL (Intel math kernel library) which supports several math operations and also highly optimized.

To get started with MKL please refer the following article: https://software.intel.com/content/www/us/en/develop/documentation/get-started-with-mkl-for-windows/top.html



Regards

Prasanth


jimdempseyatthecove
Honored Contributor III
1,776 Views

3D modeling is more often better performed using Structure of Arrays than using Array of Structures.

struct AoS_t
{
  int N;
  Single *X, *Y, *Z, *W; // cache align allocation
  bool Alloc(int _N);
};
...
AoS_t Bodies;

Then depending on CPU instruction set, The operations (*,/,+,-) are performed on the individual properties of 4, 8 or 16 bodies with each operation. This generally exhibits higher performance when operating on large number of bodies (particles).

Jim Dempsey

jimdempseyatthecove
Honored Contributor III
1,772 Views

I forgot to mention...

In your sample code in post #1 (AoS), you have two horizontal add instructions followed by a scalar store (for a single particle). In the SoA modeling, you would eliminate those two horizontal adds, and follow it with a vector store (for 4, 8 or 16 particles).

Jim Dempsey

Viet_H_Intel
Moderator
1,748 Views

As Prasanth mentioned we currently don't have an intrinsic that does what you are looking for. I've opened a feature request with our development team.

Thanks,


Viet_H_Intel
Moderator
1,494 Views

Hi,

 

My request was not accepted. Thus, we won't have this intrinsic implementation in our compilers. 

 

Thanks,

 

0 Kudos
PrasanthD_intel
Moderator
1,414 Views

Hi,


Thank you for sending us your Feature Request for the Intel Compilers. We have been reviewing older requests such as yours. However, we have decided to close this issue at this time since it is clear that we will not be implementing this particular request in the near future. Your request will be kept on record in our database. We will continue to review this request and all other feature requests each year during planning for the next major release compilers. Your feedback and suggestions are important to us. Thank you for sending us this request to improve our product.


Regards

Prasanth


0 Kudos
Reply