Intel® Optimized AI Frameworks
Receive community support for questions related to PyTorch* and TensorFlow* frameworks.

__m512i array

lin__chiungliang
Beginner
1,677 Views

I'm trying to write code by VNNI

There is a data type - __m512i

which I think is mapping to registers on CPU.

I'd like to locate an array of registers

Here is the code

#include <immintrin.h>
int main()
{
        const int size = 5;

        __m512i zero[size];

        for(int i=0; i<size; i++)
        {
                zero = _mm512_setzero_si512();
        }

        return 0;
}

It works.

But when I try dynamic allocate memory

It doesn't work

#include <immintrin.h>
int main()
{
        const int size = 5;

        __m512i *zero = new __m512i[size];

        for(int i=0; i<size; i++)
        {
                zero = _mm512_setzero_si512();
        }

        delete [] zero;

        return 0;
}

Is there any way to create registers dynamically?

Lot of thanks

BR,

chiungliang

0 Kudos
7 Replies
ArunJ_Intel
Moderator
1,677 Views

Hi Chiungliang

We are forwarding your case to SME  to check.

 


Arun Jose

0 Kudos
lin__chiungliang
Beginner
1,677 Views

Hi,

Is there any update?

 

chiungliang

0 Kudos
Louie_T_Intel
Moderator
1,677 Views

Hi 

Before we dive into this intrinsic question, can you explain why you mention VNNI here?

the intrinsic call may not involve VNNI instruction like vpdpbusd.

For VNNI intrinsic function, you can refer below wiki for detail.

https://en.wikichip.org/wiki/x86/avx512vnni

 

 

0 Kudos
lin__chiungliang
Beginner
1,677 Views

Hi,

I tried to do MAC operation, and the first step is to reset registers.

Here is the code of the first step only.

Since I want to introduce "batch", which is defined as "the number of reused time", in my code.

I'd like to allocate registers dynamically.

0 Kudos
Louie_T_Intel
Moderator
1,677 Views

Hi chiungliang

sorry for late response.

this question is more related to general compiler issue, and it would be better to let our compiler experts to answer this question.

This forum can help on DL libraries and framework related questions, but you should get better support for intrinsic programming in compiler forum.

Would you mind posting the same question in below forum?

https://software.intel.com/en-us/forums/intel-c-compiler

 

thanks

 

0 Kudos
lin__chiungliang
Beginner
1,677 Views

Ok, I have posted the question in the forum.

0 Kudos
ArunJ_Intel
Moderator
1,677 Views

Closing this case as it is adressed in intel-c-compiler forum. Link to question is given below

https://software.intel.com/en-us/forums/intel-c-compiler/topic/849942

 

0 Kudos
Reply