Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

svml intrinsics ldexp

Andy0
Beginner
439 Views

Hi, I can't  find the ldexp svml calling convention in the intel intrinsics guide.  The vector versions of the function were easy to determine, but I can't get the scalar versions (ie __svml_ldexpf1 and __svml_ldexp) to work.  Maybe easiest would be to start posting the associated header file?  I'm looking at 2022.1.0, but as new functions are added it would be helpful to see the header for future versions.

 

Thanks!

0 Kudos
10 Replies
HemanthCH_Intel
Moderator
388 Views

Hi,

 

Thanks for posting in Intel Communities.

 

>>" I can't find the ldexp svml calling convention in the intel intrinsics guide."

All intrinsics will start with the __mm. Short Vector Math Library(SVML) are present in the math library in this path "/opt/intel/oneapi/compiler/2022.1.0/linux/compiler/include". You can use (_svml_ldexpf1 and __svml_ldexp) functions directly and present in the libsvml.a file as shown in below screenshot.

HemanthCH_Intel_0-1655448083646.png

 

For more information refer to the below link:

https://www.intel.com/content/www/us/en/develop/documentation/oneapi-dpcpp-cpp-compiler-dev-guide-an...

 

Thanks & Regards,

Hemanth

 

Andy0
Beginner
365 Views

Thanks for the information.

Maybe I'm missing a toolkit, I just have the base compiler installed which provides libsvml.a, but I can't find anything relevant in the include folder. The calling convention of the scalar form of that function is what I'm interested in - specifically the integer argument. Can you provide the function definition, or list the .h or toolkit I need?

HemanthCH_Intel
Moderator
341 Views

Hi,


>>"but I can't find anything relevant in the include folder."

SVML functions definitions are included in "Math.h" which can be found in "/opt/intel/oneapi/compiler/2022.1.0/linux/compiler/include" folder which is apart of Intel oneAPI HPC Toolkit. you can use the _svml_ldexpf1 and __svml_ldexp functions.


Thanks & Regards,

Hemanth.


Andy0
Beginner
306 Views

Hi, math.h includes some forms of ldexp, but could you just tell me the call signature for __svml_ldexpf1 and / or __svml_ldexp?

Thanks!

HemanthCH_Intel
Moderator
256 Views

Hi,


We are working on your issue internally and will get back to you soon.


Thanks & Regards,

Hemanth


Viet_H_Intel
Moderator
249 Views

The calling conventions are the same with standard math functions.

But, I don't think you need to call __slvm_ldexp explicitly.

If you have code:

double a, b;

int c;

a = 10.5

b= 5;

c = ldexp(a,b);

[ do something with c]


And compile:

$ icx -fimf-use-svml=true:ldexp t.c -O2

$

Then the compiler would replace ldexp() with the optimized __svml_ldexp() one.


Thanks,



Andy0
Beginner
153 Views

Thanks, but I'd like to have the option to call the svml version directly at times.

I have had no issues calling any of the packed or scalar versions of the svml routines, except for this one.

For example, if I compare svml & math from C:

double __svml_cos1(double a);
double __svml_ldexp1(double a, int b);

int main() {
double a, c1, c2;
int b = 2;
a = 10.5;
c1 = __svml_ldexp1(a,b);
c2 = ldexp(a,b);
//c1 = __svml_cos1(a*b);
//c2 = cos(a*b);
printf("c1: %f, c2: %f\n",c1, c2);
return(0);
}

The cos variant works perfectly, but the ldexp version returns "c1: inf, c2: 42.000000".

Hopefully that's enough detail to describe the problem I'm encountering.

Viet_H_Intel
Moderator
188 Views

Let us know if you have any other questions. If not, we would like to close this thread.

Thanks,


Viet_H_Intel
Moderator
143 Views

I worked with our math library and was advised that "it is absolutely not encouraged to call SVML functions directly. SVML is internal Intel Compiler library and only Compiler is allowed to call SVML. SVML is not a separate product, it is a part of Intel Compiler. SVML has custom API/ABI which is not exposed to public." Hence, please don't use it directly.


Thanks,


Viet_H_Intel
Moderator
108 Views

Hi Andy,


We won't monitor this thread any more. If you have any other questions/concerns, please create a new thread.


Thanks,


Reply