Share to: share facebook share twitter share wa share telegram print page

Half-precision floating-point format

In computing, half precision (sometimes called FP16 or float16) is a binary floating-point computer number format that occupies 16 bits (two bytes in modern computers) in computer memory. It is intended for storage of floating-point values in applications where higher precision is not essential, in particular image processing and neural networks.

Almost all modern uses follow the IEEE 754-2008 standard, where the 16-bit base-2 format is referred to as binary16, and the exponent uses 5 bits. This can express values in the range ±65,504, with the minimum value above 1 being 1 + 1/1024.

Depending on the computer, half-precision can be over an order of magnitude faster than double precision, e.g. 550 PFLOPS for half-precision vs 37 PFLOPS for double precision on one cloud provider.[1]

History

Several earlier 16-bit floating point formats have existed including that of Hitachi's HD61810 DSP of 1982 (a 4-bit exponent and a 12-bit mantissa),[2] Thomas J. Scott's WIF of 1991 (5 exponent bits, 10 mantissa bits)[3] and the 3dfx Voodoo Graphics processor of 1995 (same as Hitachi).[4]

ILM was searching for an image format that could handle a wide dynamic range, but without the hard drive and memory cost of single or double precision floating point.[5] The hardware-accelerated programmable shading group led by John Airey at SGI (Silicon Graphics) used the s10e5 data type in 1997 as part of the 'bali' design effort. This is described in a SIGGRAPH 2000 paper[6] (see section 4.3) and further documented in US patent 7518615.[7] It was popularized by its use in the open-source OpenEXR image format.

Nvidia and Microsoft defined the half datatype in the Cg language, released in early 2002, and implemented it in silicon in the GeForce FX, released in late 2002.[8] However, hardware support for accelerated 16-bit floating point was later dropped by Nvidia before being reintroduced in the Tegra X1 mobile GPU in 2015.

The F16C extension in 2012 allows x86 processors to convert half-precision floats to and from single-precision floats with a machine instruction.

IEEE 754 half-precision binary floating-point format: binary16

The IEEE 754 standard[9] specifies a binary16 as having the following format:

The format is laid out as follows:

The format is assumed to have an implicit lead bit with value 1 unless the exponent field is stored with all zeros. Thus, only 10 bits of the significand appear in the memory format but the total precision is 11 bits. In IEEE 754 parlance, there are 10 bits of significand, but there are 11 bits of significand precision (log10(211) ≈ 3.311 decimal digits, or 4 digits ± slightly less than 5 units in the last place).

Exponent encoding

The half-precision binary floating-point exponent is encoded using an offset-binary representation, with the zero offset being 15; also known as exponent bias in the IEEE 754 standard.[9]

  • Emin = 000012 − 011112 = −14
  • Emax = 111102 − 011112 = 15
  • Exponent bias = 011112 = 15

Thus, as defined by the offset binary representation, in order to get the true exponent the offset of 15 has to be subtracted from the stored exponent.

The stored exponents 000002 and 111112 are interpreted specially.

Exponent Significand = zero Significand ≠ zero Equation
000002 zero, −0 subnormal numbers (−1)signbit × 2−14 × 0.significantbits2
000012, ..., 111102 normalized value (−1)signbit × 2exponent−15 × 1.significantbits2
111112 ±infinity NaN (quiet, signalling)

The minimum strictly positive (subnormal) value is 2−24 ≈ 5.96 × 10−8. The minimum positive normal value is 2−14 ≈ 6.10 × 10−5. The maximum representable value is (2−2−10) × 215 = 65504.

Half precision examples

These examples are given in bit representation of the floating-point value. This includes the sign bit, (biased) exponent, and significand.

Binary Hex Value Notes
0 00000 0000000000 0000 0
0 00000 0000000001 0001 2−14 × (0 + 1/1024 ) ≈ 0.000000059604645 smallest positive subnormal number
0 00000 1111111111 03ff 2−14 × (0 + 1023/1024 ) ≈ 0.000060975552 largest subnormal number
0 00001 0000000000 0400 2−14 × (1 + 0/1024 ) ≈ 0.00006103515625 smallest positive normal number
0 01101 0101010101 3555 2−2 × (1 + 341/1024 ) ≈ 0.33325195 nearest value to 1/3
0 01110 1111111111 3bff 2−1 × (1 + 1023/1024 ) ≈ 0.99951172 largest number less than one
0 01111 0000000000 3c00 20 × (1 + 0/1024 ) = 1 one
0 01111 0000000001 3c01 20 × (1 + 1/1024 ) ≈ 1.00097656 smallest number larger than one
0 11110 1111111111 7bff 215 × (1 + 1023/1024 ) = 65504 largest normal number
0 11111 0000000000 7c00 infinity
1 00000 0000000000 8000 −0
1 10000 0000000000 c000 −2
1 11111 0000000000 fc00 −∞ negative infinity

By default, 1/3 rounds down like for double precision, because of the odd number of bits in the significand. The bits beyond the rounding point are 0101... which is less than 1/2 of a unit in the last place.

Precision limitations

Min Max interval
0 2−13 2−24
2−13 2−12 2−23
2−12 2−11 2−22
2−11 2−10 2−21
2−10 2−9 2−20
2−9 2−8 2−19
2−8 2−7 2−18
2−7 2−6 2−17
2−6 2−5 2−16
2−5 2−4 2−15
2−4 1/8 2−14
1/8 1/4 2−13
1/4 1/2 2−12
1/2 1 2−11
1 2 2−10
2 4 2−9
4 8 2−8
8 16 2−7
16 32 2−6
32 64 2−5
64 128 2−4
128 256 1/8
256 512 1/4
512 1024 1/2
1024 2048 1
2048 4096 2
4096 8192 4
8192 16384 8
16384 32768 16
32768 65520 32
65520

65520 and larger numbers round to infinity. This is for round-to-even, other rounding strategies will change this cut-off.

ARM alternative half-precision

ARM processors support (via a floating point control register bit) an "alternative half-precision" format, which does away with the special case for an exponent value of 31 (111112).[10] It is almost identical to the IEEE format, but there is no encoding for infinity or NaNs; instead, an exponent of 31 encodes normalized numbers in the range 65536 to 131008.

Uses of half precision

Half precision is used in several computer graphics environments to store pixels, including MATLAB, OpenEXR, JPEG XR, GIMP, OpenGL, Vulkan,[11] Cg, Direct3D, and D3DX. The advantage over 8-bit or 16-bit integers is that the increased dynamic range allows for more detail to be preserved in highlights and shadows for images, and avoids gamma correction. The advantage over 32-bit single-precision floating point is that it requires half the storage and bandwidth (at the expense of precision and range).[5]

Half precision can be useful for mesh quantization. Mesh data is usually stored using 32-bit single precision floats for the vertices, however in some situations it is acceptable to reduce the precision to only 16-bit half precision, requiring only half the storage at the expense of some precision. Mesh quantization can also be done with 8-bit or 16-bit fixed precision depending on the requirements.[12]

Hardware and software for machine learning or neural networks tend to use half precision: such applications usually do a large amount of calculation, but don't require a high level of precision. Due to hardware typically not supporting 16-bit half precision floats, neural networks often use the bfloat16 format, which is the single precision float format truncated to 16 bits.

If the hardware has instructions to compute half-precision math, it is often faster than single or double precision. If the system has SIMD instructions that can handle multiple floating-point numbers within one instruction, half precision can be twice as fast by operating on twice as many numbers simultaneously.[13]

Support by programming languages

Zig provides support for half precisions with its f16 type.[14]

.NET 5 introduced half precision floating point numbers with the System.Half standard library type.[15][16] As of January 2024, no .NET language (C#, F#, Visual Basic, and C++/CLI and C++/CX) has literals (e.g. in C#, 1.0f has type System.Single or 1.0m has type System.Decimal) or a keyword for the type.[17][18][19]

Swift introduced half precision floating point numbers in Swift 5.3 with the Float16 type.[20]

OpenCL also supports half precision floating point numbers with the half datatype on IEEE 754-2008 half-precision storage format. [21]

As of 2024, Rust is currently working on adding a new f16 type for IEEE half-precision 16-bit floats.[22]

Julia provides support for half precision floating point numbers with the Float16 type.[23]

Hardware support

Several versions of the ARM architecture have support for half precision.[24]

Support for half precision in the x86 instruction set is specified in the F16C instruction set extension, first introduced in 2009 by AMD and fairly broadly adopted by AMD and Intel CPUs by 2012. This was further extended up the AVX-512_FP16 instruction set extension implemented in the Intel Sapphire Rapids processor.[25]

On RISC-V, the Zfh and Zfhmin extensions provide hardware support for 16-bit half precision floats. The Zfhmin extension is a minimal alternative to Zfh.[26]

On Power ISA, VSX and the not-yet-approved SVP64 extension provide hardware support for 16-bit half precision floats as of PowerISA v3.1B and later.[27][28]

See also

References

  1. ^ "About ABCI - About ABCI | ABCI". abci.ai. Retrieved 2019-10-06.
  2. ^ "hitachi :: dataBooks :: HD61810 Digital Signal Processor Users Manual". Archive.org. Retrieved 2017-07-14.
  3. ^ Scott, Thomas J. (March 1991). "Mathematics and computer science at odds over real numbers". Proceedings of the twenty-second SIGCSE technical symposium on Computer science education - SIGCSE '91. Vol. 23. pp. 130–139. doi:10.1145/107004.107029. ISBN 0897913779. S2CID 16648394.
  4. ^ "/home/usr/bk/glide/docs2.3.1/GLIDEPGM.DOC". Gamers.org. Retrieved 2017-07-14.
  5. ^ a b "OpenEXR". OpenEXR. Archived from the original on 2013-05-08. Retrieved 2017-07-14.
  6. ^ Mark S. Peercy; Marc Olano; John Airey; P. Jeffrey Ungar. "Interactive Multi-Pass Programmable Shading" (PDF). People.csail.mit.edu. Retrieved 2017-07-14.
  7. ^ "Patent US7518615 - Display system having floating point rasterization and floating point ... - Google Patents". Google.com. Retrieved 2017-07-14.
  8. ^ "vs_2_sw". Cg 3.1 Toolkit Documentation. Nvidia. Retrieved 17 August 2016.
  9. ^ a b IEEE Standard for Floating-Point Arithmetic. IEEE STD 754-2019 (Revision of IEEE 754-2008). July 2019. pp. 1–84. doi:10.1109/ieeestd.2019.8766229. ISBN 978-1-5044-5924-2.
  10. ^ "Half-precision floating-point number support". RealView Compilation Tools Compiler User Guide. 10 December 2010. Retrieved 2015-05-05.
  11. ^ Garrard, Andrew. "10.1. 16-bit floating-point numbers". Khronos Data Format Specification v1.2 rev 1. Khronos. Retrieved 2023-08-05.
  12. ^ "KHR_mesh_quantization". GitHub. Khronos Group. Retrieved 2023-07-02.
  13. ^ Ho, Nhut-Minh; Wong, Weng-Fai (September 1, 2017). "Exploiting half precision arithmetic in Nvidia GPUs" (PDF). Department of Computer Science, National University of Singapore. Retrieved July 13, 2020. Nvidia recently introduced native half precision floating point support (FP16) into their Pascal GPUs. This was mainly motivated by the possibility that this will speed up data intensive and error tolerant applications in GPUs.
  14. ^ "Floats". ziglang.org. Retrieved 7 January 2024.
  15. ^ "Half Struct (System)". learn.microsoft.com. Retrieved 2024-02-01.
  16. ^ Govindarajan, Prashanth (2020-08-31). "Introducing the Half type!". .NET Blog. Retrieved 2024-02-01.
  17. ^ "Floating-point numeric types ― C# reference". learn.microsoft.com. 2022-09-29. Retrieved 2024-02-01.
  18. ^ "Literals ― F# language reference". learn.microsoft.com. 2022-06-15. Retrieved 2024-02-01.
  19. ^ "Data Type Summary — Visual Basic language reference". learn.microsoft.com. 2021-09-15. Retrieved 2024-02-01.
  20. ^ "swift-evolution/proposals/0277-float16.md at main · apple/swift-evolution". github.com. Retrieved 13 May 2024.
  21. ^ "cl_khr_fp16 extension". registry.khronos.org. Retrieved 31 May 2024.
  22. ^ Cross, Travis. "Tracking Issue for f16 and f128 float types". GitHub. Retrieved 2024-07-05.
  23. ^ "Integers and Floating-Point Numbers · The Julia Language". docs.julialang.org. Retrieved 2024-07-11.
  24. ^ "Half-precision floating-point number format". ARM Compiler armclang Reference Guide Version 6.7. ARM Developer. Retrieved 13 May 2022.
  25. ^ Towner, Daniel. "Intel® Advanced Vector Extensions 512 - FP16 Instruction Set for Intel® Xeon® Processor Based Products" (PDF). Intel® Builders Programs. Retrieved 13 May 2022.
  26. ^ "RISC-V Instruction Set Manual, Volume I: RISC-V User-Level ISA". Five EmbedDev. Retrieved 2023-07-02.
  27. ^ "OPF_PowerISA_v3.1B.pdf". OpenPOWER Files. OpenPOWER Foundation. Retrieved 2023-07-02.
  28. ^ "ls005.xlen.mdwn". libre-soc.org Git. Retrieved 2023-07-02.

Further reading

External links

Read other articles:

Krishna beralih ke halaman ini. Untuk pengertian lain, lihat Krishna (disambiguasi). Kresnaकृष्णAwatara Sebagai Dewa WisnuEjaan Dewanagariकृष्णEjaan IASTkṛṣṇaNama lainAcyuta; Basudewa; Bagawan; Gopala; Gowinda; Hari; Kesawa; Madawa; Narayana; Wisnu; dan lain-lain.GolonganDewa,Awatara WisnuSenjataCakra SudarsanaWahanaGarudaPasanganRadha, Rukmini,MantraOm Namo Bhagawate Wāsudevāyalbs Kresna atau Krishna (Dewanagari: कृष्ण; ,IAST: kṛṣṇa,; d…

Ivorian writer and politician (1916–2019) Bernard Dadié Bernard Binlin Dadié (10 January 1916 – 9 March 2019) was an Ivorian novelist, playwright, poet, and administrator. Among many other senior positions, starting in 1957, he held the post of Minister of Culture in the government of Côte d'Ivoire from 1977 to 1986. Biography Dadié was born in Assinie, Côte d'Ivoire, and attended the local Catholic school in Grand Bassam and then the Ecole William Ponty.[1] He worked for the Fr…

Sir Henry KeppelLaksamana Sir Henry KeppelLahir(1809-06-14)14 Juni 1809Kensington, LondonMeninggal17 Januari 1904(1904-01-17) (umur 94)Piccadilly, LondonDikebumikanSt Mary the Virgin, WinkfieldPengabdianUnited KingdomDinas/cabangRoyal NavyLama dinas1822–1879PangkatLaksamana, Panglima ArmadaKomandanHMS Childers (1827)HMS Maeander (1840)HMS St Jean d'Acre (1853)HMS Rodney (1833)HMS Colossus (1848)Panglima Tertinggi, AfrikaPanglima Tertinggi, Pangkalan Pantai Tenggara AmerikaPangkalan H…

Spanish politician For his father, also a politician, see Santiago Abascal Escuza. In this Spanish name, the first or paternal surname is Abascal and the second or maternal family name is Conde. Santiago AbascalMPAbascal in 2023President of VoxIncumbentAssumed office 20 September 2014Vice PresidentJorge BuxadéPreceded byJosé Luis González QuirósMember of the Congress of DeputiesIncumbentAssumed office 21 May 2019ConstituencyMadridDirector of the Data Protection Agency of the …

Een Duitse onderzeeër tijdens de Eerste Wereldoorlog Onbeperkte duikbotenoorlog is de algemeen gangbare aanduiding voor de manier waarop Duitsland oorlog voerde met onderzeeërs tijdens de Eerste en Tweede Wereldoorlog. Het hield in dat de zogenaamde U-boten geen vooraf bepaalde of bevolen missies uitvoerden, maar alle schepen van vijandelijke landen die ze tegenkwamen aanvielen; niet alleen oorlogsschepen, maar ook koopvaardijschepen en soms zelfs passagiersschepen. Deze opdracht aan de duikbo…

Edith Hern Fossett (1787–1854) comenzó su vida como esclava estadounidense. Tres generaciones de su familia, los Hern, trabajaron en los campos de Thomas Jefferson, realizaron tareas domésticas, de liderazgo y fabricaron herramientas. Al igual que Edith, también se ocuparon de los niños. Cuidaba de Harriet Hemings, la hija de Sally Hemings, en la plantación de Thomas Jefferson Monticello cuando era niña. Edith trabajó como cocinera para el presidente Jefferson en la Casa del Presidente,…

Родоначальник: Іван Санґушкович Гілки роду: князі Санґушко Місце походження: Сади (Підляське воєводство) Підданство: Велике Князівство Литовське Замки / палаци: Чортківський замок Фундуш Крістофа Садовського католицькому костелу в маєтку Сади. Садівські — українсько-лит…

Will Crothersангл. William CrothersЗагальна інформаціяНаціональність канадецьГромадянство  Канада[1]Народження 14 червня 1987(1987-06-14) (36 років)КінгстонЗріст 195 смВага 95 кгAlma mater Вашингтонський університетСпортКраїна КанадаВид спорту академічне веслуванняКлуб Kingston RC, Kingston, ON, CAN Уча

Опис файлу Опис Постер до аніме Проєкт К Джерело http://k-project.jpn.com/ Автор зображення GoHands Ліцензія див. нижче Обґрунтування добропорядного використання для статті «K (аніме)» [?] Мета використання в якості основного засобу візуальної ідентифікації у верхній частині стат…

Ruidos. Ensayo sobre la economía política de la música de Jacques Attali Detalle de El combate entre don Carnal y doña Cuaresma de Pieter Brueghel el Viejo, que ilustra la portada del libro.[1]​Género No ficción Idioma Francés Título original Bruits: essai sur l'economie politique de la musique Artista de la cubierta Pieter Brueghel el Viejo Editorial Presses Universitaires de FranceSiglo XXI EditoresUniversity of Minnesota Press País Francia Fecha de publicación 1977 […

Ini adalah daftar katedral di Sao Tome dan Principe diurutkan berdasarkan denominasi. Katedral São Tomé Katolik Katedral Gereja Katolik di Sao Tome dan Principe:[1] Katedral Bunda Maria, São Tomé Lihat juga Gereja Katolik di Sao Tome dan Principe Gereja Katolik Roma Daftar katedral Referensi ^ GCatholic.org: Katedral Sao Tome dan Principe lbsDaftar katedral di AfrikaNegaraberdaulat Afrika Selatan Afrika Tengah Aljazair Angola Benin Botswana Burkina Faso Burundi Chad Eritrea Eswatini …

Official of the European Union High Representative redirects here. For other uses, see High Representative (disambiguation). High Representative of the Union for Foreign Affairsand Security Policy Bulgarian: Върховен представител на Съюза по въпросите на външните работи и политиката на сигурност Croatian: Visoki predstavnik Unije za vanjske poslove i sigurnosnu politiku Czech: Vysoký představitel Unie pro zahraniční …

Petru Chiril LucinschiPetru Lucinschi pada tahun 2000Presiden Moldova ke-2Masa jabatan15 Januari 1997 – 7 April 2001Perdana MenteriIon CiubucSerafim UrecheanIon SturzaDumitru BraghişPendahuluMircea SnegurPenggantiVladimir VoroninSekretaris Pertama Partai KomunisMasa jabatan16 November 1989 – 4 Februari 1991Perdana MenteriIvan CălinPetru PascariMircea DrucPendahuluSemion GrossuPenggantiGrigore Eremei Informasi pribadiLahir27 Januari 1940 (umur 83)Desa Rădulenii Vechi…

HESA Shahed 285 (Persian: شاهد ۲۸۵) adalah sebuah helikopter serangan/pengintaian ringan yang dikembangkan di Iran. Shahed 285 ini diresmikan pada tanggal 24 Mei 2009. Shahed 285 ini sedang diproduksi dalam dua versi: versi serangan/rekonstruksi ringan dan versi patroli/anti-kapal maritim. Shahed 285 didasarkan pada komposit Shahed-278, yang merupakan helikopter relatif ringan dengan 682 kg berat kosong, berasal dari Bell 206 Jetranger. Referensi Wikimedia Commons memiliki media mengenai …

Схема коловорота Коловорот колодязя — широко відомий приклад застосування механізму коловорота. У Вікіпедії є статті про інші значення цього терміна: Коловорот. У Вікіпедії є статті про інші значення цього терміна: Корба (значення). Запит «Ворот» перенаправляє сюди; пр…

石垣港離島ターミナル(ユーグレナ石垣港離島ターミナル) 情報用途 客船ターミナル事業主体 石垣市管理運営 石垣市経済振興公社[1]延床面積 5,000 m² [1]階数 1階(一部2階)竣工 2007年1月30日開館開所 2007年1月31日所在地 〒907-0012沖縄県石垣市美崎町1番地座標 北緯24度20分13.7秒 東経124度9分20.2秒 / 北緯24.337139度 東経124.155611度 / 24.337139; 1…

Winemaking process where grape skins and seeds are kept in contact with the juice Cabernet Sauvignon musts interact with the skins during fermentation to add color, tannins and flavor to the wine. Most red wine grapes have their color concentrated in the skin, while the juice is much lighter in color. The duration of contact between the crushed grape skins and their juice impacts the final color and flavor profile. Maceration is the winemaking process where the phenolic materials of the grape—…

قاسم جومارت توقاييف (بالقازاقية: Қасым-Жомарт Кемелұлы Тоқаев)‏، و(بالقازاقية: Qasym-Jomart Kemelūly Toqaev)‏    مناصب رئيس وزراء كازاخستان   في المنصب12 أكتوبر 1999  – 28 يناير 2002  مكتب الأمم المتحدة في جنيف   في المنصب12 مارس 2011  – 13 أكتوبر 2013  رئيس كازاخستان (2 )   تول…

Japanese manga series DeathtopiaCover of the first volumeGenreSupernatural thriller[1] MangaWritten byYoshinobu YamadaPublished byKodanshaEnglish publisherNA: Kodansha USA (digital)ImprintEvening KCMagazineEveningDemographicSeinenOriginal runApril 22, 2014 – December 13, 2016Volumes8 Deathtopia (stylized as DEATHTOPIA) is a Japanese manga series written and illustrated by Yoshinobu Yamada. It was serialized in Kodansha's Evening from April 2014 to December 2016, with its chap…

American professional wrestler (born 1979) Silas YoungYoung as the ROH World Television Champion in 2018Birth nameCaleb DeWall[1]Born (1979-08-09) August 9, 1979 (age 44)Wisconsin, USAProfessional wrestling careerRing name(s)Silas YoungBilled height5 ft 11 in (1.80 m)[1]Billed weight220 lb (100 kg)[1]Billed fromMilwaukee, Wisconsin[2]Trained byAngel Armoni Chris Bassett Mike MercuryDebutMarch 2, 2002[1][2] Caleb DeWall…

Kembali kehalaman sebelumnya

Lokasi Pengunjung: 3.144.40.204