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

Unable to disable FMA instruction on an Itanium II system

Raghu_Reddy
Beginner
741 Views
I would like to disable generation of FMA instructions for testing on an Itanium II system. The version of the compiler that I'm using is:

% icc -v
Version 10.1
%

% icc -IPF-fma -S zfft1d.c
% grep fma zfft1d.s

zfft1d.s zfft1d.s-fma zfft1d.s-nofma

% grep fma zfft1d.s | head

// mark_description "-IPF-fma -S";

(p15)fma.s1 f13=f7,f32,f0 //6: {286:5} 263

(p15)fma.s1 f9=f14,f14,f35 //10: {286:5} 266

(p15)fma.s1 f10=f14,f13,f13 //10: {286:5} 265

(p15)fma.s1 f32=f9,f10,f10 //14: {286:5} 267

(p12)fma.s1 f7=f6,f12,f0 //15: {285:5} 290

(p12)fma.s1 f33=f8,f8,f34 //19: {285:5} 293

(p12)fma.s1 f6=f8,f7,f7 //19: {285:5} 292

(p12)fma.s1 f12=f33,f6,f6 //23: {285:5} 294

fma.d.s1 f9=f10,f1,f0 //10: {313:5} 1009

%

What is the best way to disable generation of FMA instructions?
Thanks

0 Kudos
3 Replies
TimP
Honored Contributor III
741 Views
Your -IPF-fma specifically asks for optimized fma. Certain options "disable" fma, such as -fp-model source. Of course, you are still using fma instructions, but performing add by multiply by 1. followed by add, and multiply by following multiply by adding 0.
I don't think we could know what is best for you, but you might try looking at the docs.
People who haven't tried it tend to claim that fma will always yield big increases in performance (much more than what you are likely to see if you actually test it).
0 Kudos
Raghu_Reddy
Beginner
741 Views
My apologies, I accidentally pasted the wrong section from the screen.I did use -no-IPF-fma to disable fma.

Since I was doinga grep for fma in the assembly file with and without this option, I figured it was not being disabled. After seeing your explanation I see that I see what is happening. Thanks!

0 Kudos
Raghu_Reddy
Beginner
741 Views
If I may follow up on this, I took a very simple matrix multiply kernel and experimented with and without the FMA option and I did not see much difference. Any suggestions on how I can check if I have actually disabled FMA?

The basic code is:

do 30 k=1,n

do 20 j=1,n

do 10 i=1,n

a(i,k)=a(i,k)+b(i,j)*c(j,k)

10 continue

20 continue

30 continue

My session window is:

pople4700% ifort -no-IPF-fma -o mxm-nofma mxm_omp.f

pople4700% ifort -IPF-fma -o mxm-fma mxm_omp.f

pople4700%

pople4700% ./mxm-fma

mulijk - n= 1024 a(1,1) = 2048.00 elapsed = 1.38590 rate = 1549.52

pople4700%

pople4700% ./mxm-nofma

mulijk - n= 1024 a(1,1) = 2048.00 elapsed = 1.38420 rate = 1551.43

pople4700%

Any suggestions on how I can best to verify the impact of FMA? I can include the entire code (it is fairly trivial) if you want to replicate this exact problem.

Thanks!

0 Kudos
Reply