Intel® Optimized AI Frameworks
Get community support for questions related to PyTorch* and TensorFlow* frameworks.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

__m512i array

lin__chiungliang
Beginner
506 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
506 Views

Hi Chiungliang

We are forwarding your case to SME  to check.

 


Arun Jose

lin__chiungliang
Beginner
506 Views

Hi,

Is there any update?

 

chiungliang

Louie_T_Intel
Moderator
506 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

 

 

lin__chiungliang
Beginner
506 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.

Louie_T_Intel
Moderator
506 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

 

lin__chiungliang
Beginner
506 Views

Ok, I have posted the question in the forum.

ArunJ_Intel
Moderator
506 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

 

Reply