flat assembler
Message board for the users of flat assembler.

Index > Windows > AMD FMA4 how calculated dot product ?

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1701
Roman 29 Dec 2023, 07:16
I want finded fma instructions(something like as vfmadd213ps) for dot product.
xmm1 = 1,2,3,4
xmm2 = 5,5,5,5

dot product xmm1,xmm2 = 1*5+2*5+3*5+4*5 = 50
Post 29 Dec 2023, 07:16
View user's profile Send private message Reply with quote
macgub



Joined: 11 Jan 2006
Posts: 345
Location: Poland
macgub 29 Dec 2023, 16:54
As I make short research - there is no benefit using vfmaddXXX instructions for single dot product. After vertical multplcation you should perform horizontal addition.. You will use 2 more instruction like haddps as well.. Or shufle data and make 'standard' vertical addition..
..But if you compute array with dot products - FMA opens door to clever speed up and optimizing work..
As last words: I dont use FMA every day, moreover dont use at all, and maybye someone with more experience put you on right way...
.....
I tried display situation with xmm registers, ymm and zmm register - I think situation may be different.. (As a reminder: DPPS instruction was not promoted into >128bit registers)
Post 29 Dec 2023, 16:54
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.