请输入您要查询的百科知识:

 

词条 FMA instruction set
释义

  1. New instructions

  2. FMA3 instruction set

     CPUs with FMA3  Excerpt from FMA3 

  3. FMA4 instruction set

     CPUs with FMA4  Excerpt from FMA4 

  4. History

  5. Compiler and assembler support

  6. References

{{wikibooks|X86 Assembly/AVX, AVX2, FMA3, FMA4}}

The FMA instruction set is an extension to the 128 and 256-bit Streaming SIMD Extensions instructions in the x86 microprocessor instruction set to perform fused multiply–add (FMA) operations.[1] There are two variants:

  • FMA4 is supported in AMD processors starting with the Bulldozer architecture. FMA4 was realized in hardware before FMA3.
  • FMA3 is supported in AMD processors starting with the Piledriver architecture and Intel starting with Haswell processors and Broadwell processors since 2014.

New instructions

FMA3 and FMA4 instructions have almost identical functionality, but are not compatible. Both contain fused multiply–add (FMA) instructions for floating-point scalar and SIMD operations, but FMA3 instructions have three operands, while FMA4 ones have four. The FMA operation has the form d = round(a · b + c), where the round function performs a rounding to allow the result to fit within the destination register if there are too many significant bits to fit within the destination.

The four-operand form (FMA4) allows a, b, c and d to be four different registers, while the three-operand form (FMA3) requires that d be the same register as a, b or c. The three-operand form makes the code shorter and the hardware implementation slightly simpler, while the four-operand form provides more programming flexibility.

See XOP instruction set for more discussion of compatibility issues between Intel and AMD.

FMA3 instruction set

CPUs with FMA3

  • AMD
    • AMD introduced FMA3 support in processors starting with Piledriver architecture for compatibility reasons.[2] The 2nd generation APU processors based on "Trinity" (32nm) supporting FMA3 instructions were launched May 15, 2012. The 2nd generation Bulldozer processors with Piledriver cores supporting FMA3 instructions were launched October 23, 2012.
  • Intel
    • Intel introduced hardware FMA3 in processors based on Haswell during 2013.

Excerpt from FMA3

Mnemonic (AT&T) Operands Operation
VFMADD132PDyymm, ymm, ymm/m256a = a·c + b
VFMADD132PSy
VFMADD132PDxxmm, xmm, xmm/m128
VFMADD132PSx
VFMADD132SDxmm, xmm, xmm/m64
VFMADD132SSxmm, xmm, xmm/m32
VFMADD213PDyymm, ymm, ymm/m256a = b·a + c
VFMADD213PSy
VFMADD213PDxxmm, xmm, xmm/m128
VFMADD213PSx
VFMADD213SDxmm, xmm, xmm/m64
VFMADD213SSxmm, xmm, xmm/m32
VFMADD231PDyymm, ymm, ymm/m256a = b·c + a
VFMADD231PSy
VFMADD231PDxxmm, xmm, xmm/m128
VFMADD231PSx
VFMADD231SDxmm, xmm, xmm/m64
VFMADD231SSxmm, xmm, xmm/m32

FMA4 instruction set

CPUs with FMA4

  • AMD
    • "Heavy Equipment" processors
    • Bulldozer-based processors - was launched October 12, 2011.[3]
    • Piledriver-based processors [4]
    • Steamroller-based processors
    • Excavator-based processors (including "v2")
    • Zen: WikiChip's testing shows FMA4 still appears to work (under the conditions of the tests) despite not being officially supported and not even reported by CPUID. This has also been confirmed by Agner.[5] But other tests gave wrong results.[6] AMD Official Web Site FMA4 Support Note ZEN CPUs = AMD ThreadRipper 1900x, R7 Pro 1800, 1700, R5 Pro 1600, 1500, R3 Pro 1300, 1200, R3 2200G, R5 2400G.[6][7][8]
  • Intel
    • It is uncertain whether future Intel processors will support FMA4, due to Intel's announced change to FMA3.

Excerpt from FMA4

Mnemonic (AT&T) Operands Operation
VFMADDPDxxmm, xmm, xmm/m128, xmm/m128a = b·c + d
VFMADDPDyymm, ymm, ymm/m256, ymm/m256
VFMADDPSxxmm, xmm, xmm/m128, xmm/m128
VFMADDPSyymm, ymm, ymm/m256, ymm/m256
VFMADDSDxmm, xmm, xmm/m64, xmm/m64
VFMADDSSxmm, xmm, xmm/m32, xmm/m32

History

The incompatibility between Intel's FMA3 and AMD's FMA4 is due to both companies changing plans without coordinating coding details with each other. AMD changed their plans from FMA3 to FMA4 while Intel changed their plans from FMA4 to FMA3 almost at the same time. The history can be summarized as follows:

  • August 2007: AMD announces the SSE5 instruction set, which includes 3-operand FMA instructions. A new coding scheme (DREX) is introduced for allowing instructions to have three operands.[9]
  • April 2008: Intel announces their AVX and FMA instruction sets, including 4-operand FMA instructions. The coding of these instructions uses the new VEX coding scheme,[10] which is more flexible than AMD's DREX scheme.
  • December 2008: Intel changes the specification for their FMA instructions from 4-operand to 3-operand instructions. The VEX coding scheme is still used.[11]
  • May 2009: AMD changes the specification of their FMA instructions from the 3-operand DREX form to the 4-operand VEX form, compatible with the April 2008 Intel specification rather than the December 2008 Intel specification.[12]
  • October 2011: AMD Bulldozer processor supports FMA4.[13]
  • January 2012: AMD announces FMA3 support in future processors codenamed Trinity and Vishera; they are based on the Piledriver architecture.[14]
  • May 2012: AMD Piledriver processor supports both FMA3 and FMA4.[13]
  • June 2013: Intel Haswell processor supports FMA3.[15]
  • February 2017 The first generation of AMD Ryzen processors officially supports FMA3, but not FMA4 according to the CPUID instruction.[16] There has been confusion regarding whether FMA4 was implemented or not on this processor due to errata in the initial patch to the GNU Binutils package that has since been rectified.[17][18] While the FMA4 instructions seem to work according to some tests, they can also give wrong results.[19] Additionally, the initial Ryzen CPUs could be crashed by a particular sequence of FMA3 instructions. It has since been resolved by an updated CPU microcode.[20]

Compiler and assembler support

Different compilers provide different levels of support for FMA4:

  • GCC supports FMA4 with -mfma4 since version 4.5.0[21] and FMA3 with -mfma since version 4.7.0.
  • Microsoft Visual C++ 2010 SP1 supports FMA4 instructions.[22]
  • Microsoft Visual C++ 2012 supports FMA3 instructions (if the processor also supports AVX2 instruction set extension).
  • Microsoft Visual C++ 2013
  • Microsoft Visual C++ 2015
  • Microsoft Visual C++ 2017
  • PathScale supports FMA4 with -mfma.[23]
  • LLVM 3.1 adds FMA4 support,[24] along with preliminary FMA3 support.[25]
  • Open64 5.0 adds "limited support".
  • Intel compilers support only FMA3 instructions.[21]
  • NASM supports FMA3 instructions since version 2.03 and FMA4 instructions since 2.06.
  • Yasm supports FMA3 instructions since version 0.8.0 and FMA4 instructions since version 1.0.0.
  • FASM supports both FMA3 and FMA4 instructions.

References

1. ^"FMA3 and FMA4 are not instruction sets, they are individual instructions -- fused multiply add. They could be quite useful depending on how Intel and AMD implement them" {{cite web|last=Woltmann|first=George (Prime95)|title=Intel AVX and GIMPS|url=http://www.mersenneforum.org/showthread.php?t=14335&highlight=fused+multiply+add|work=mersenneforum.org/index.php|publisher=Great Internet Mersenne Prime Search (GIMPS) project|accessdate=27 July 2011}}
2. ^{{cite web|last=Maffeo|first=Robin|title=AMD and the Visual Studio 11 Beta|url=http://developer.amd.com/community/blog/2012/03/01/amd-and-the-visual-studio-11-beta/|publisher=AMD|date=March 1, 2012|archive-url=https://archive.is/20131109140742/http://developer.amd.com/community/blog/2012/03/01/amd-and-the-visual-studio-11-beta/|archive-date=November 9, 2013|dead-url=yes|accessdate=2018-11-07}}
3. ^{{cite web | url=http://support.amd.com/TechDocs/43479.pdf | title=AMD64 Architecture Programmer’s Manual Volume 6: 128-Bit and 256-Bit XOP, FMA4 and CVT16 Instructions | date=May 1, 2009 | publisher=AMD}}
4. ^{{cite web | url=http://developer.amd.com/wordpress/media/2012/10/New-Bulldozer-and-Piledriver-Instructions.pdf | title=New "Bulldozer" and "Piledriver" Instructions A step forward for high performance software development | date=October 2012 | publisher=AMD}}
5. ^http://agner.org/optimize/blog/read.php?i=838
6. ^{{cite web | url=https://products.amd.com/en-us/search/cpu#Default=%7B%22k%22%3A%22%22%2C%22r%22%3A%5B%7B%22n%22%3A%22FMAOWSCHCS%22%2C%22t%22%3A%5B%22%5C%22%C7%82%C7%82464d4134%5C%22%22%5D%2C%22o%22%3A%22OR%22%2C%22k%22%3Afalse%2C%22m%22%3A%7B%22%5C%22%C7%82%C7%82464d4134%5C%22%22%3A%22FMA4%22%7D%7D%5D%7D#2d521741-4cc8-44d2-aa87-874f9bb51787=%7B%22k%22%3A%22%22%7D | title=www.amd.com, FMA4 support model list | }}
7. ^{{cite web | url=https://products.amd.com/en-us/search/APU/AMD-Ryzen™-Processors/AMD-Ryzen™-5-Processor-with-Radeon™-Vega-Graphics/AMD-Ryzen™-5-2400G/243 | title=www.amd.com, FMA4 support model list | }}
8. ^{{cite web | url=https://products.amd.com/en-us/search/APU/AMD-Ryzen™-Processors/AMD-Ryzen™-3-Processor-with-Radeon™-Vega-Graphics/AMD-Ryzen™-3-2200G/244 | title=www.amd.com, FMA4 support model list | }}
9. ^{{cite web|url=http://developer.amd.com/SSE5 |title=128-Bit SSE5 Instruction Set |publisher=AMD Developer Central |accessdate=2008-01-28 |archiveurl=https://web.archive.org/web/20080115163416/http://developer.amd.com/SSE5 |archivedate=2008-01-15 |deadurl=yes |df= }}
10. ^{{cite web | url=http://softwarecommunity.intel.com/isn/downloads/intelavx/Intel-AVX-Programming-Reference-31943302.pdf | title=Intel Advanced Vector Extensions Programming Reference | publisher=Intel | accessdate=2008-04-05 }}{{dead link|date=September 2017 |bot=InternetArchiveBot |fix-attempted=yes }}
11. ^{{cite web | url=http://software.intel.com/en-us/avx/ | title=Intel Advanced Vector Extensions Programming Reference | publisher=Intel | accessdate=2009-05-06}}
12. ^{{cite web | url=http://blogs.amd.com/developer/2009/05/06/striking-a-balance/ | title=Striking a balance | date=May 6, 2009 | publisher=Dave Christie, AMD Developer blogs | archive-url=https://archive.li/20120708101459/http://blogs.amd.com/developer/2009/05/06/striking-a-balance/ | archive-date=July 8, 2012 | dead-url=yes | accessdate=2018-11-07}}
13. ^{{cite web|title=New Bulldozer and Piledriver Instructions |url=http://developer.amd.com/wordpress/media/2012/10/New-Bulldozer-and-Piledriver-Instructions.pdf|publisher=AMD|accessdate=25 July 2013}}
14. ^{{cite web|title=Software Optimization Guide for AMD Family 15h Processors|url=http://support.amd.com/us/Processor_TechDocs/47414_15h_sw_opt_guide.pdf|publisher=AMD|accessdate=19 April 2012}}
15. ^{{cite web|title=Intel Architecture Instruction Set Extensions Programming Reference|url=http://software.intel.com/sites/default/files/319433-015.pdf|publisher=Intel|accessdate=25 July 2013}}
16. ^{{cite web | url=http://www.agner.org/optimize/microarchitecture.pdf | title=The microarchitecture of Intel, AMD and VIA CPUs An optimization guide for assembly programmers and compiler makers | accessdate=2017-05-02}}
17. ^https://sourceware.org/ml/binutils/2015-03/msg00078.html
18. ^https://sourceware.org/ml/binutils/2015-08/msg00039.html
19. ^{{cite web|url=https://www.reddit.com/r/Amd/comments/68s4bj/ryzen_has_undocumented_support_for_fma4/dh0y353/|title=Discussion – Ryzen has undocumented support for FMA4|accessdate=2017-05-10}}
20. ^{{cite web|url=https://www.techpowerup.com/231536/amd-ryzen-machine-crashes-to-a-sequence-of-fma3-instructions|title=AMD Ryzen Machine Crashes to a Sequence of FMA3 Instructions|accessdate=2017-09-10}}
21. ^{{cite web|url=http://www.theinquirer.net/inquirer/news/2124866/amd-bulldozer-fma4-xop-instructions-supported-gcc| title=AMD Bulldozer only FMA4 and XOP instructions are supported by GCC Intel still mute|work=The Inquirer|first=Lawrence |last=Latif|date=Nov 14, 2011}}
22. ^{{cite web|url=http://msdn.microsoft.com/en-us/library/vstudio/gg445134(v=vs.100).aspx|title=FMA4 Intrinsics Added for Visual Studio 2010 SP1}}
23. ^{{cite web|url=http://www.pathscale.com/node/272|title=EKOPath man doc|access-date=2013-07-24|archive-url=https://web.archive.org/web/20160623224118/http://www.pathscale.com/node/272|archive-date=2016-06-23|dead-url=yes|df=}}
24. ^{{cite web|url=http://llvm.org/releases/3.1/docs/ReleaseNotes.html|title=LLVM 3.1 Release Notes}}
25. ^{{cite web|url=http://llvm.org/viewvc/llvm-project?view=revision&revision=155618|title=Enable detection of AVX and AVX2 support through CPUID|date=2012-04-26|work=LLVM}}
{{AMD technology}}{{Intel technology}}{{Multimedia extensions|state=uncollapsed}}{{DEFAULTSORT:Fma Instruction Set}}

3 : X86 instructions|SIMD computing|Advanced Micro Devices technologies

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/16 5:08:31