Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Ralf_K_
Beginner
97 Views

ippSetCpuFeatures IPP8.2 Update 1

i want to make some performance measurement, but ippSetCpuFeatures seems not to work on my machine

 

i get always a ippStsFeatureNotSupported

even if i use

IppGetCpuFeatures

to request the feature mask and pass the unmodified mask to

ippSetCpuFeatures

PX_FM (3)  is the only value which works for ippSetCpuFeatures

Any ideas?

Ralf

 

 

0 Kudos
4 Replies
Igor_A_Intel
Employee
97 Views

Hi Ralf, please provide a reproducible and info on your CPU (an output from GetCpuFeatures or from CPU-Z). regards, Igor
Ralf_K_
Beginner
97 Views

I tried to provide reproducable code, but with this code everything works fine:

#include "stdafx.h"

 #define PX_FM ( ippCPUID_MMX | ippCPUID_SSE )
 #define W7_FM ( PX_FM | ippCPUID_SSE2 )
 #define V8_FM ( W7_FM | ippCPUID_SSE3 | ippCPUID_SSSE3 )
 #define S8_FM ( V8_FM | ippCPUID_MOVBE )
 #define P8_FM ( V8_FM | ippCPUID_SSE41 | ippCPUID_SSE42 | ippCPUID_AES | ippCPUID_CLMUL | ippCPUID_SHA )
 #define G9_FM ( P8_FM | ippCPUID_AVX | ippAVX_ENABLEDBYOS | ippCPUID_RDRAND | ippCPUID_F16C )
 #define H9_FM ( G9_FM | ippCPUID_AVX2 | ippCPUID_MOVBE | ippCPUID_ADCOX | ippCPUID_RDSEED | ippCPUID_PREFETCHW )

int _tmain(int argc, _TCHAR* argv[])
{
    printf("PX_FM %i \n", PX_FM);
    printf("W7_FM %i \n", W7_FM);
    printf("V8_FM %i \n", V8_FM);
    printf("S8_FM %i \n", S8_FM);
    printf("P8_FM %i \n", P8_FM);
    printf("G9_FM %i \n", G9_FM);
    printf("H9_FM %i \n", H9_FM);
    printf("\n");

    ippInit();
    
    Ipp64u FeaturesMask;
    Ipp32u  pCpuidInfoRegs[4];
    IppStatus ippStatus;

    ippStatus = ippGetCpuFeatures(&FeaturesMask, pCpuidInfoRegs);
    printf("Get Features=%i ippStatus=%i\n", FeaturesMask, ippStatus);


    ippStatus = ippSetCpuFeatures(FeaturesMask);

    printf("Set Features=%i ippStatus=%i\n", FeaturesMask, ippStatus);

    FeaturesMask = 3;

    ippStatus = ippSetCpuFeatures(FeaturesMask);

    printf("Set Features=%i ippStatus=%i\n", FeaturesMask, ippStatus);


    FeaturesMask = G9_FM;
    ippStatus = ippSetCpuFeatures(FeaturesMask);
    printf("Set Features=%i ippStatus=%i\n", FeaturesMask, ippStatus);

    FeaturesMask = W7_FM;
    ippStatus = ippSetCpuFeatures(FeaturesMask);
    printf("Set Features=%i ippStatus=%i\n", FeaturesMask, ippStatus);

    FeaturesMask = V8_FM;
    ippStatus = ippSetCpuFeatures(FeaturesMask);
    printf("Set Features=%i ippStatus=%i\n", FeaturesMask, ippStatus);

    FeaturesMask = S8_FM;
    ippStatus = ippSetCpuFeatures(FeaturesMask);
    printf("Set Features=%i ippStatus=%i\n", FeaturesMask, ippStatus);

    FeaturesMask = P8_FM;
    ippStatus = ippSetCpuFeatures(FeaturesMask);
    printf("Set Features=%i ippStatus=%i\n", FeaturesMask, ippStatus);

    FeaturesMask = G9_FM;
    ippStatus = ippSetCpuFeatures(FeaturesMask);
    printf("Set Features=%i ippStatus=%i\n", FeaturesMask, ippStatus);

    FeaturesMask = H9_FM;
    ippStatus = ippSetCpuFeatures(FeaturesMask);
    printf("Set Features=%i ippStatus=%i\n", FeaturesMask, ippStatus);

    for (;;);

    return 0;
}

 

The code where the issue exits is to complex to provide here.

The difference in the code with the issue is, that i build a Windows DLL where i have exported ippGetCpuFeatures.and ippSetCpuFeatures, as i did it with many other Ipp Functions.

The DLL is used in Delphi code :

  TIppGetCpuFeatures=function(var FeatureMask:UInt64;pCpuidInfoRegs:Pointer):Integer;stdcall;
  TIppSetCpuFeatures=function(cpuFeatures:UInt64):Integer;stdcall;

...

  ippStatus:=IppGetCpuFeatures(FeatureMask,@CpuInfoRegs[0]);

  ippStatus:=IppSetCpuFeatures(FeatureMask); //fails with 50
  ippStatus:=IppSetCpuFeatures(PX_FM); //success
  ippStatus:=IppSetCpuFeatures(W7_FM); //fails  with 49
  ippStatus:=IppSetCpuFeatures(V8_FM); //fails with 49

//i get success for W7_FM, if i modify the code like this 

  ippStatus:=IppGetCpuFeatures(FeatureMask,@CpuInfoRegs[0]);
  ippStatus:=IppSetCpuFeatures(FeatureMask); //fails with 50
  ippStatus:=IppSetCpuFeatures(W7_FM); //sucess
  ippStatus:=IppSetCpuFeatures(V8_FM); //fails with 49

 

//i get success for V8_FM, if i modify the code like this 

  ippStatus:=IppGetCpuFeatures(FeatureMask,@CpuInfoRegs[0]);
  ippStatus:=IppSetCpuFeatures(FeatureMask); //fails with 50
  ippStatus:=IppSetCpuFeatures(V8_FM); //sucess

The DLL i use is Single-threaded Static Library 32Bit. 

 

Igor_A_Intel
Employee
97 Views

Ralf,

it's impossible to set some diagnose based on your description only.  This status is returned in the next situation:

   mask = cpuFeatures;
   realTmp = realFeatures;
   while( 0 < mask ){
       if( 0 < ( mask & 1 )){
           if( 0 == ( realTmp & 1 )){
                ownstatus = ippStsFeatureNotSupported;
                break;
           }
       }
       mask = mask >> 1;
       realTmp = realTmp >> 1;
   }

where "cpuFeatures" is just the parameter you've passed to SetCpuFeatures() and "realFeatures" is what has been returned by GetCpuFeatures(). So you see that this status can't be returned in case you pass the result of GetCpuFeatures() to SetCpuFeatures(). I guess that problem is in some different place. I can't set different diagnose without having an access to your application under debugger.

regards, Igor
 

Fu__Yu
Beginner
97 Views

Hi!

Currently I am doing some benchmark comparing the time usage between enable / disable the AVX / AVX2 / SSE. And I found there is no remakable defference for some math function such as add & multiply. I switch the flag by manually change the cpu variable and call function: ippSetCpuFeatures. Is it reasonable or not?

 status = ippGetCpuFeatures(&mask, 0);
  // chage instruction flag
  //ippCPUID_MMX
  printf("\nBefore set ippCPUID_MMX:      %c\t%c\t", (mask & ippCPUID_MMX) ? 'Y' : 'N', (emask & ippCPUID_MMX) ? 'Y' : 'N');
  if (a = (mask & ippCPUID_MMX))
  {
   emask = (emask - ippCPUID_MMX);
  }
  printf("\nAfter set ippCPUID_MMX:     %c\t%c\t", (mask & ippCPUID_MMX) ? 'Y' : 'N', (emask & ippCPUID_MMX) ? 'Y' : 'N');
  ...
  IppSts = ippSetCpuFeatures(emask);
  if (IppSts == ippStsFeatureNotSupported || IppSts == ippStsUnknownFeature) //ippStsNoErr
  {
   wStatus = IppSts;
   goto EXIT;
  }

More detailed pls. refer to below.

Intel Xeon CPU E5-2650 V4 @ 2.2GHz
Image sz: 2048 * 2048
Unit of time: ms
Ipp version Instruction & Compiler setting Add   Multiply   SobelX&Y
    Integer
 (unsigned char)
Float Integer Float Integer
Ipp Origin (5.2) default 0.56 5.68 0.72 5.74 1.63
Ipp New (2018) AVX2 off + AVX off + SSE/MMX off 0.55 5.96 0.67 5.69 14.84
Ipp New (2018) AVX2 off + AVX off 0.56 5.99 0.62 5.68 4.50
Ipp New (2018) AVX2 off 0.56 6.04 0.58 5.70 4.49
Ipp New (2018) AVX2 on 0.56 5.84 0.57 5.61 2.99
Ipp New (2018) AVX2 on + VS AVX Compiler on 0.54 5.91 5.55 5.72 3.06
Ipp New (2018) AVX2 on + VS AVX2 Compiler on 0.55 5.85 0.55 5.67 2.98

Thanks & Regards,

FY

Reply