From 1dc5de5d3d9b5cd5e73f9ab1156a94ff17a11be9 Mon Sep 17 00:00:00 2001 From: Mariusz Merecki Date: Wed, 29 Apr 2020 15:23:04 +0200 Subject: [PATCH 1/6] Add SPV_INTEL_float_controls2 extension preview --- .../SPIRV/SPV_INTEL_float_controls2.asciidoc | 140 ++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc diff --git a/sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc b/sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc new file mode 100644 index 000000000000..a3f7d0b8c452 --- /dev/null +++ b/sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc @@ -0,0 +1,140 @@ +SPV_INTEL_float_controls2 +========================= + +Name Strings +------------ + +SPV_INTEL_float_controls2 + +Contact +------- + +To report problems or to provide input on this extension, please open a new issue at: +https://github.com/intel/llvm/issues + +Contributors +------------ + +- Gang Chen, Intel +- Mariusz Merecki, Intel +- Aleksander Us, Intel +- Konstantin Vladimirov, Intel + + + +Notice +------ + +Copyright (c) 2020 Intel Corporation. All rights reserved. + +Status +------ + +Working Draft + +This is a preview extension specification, intended to provide early access to a feature for review and community feedback. When the feature matures, this specification may be released as a formal extension. + +Because the interfaces defined by this specification are not final and are subject to change they are not intended to be used by shipping software products. If you are interested in using this feature in your software product, please let us know! + + +Version +------- + +[width="40%",cols="25,25"] +|======================================== +| Last Modified Date | 2020-04-24 +| Revision | 2 +|======================================== + +Dependencies +------------ + +This extension is written against the SPIR-V Specification, +Version 1.5, Revision 2, Unified + +This extension requires SPIR-V 1.0. + +Overview +-------- + +This extension provides new execution modes to control floating-point computations by overriding an implementation’s default behavior for rounding modes and floating point modes. + + +Extension Name +-------------- + +To use this extension within a SPIR-V module, the following +*OpExtension* must be present in the module: + +---- +OpExtension "SPV_INTEL_float_controls2" +---- + +Modifications to the SPIR-V Specification, Version 1.5, Revision 2, Unified +--------------------------------------------------------------------------- + +Modify Section 3.6, Execution Mode, add the following rows to the Execution Mode table: + +-- +[cols="1,20,10,10",options="header",width = "80%"] +|==== + 2+^| Execution Mode | Enabling Capabilities | Extra Operands +| 5620 | *RoundingModeRTPINTEL* + +The default rounding mode for floating-point arithmetic and conversions instructions must be round to positive infinity. +If an instruction is decorated with *FPRoundingMode* or defines a rounding mode in its description, that rounding mode is applied and *RoundingModeRTPINTEL* is ignored. +Only affects instructions operating on a floating-point type whose component width is _Target Width_. + +_Target Width_ is an unsigned 32-bit integer. +| *RoundToInfinityINTEL* | <> _Target Width_ +| 5621 | *RoundingModeRTNINTEL* + +The default rounding mode for floating-point arithmetic and conversions instructions must be round to negative infinity. +If an instruction is decorated with *FPRoundingMode* or defines a rounding mode in its description, that rounding mode is applied and *RoundingModeRTPNINTEL* is ignored. +Only affects instructions operating on a floating-point type whose component width is _Target Width_. + +_Target Width_ is an unsigned 32-bit integer. +| *RoundToInfinityINTEL* | <> _Target Width_ +| 5622 | *FloatingPointModeALTINTEL* + +The default floating-point operation mode for floating-point arithmetic and conversions instructions must be the Alternative Floating-Point Mode as specified by the client API. +Only affects instructions operating on a floating-point type whose component width is _Target Width_. + +_Target Width_ is an unsigned 32-bit integer. +| *FloatingPointModeINTEL* | <> _Target Width_ +| 5623 | *FloatingPointModeIEEEINTEL* + +The default floating-point operation mode for floating-point arithmetic and conversions instructions must be the IEEE Mode as specified by the client API. +Only affects instructions operating on a floating-point type whose component width is _Target Width_. + +_Target Width_ is an unsigned 32-bit integer. +| *FloatingPointModeINTEL* | <> _Target Width_ +|==== +-- + +Modify Section 3.31, Capability, add the following rows the 'Capability' table: +-- +[cols="1,20,10,10",options="header",width = "80%"] +|==== + 2+^| Capability | Implicitly Declares | Enabled by Extension +| 5582 | *RoundToInfinityINTEL* + +Module uses *RoundingModeRTNINTEL* or *RoundingModeRTPINTEL* execution modes. +|| *SPV_INTEL_float_controls2* +| 5583 | *FloatingPointModeINTEL* + +Module uses *FloatingPointModeIEEEINTEL* or *FloatingPointModeALTINTEL* execution modes. +|| *SPV_INTEL_float_controls2* +|==== +-- + +Issues +------ + + + +Revision History +---------------- + +[cols="5,15,15,70"] +[grid="rows"] +[options="header"] +|======================================== +|Rev|Date|Author|Changes +|1|2020-04-17|Mariusz Merecki|Initial revision +|2|2020-04-24|Mariusz Merecki|Assigned token numbers to *RoundToInfinityINTEL* and *FloatingPointModeINTEL* +|======================================== From 40d7f91e0a23361f5de2626d8a16d584ffe73d03 Mon Sep 17 00:00:00 2001 From: Mariusz Merecki <44190824+mmerecki@users.noreply.github.com> Date: Wed, 6 May 2020 17:46:27 +0200 Subject: [PATCH 2/6] Update sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc Co-authored-by: Alexey Sachkov --- sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc b/sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc index a3f7d0b8c452..52ccb0ea1ba5 100644 --- a/sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc +++ b/sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc @@ -88,7 +88,7 @@ _Target Width_ is an unsigned 32-bit integer. | *RoundToInfinityINTEL* | <> _Target Width_ | 5621 | *RoundingModeRTNINTEL* + The default rounding mode for floating-point arithmetic and conversions instructions must be round to negative infinity. -If an instruction is decorated with *FPRoundingMode* or defines a rounding mode in its description, that rounding mode is applied and *RoundingModeRTPNINTEL* is ignored. +If an instruction is decorated with *FPRoundingMode* or defines a rounding mode in its description, that rounding mode is applied and *RoundingModeRTNINTEL* is ignored. Only affects instructions operating on a floating-point type whose component width is _Target Width_. _Target Width_ is an unsigned 32-bit integer. From f32982c8e14228d9051269325612ba23f28489f3 Mon Sep 17 00:00:00 2001 From: Mariusz Merecki <44190824+mmerecki@users.noreply.github.com> Date: Tue, 19 May 2020 13:14:48 +0200 Subject: [PATCH 3/6] Update sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc Co-authored-by: Alexey Sotkin --- sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc b/sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc index 52ccb0ea1ba5..73eaf03a024d 100644 --- a/sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc +++ b/sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc @@ -57,7 +57,8 @@ This extension requires SPIR-V 1.0. Overview -------- -This extension provides new execution modes to control floating-point computations by overriding an implementation’s default behavior for rounding modes and floating point modes. +This extension adds execution modes with round to positive infinity and round to negative infinity default rounding. +Execution modes specifying compliance with floating-point arithmetic (IEEE 754) standard are introduced as well. Extension Name From 2682f501270e17fff21ed670e85a0458e736965d Mon Sep 17 00:00:00 2001 From: Mariusz Merecki <44190824+mmerecki@users.noreply.github.com> Date: Tue, 19 May 2020 13:17:47 +0200 Subject: [PATCH 4/6] Update SPV_INTEL_float_controls2.asciidoc --- sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc b/sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc index 73eaf03a024d..8a66b6282410 100644 --- a/sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc +++ b/sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc @@ -101,7 +101,7 @@ Only affects instructions operating on a floating-point type whose component wid _Target Width_ is an unsigned 32-bit integer. | *FloatingPointModeINTEL* | <> _Target Width_ | 5623 | *FloatingPointModeIEEEINTEL* + -The default floating-point operation mode for floating-point arithmetic and conversions instructions must be the IEEE Mode as specified by the client API. +The default floating-point operation mode for floating-point arithmetic and conversions instructions must be the IEEE 754 Mode as specified by the client API. Only affects instructions operating on a floating-point type whose component width is _Target Width_. _Target Width_ is an unsigned 32-bit integer. From 39fa9b0cbfbae88327118990a05c5b387b56d2ef Mon Sep 17 00:00:00 2001 From: Mariusz Merecki Date: Mon, 3 Aug 2020 14:23:21 +0200 Subject: [PATCH 5/6] Update SPV_INTEL_float_controls2 Added *FunctionFloatControlINTEL* capability and *FunctionRoundingModeINTEL*, *FunctionDenormModeINTEL*, *FunctionFloatingPointModeINTEL* decorations. --- .../SPIRV/SPV_INTEL_float_controls2.asciidoc | 101 ++++++++++++++---- 1 file changed, 83 insertions(+), 18 deletions(-) diff --git a/sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc b/sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc index 8a66b6282410..b57c2cbfabb1 100644 --- a/sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc +++ b/sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc @@ -19,6 +19,7 @@ Contributors - Mariusz Merecki, Intel - Aleksander Us, Intel - Konstantin Vladimirov, Intel +- Rudenko Nikita, Intel @@ -42,23 +43,25 @@ Version [width="40%",cols="25,25"] |======================================== -| Last Modified Date | 2020-04-24 -| Revision | 2 +| Last Modified Date | 2020-08-03 +| Revision | 3 |======================================== Dependencies ------------ This extension is written against the SPIR-V Specification, -Version 1.5, Revision 2, Unified +Version 1.5, Revision 3, Unified This extension requires SPIR-V 1.0. Overview -------- -This extension adds execution modes with round to positive infinity and round to negative infinity default rounding. -Execution modes specifying compliance with floating-point arithmetic (IEEE 754) standard are introduced as well. +This extension adds new execution modes and decorations to control floating-point computations. +This extension adds execution modes with round to positive infinity and round to negative infinity default rounding +and execution modes specifying compliance with floating-point arithmetic (IEEE 754) standard. +This extension adds new decorations that can be applied to a function to control floating-point computations inside the function. Extension Name @@ -71,7 +74,7 @@ To use this extension within a SPIR-V module, the following OpExtension "SPV_INTEL_float_controls2" ---- -Modifications to the SPIR-V Specification, Version 1.5, Revision 2, Unified +Modifications to the SPIR-V Specification, Version 1.5, Revision 3, Unified --------------------------------------------------------------------------- Modify Section 3.6, Execution Mode, add the following rows to the Execution Mode table: @@ -79,54 +82,115 @@ Modify Section 3.6, Execution Mode, add the following rows to the Execution Mode -- [cols="1,20,10,10",options="header",width = "80%"] |==== - 2+^| Execution Mode | Enabling Capabilities | Extra Operands + 2+^| Execution Mode | Extra Operands | Enabling Capabilities | 5620 | *RoundingModeRTPINTEL* + The default rounding mode for floating-point arithmetic and conversions instructions must be round to positive infinity. If an instruction is decorated with *FPRoundingMode* or defines a rounding mode in its description, that rounding mode is applied and *RoundingModeRTPINTEL* is ignored. Only affects instructions operating on a floating-point type whose component width is _Target Width_. _Target Width_ is an unsigned 32-bit integer. -| *RoundToInfinityINTEL* | <> _Target Width_ +| <> _Target Width_ | *RoundToInfinityINTEL* | 5621 | *RoundingModeRTNINTEL* + The default rounding mode for floating-point arithmetic and conversions instructions must be round to negative infinity. If an instruction is decorated with *FPRoundingMode* or defines a rounding mode in its description, that rounding mode is applied and *RoundingModeRTNINTEL* is ignored. Only affects instructions operating on a floating-point type whose component width is _Target Width_. _Target Width_ is an unsigned 32-bit integer. -| *RoundToInfinityINTEL* | <> _Target Width_ -| 5622 | *FloatingPointModeALTINTEL* + +| <> _Target Width_ | *RoundToInfinityINTEL* + | 5622 | *FloatingPointModeALTINTEL* + The default floating-point operation mode for floating-point arithmetic and conversions instructions must be the Alternative Floating-Point Mode as specified by the client API. Only affects instructions operating on a floating-point type whose component width is _Target Width_. _Target Width_ is an unsigned 32-bit integer. -| *FloatingPointModeINTEL* | <> _Target Width_ +| <> _Target Width_ | *FloatingPointModeINTEL* | 5623 | *FloatingPointModeIEEEINTEL* + The default floating-point operation mode for floating-point arithmetic and conversions instructions must be the IEEE 754 Mode as specified by the client API. Only affects instructions operating on a floating-point type whose component width is _Target Width_. _Target Width_ is an unsigned 32-bit integer. -| *FloatingPointModeINTEL* | <> _Target Width_ +| <> _Target Width_ | *FloatingPointModeINTEL* |==== -- +Modify Section 3 Binary form, add new sub-sections after 3.16 FP Rounding Mode: +-- +[[FP_Denorm_Mode]]*3.17. FP Denorm Mode* + +Denormalized values handling mode. + +[cols="^.^1,15,15",options="header",width = "50%"] +|==== +2+^.^| FP Denorm Mode | Enabling Capabilities +| 0x0 | *Preserve* + +Denormalized values must be preserved. | +| 0x1 | *FlushToZero* + +Denormalized values must be flushed to zero. | +|==== +[[FP_Operation_Mode]]*3.18. FP Operation Mode* + +Floating-point operation mode. + +[cols="^.^1,15,15",options="header",width = "50%"] +|==== +2+^.^| FP Operation Mode | Enabling Capabilities +| 0x0 | *IEEE* + +Floating-point operation mode is IEEE 754 Mode. | +| 0x1 | *ALT* + +Floating-point operation mode is Alternative Mode. | +|==== +-- + +Modify Section 3.20, Decoration, add the following rows to the Decoration table: + +-- +[cols="1,20,5,5,10",options="header",width = "80%"] +|==== + 2+^| Decoration 2+| Extra Operands | Enabling Capabilities +| 5822 | *FunctionRoundingModeINTEL* + +Apply to a function to overwrite the default rounding mode for all floating-point arithmetic and conversion instructions inside the function. +Only affects instructions operating on a floating-point type whose component width is _Target Width_. + +_Target Width_ is an unsigned 32-bit integer. +|<> + +_Target Width_|<> + +_FP Rounding Mode_| *FunctionFloatControlINTEL* +| 5823 | *FunctionDenormModeINTEL* + +Apply to a function to overwrite the default mode of handling denormalized values for all floating-point arithmetic and conversion instructions inside the function. +Only affects instructions operating on a floating-point type whose component width is _Target Width_. + +_Target Width_ is an unsigned 32-bit integer. +|<> + +_Target Width_|<> + +_FP Denorm Mode_| *FunctionFloatControlINTEL* +| 6080 | *FunctionFloatingPointModeINTEL* + +Apply to a function to overwrite the default floating-point operation mode for all floating-point arithmetic and conversion instructions inside the function. +Only affects instructions operating on a floating-point type whose component width is _Target Width_. + +_Target Width_ is an unsigned 32-bit integer. +|<> + +_Target Width_|<> + + _FP Operation Mode_| *FunctionFloatControlINTEL* +|==== Modify Section 3.31, Capability, add the following rows the 'Capability' table: -- -[cols="1,20,10,10",options="header",width = "80%"] +[cols="1,20,10",options="header",width = "80%"] |==== - 2+^| Capability | Implicitly Declares | Enabled by Extension + 2+^| Capability | Implicitly Declares | 5582 | *RoundToInfinityINTEL* + Module uses *RoundingModeRTNINTEL* or *RoundingModeRTPINTEL* execution modes. -|| *SPV_INTEL_float_controls2* +| | 5583 | *FloatingPointModeINTEL* + Module uses *FloatingPointModeIEEEINTEL* or *FloatingPointModeALTINTEL* execution modes. -|| *SPV_INTEL_float_controls2* +| +| 5821 | *FunctionFloatControlINTEL* + +Module uses *FunctionRoundingModeINTEL*, *FunctionDenormModeINTEL* or *FunctionFloatingPointModeINTEL* decorations. +| |==== -- Issues ------ - - +-- Revision History ---------------- @@ -138,4 +202,5 @@ Revision History |Rev|Date|Author|Changes |1|2020-04-17|Mariusz Merecki|Initial revision |2|2020-04-24|Mariusz Merecki|Assigned token numbers to *RoundToInfinityINTEL* and *FloatingPointModeINTEL* +|3|2020-08-03|Mariusz Merecki|Rebased to SPIR-V Version 1.5, Revision 3, Unified. Added *FunctionFloatControlINTEL* capability and *FunctionRoundingModeINTEL*, *FunctionDenormModeINTEL*, *FunctionFloatingPointModeINTEL* decorations |======================================== From 90fa11e60633363dcf2d4fe6cc0ee6426010271c Mon Sep 17 00:00:00 2001 From: Mariusz Merecki Date: Thu, 3 Dec 2020 13:31:07 +0100 Subject: [PATCH 6/6] Described relation between execution modes and function scope and instruction scope decorations. Added validation rules. --- .../SPIRV/SPV_INTEL_float_controls2.asciidoc | 77 ++++++++++++++++--- 1 file changed, 68 insertions(+), 9 deletions(-) diff --git a/sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc b/sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc index b57c2cbfabb1..8fa6498f7a94 100644 --- a/sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc +++ b/sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc @@ -43,8 +43,8 @@ Version [width="40%",cols="25,25"] |======================================== -| Last Modified Date | 2020-08-03 -| Revision | 3 +| Last Modified Date | 2020-12-03 +| Revision | 4 |======================================== Dependencies @@ -77,8 +77,43 @@ OpExtension "SPV_INTEL_float_controls2" Modifications to the SPIR-V Specification, Version 1.5, Revision 3, Unified --------------------------------------------------------------------------- -Modify Section 3.6, Execution Mode, add the following rows to the Execution Mode table: +Modify Section 2.16.1, Universal Validation Rules: +Modify the Entry Point rules: + +Add *RoundingModeRTPINTEL* and *RoundingModeRTNINTEL* to the list of execution modes in the third rule. + +Add the following rule: + +- Each OpEntryPoint must not set more than one of the *FloatingPointModeALTINTEL* or *FloatingPointModeALTINTEL* execution modes for any given _Target Width_. + +Modify the Decoration rules, add the following rules: + +- If an *OpFunction* is decorated by more than one *FunctionRoundingModeINTEL* for any given _Target Width_ the _FP Rounding Mode_ operands must match. +- If an *OpFunction* is decorated by more than one *FunctionDenormModeINTEL* for any given _Target Width_ the _FP Denorm Mode_ operands must match. +- If an *OpFunction* is decorated by more than one *FunctionFloatingPointModeINTEL* for any given _Target Width_ the _FP Operation Mode_ operands must match. + +Modify Section 3.6, Execution Mode: + +Add the following rule to the description of *DenormPreserve* execution mode: + +If an instruction is inside of a function decorated with *FunctionDenormModeINTEL* with matching _Target Width_ operand, the denorm mode specified by *FunctionDenormModeINTEL* is applied and *DenormPreserve* is ignored. + +Add the following rule to the description of *DenormFlushToZero* execution mode: + +If an instruction is inside of a function decorated with *FunctionDenormModeINTEL* with matching _Target Width_ operand, the denorm mode specified by *FunctionDenormModeINTEL* is applied and *DenormFlushToZero* is ignored. + +Add the following rule to the description of *RoundingModeRTE* execution mode: + +If an instruction is not decorated with *FPRoundingMode* and does not define a rounding mode in its description and is inside of a function decorated +with *FunctionRoundingModeINTEL* with matching _Target Width_ operand, the rounding mode specified by *FunctionRoundingModeINTEL* is applied and *RoundingModeRTE* is ignored. + +Add the following rule to the description of *RoundingModeRTZ* execution mode: + +If an instruction is not decorated with *FPRoundingMode* and does not define a rounding mode in its description and is inside of a function decorated +with *FunctionRoundingModeINTEL* with matching _Target Width_ operand, the rounding mode specified by *FunctionRoundingModeINTEL* is applied and *RoundingModeRTZ* is ignored. + +Add the following rows to the Execution Mode table: -- [cols="1,20,10,10",options="header",width = "80%"] |==== @@ -86,25 +121,35 @@ Modify Section 3.6, Execution Mode, add the following rows to the Execution Mode | 5620 | *RoundingModeRTPINTEL* + The default rounding mode for floating-point arithmetic and conversions instructions must be round to positive infinity. If an instruction is decorated with *FPRoundingMode* or defines a rounding mode in its description, that rounding mode is applied and *RoundingModeRTPINTEL* is ignored. +If an instruction is not decorated with *FPRoundingMode* and does not define a rounding mode in its description and is inside of a function decorated +with *FunctionRoundingModeINTEL* with matching _Target Width_ operand, the rounding mode specified by *FunctionRoundingModeINTEL* is applied and *RoundingModeRTPINTEL* is ignored. + Only affects instructions operating on a floating-point type whose component width is _Target Width_. _Target Width_ is an unsigned 32-bit integer. | <> _Target Width_ | *RoundToInfinityINTEL* | 5621 | *RoundingModeRTNINTEL* + -The default rounding mode for floating-point arithmetic and conversions instructions must be round to negative infinity. +The default rounding mode for floating-point arithmetic and conversions instructions must be round to negative infinity. + If an instruction is decorated with *FPRoundingMode* or defines a rounding mode in its description, that rounding mode is applied and *RoundingModeRTNINTEL* is ignored. +If an instruction is not decorated with *FPRoundingMode* and does not define a rounding mode in its description and is inside of a function decorated +with *FunctionRoundingModeINTEL* with matching _Target Width_ operand, the rounding mode specified by *FunctionRoundingModeINTEL* is applied and *RoundingModeRTNINTEL* is ignored. + Only affects instructions operating on a floating-point type whose component width is _Target Width_. _Target Width_ is an unsigned 32-bit integer. | <> _Target Width_ | *RoundToInfinityINTEL* - | 5622 | *FloatingPointModeALTINTEL* + +| 5622 | *FloatingPointModeALTINTEL* + The default floating-point operation mode for floating-point arithmetic and conversions instructions must be the Alternative Floating-Point Mode as specified by the client API. +If an instruction defines a floating-point operation mode in its description, that floating-point operation mode is applied and *FloatingPointModeALTINTEL* is ignored. +If an instruction does not define a floating-point operation mode in its description and is inside of a function decorated with *FunctionFloatControlINTEL* with matching _Target Width_ operand, +the floating-point operation mode specified by *FunctionFloatControlINTEL* is applied and *FloatingPointModeALTINTEL* is ignored. + Only affects instructions operating on a floating-point type whose component width is _Target Width_. _Target Width_ is an unsigned 32-bit integer. | <> _Target Width_ | *FloatingPointModeINTEL* | 5623 | *FloatingPointModeIEEEINTEL* + The default floating-point operation mode for floating-point arithmetic and conversions instructions must be the IEEE 754 Mode as specified by the client API. +If an instruction defines a floating-point operation mode in its description, that floating-point operation mode is applied and *FloatingPointModeIEEEINTEL* is ignored. +If an instruction does not define a floating-point operation mode in its description and is inside of a function decorated with *FunctionFloatControlINTEL* with matching _Target Width_ operand, +the floating-point operation mode specified by *FunctionFloatControlINTEL* is applied and *FloatingPointModeIEEEINTEL* is ignored. + Only affects instructions operating on a floating-point type whose component width is _Target Width_. _Target Width_ is an unsigned 32-bit integer. @@ -120,9 +165,9 @@ Denormalized values handling mode. [cols="^.^1,15,15",options="header",width = "50%"] |==== 2+^.^| FP Denorm Mode | Enabling Capabilities -| 0x0 | *Preserve* + +| 0 | *Preserve* + Denormalized values must be preserved. | -| 0x1 | *FlushToZero* + +| 1 | *FlushToZero* + Denormalized values must be flushed to zero. | |==== [[FP_Operation_Mode]]*3.18. FP Operation Mode* @@ -132,9 +177,9 @@ Floating-point operation mode. [cols="^.^1,15,15",options="header",width = "50%"] |==== 2+^.^| FP Operation Mode | Enabling Capabilities -| 0x0 | *IEEE* + +| 0 | *IEEE* + Floating-point operation mode is IEEE 754 Mode. | -| 0x1 | *ALT* + +| 1 | *ALT* + Floating-point operation mode is Alternative Mode. | |==== -- @@ -147,6 +192,7 @@ Modify Section 3.20, Decoration, add the following rows to the Decoration table: 2+^| Decoration 2+| Extra Operands | Enabling Capabilities | 5822 | *FunctionRoundingModeINTEL* + Apply to a function to overwrite the default rounding mode for all floating-point arithmetic and conversion instructions inside the function. +If an instruction is decorated with *FPRoundingMode* or defines a rounding mode in its description, that rounding mode is applied and *FunctionRoundingModeINTEL* is ignored. Only affects instructions operating on a floating-point type whose component width is _Target Width_. _Target Width_ is an unsigned 32-bit integer. @@ -155,6 +201,8 @@ _Target Width_|<> + _FP Rounding Mode_| *FunctionFloatControlINTEL* | 5823 | *FunctionDenormModeINTEL* + Apply to a function to overwrite the default mode of handling denormalized values for all floating-point arithmetic and conversion instructions inside the function. +If an instruction defines a mode of handling denormalized values in its description, that denorm mode is applied and *FunctionDenormModeINTEL* is ignored. + Only affects instructions operating on a floating-point type whose component width is _Target Width_. _Target Width_ is an unsigned 32-bit integer. @@ -163,6 +211,7 @@ _Target Width_|<> + _FP Denorm Mode_| *FunctionFloatControlINTEL* | 6080 | *FunctionFloatingPointModeINTEL* + Apply to a function to overwrite the default floating-point operation mode for all floating-point arithmetic and conversion instructions inside the function. +If an instruction defines a floating-point operation mode in its description, that floating-point operation mode is applied and *FunctionFloatControlINTEL* is ignored. Only affects instructions operating on a floating-point type whose component width is _Target Width_. _Target Width_ is an unsigned 32-bit integer. @@ -190,6 +239,15 @@ Module uses *FunctionRoundingModeINTEL*, *FunctionDenormModeINTEL* or *FunctionF Issues ------ + +1) Isn't having the *FloatingPointModeIEEEINTEL* execution mode and *FunctionFloatingPointModeINTEL* decoration redundant? + +Discussion: The intention is that the execution modes set the default rounding/denorm/floating-point modes for the entire entry point. +Decorations allow to overwrite the rounding/denorm/floating-point mode for all arithmetic and conversion instructions in a single function. +The same result could be achieved with decorations alone but would potentially require decorating each function in a module and/or duplication +of functions that have to be used in two entry points with different default rounding/denorm/floating-point mode. + +Resolved: Keep both, the execution modes and corresponding function decorations. -- Revision History @@ -203,4 +261,5 @@ Revision History |1|2020-04-17|Mariusz Merecki|Initial revision |2|2020-04-24|Mariusz Merecki|Assigned token numbers to *RoundToInfinityINTEL* and *FloatingPointModeINTEL* |3|2020-08-03|Mariusz Merecki|Rebased to SPIR-V Version 1.5, Revision 3, Unified. Added *FunctionFloatControlINTEL* capability and *FunctionRoundingModeINTEL*, *FunctionDenormModeINTEL*, *FunctionFloatingPointModeINTEL* decorations +|4|2020-12-03|Mariusz Merecki|Described relation between execution modes and function scope and instruction scope decorations. Added validation rules. |========================================