Name Strings
SPV_KHR_no_integer_wrap_decoration
Contact
To report problems with this extension, please open a new issue at:
Contributors
-
Pawel Jurek, Intel
-
Mariusz Merecki, Intel
-
Ben Ashbaugh, Intel
-
Faith Ekstrand, Intel
-
Neil Henning, AMD
-
John Kessenich, Google
-
Graeme Leese, Broadcom
-
Ruihao Zhang, Qualcomm
Notice
Copyright (c) 2018 The Khronos Group Inc. Copyright terms at http://www.khronos.org/registry/speccopyright.html
Status
-
Approved by the SPIR Working Group: 2018-10-03
-
Ratified by Khronos 2018-11-16
Version
Last Modified Date |
2018-09-11 |
Revision |
4 |
Dependencies
This extension is written against the SPIR-V Specification, Version 1.3, Revision 3, Unified
This extension is written against the SPIR-V Extended Instructions for GLSL, Version 1.00, Revision 7
This extension is written against the OpenCL Extended Instruction Set Specification, Version 1.00, Revision 4
This extension requires SPIR-V 1.0.
Overview
This extension adds new decorations to indicate that a given instruction does not cause integer wrapping to occur, in the form of overflow or underflow.
Extension Name
To use this extension within a SPIR-V module, the following OpExtension must be present in the module:
OpExtension "SPV_KHR_no_integer_wrap_decoration"
New Decorations
This extension introduces the following new decorations:
NoSignedWrap NoUnsignedWrap
Token Number Assignments
NoSignedWrap |
4469 |
NoUnsignedWrap |
4470 |
Modifications to the SPIR-V Specification, Version 1.3, Revision 3, Unified
Validation Rules
An OpExtension must be added to the SPIR-V for validation layers to check legal use of this extension:
OpExtension "SPV_KHR_no_integer_wrap_decoration"
Modify Section 2.16.1, Universal Validation Rules, adding the following rules:
-
NoSignedWrap decoration defined in this extension can be applied only to the following instructions:
-
OpIAdd
-
OpISub
-
OpIMul
-
OpShiftLeftLogical
-
OpSNegate
-
OpExtInst with instruction numbers specified in the extended instruction-set specifications as accepting the decoration.
-
-
NoUnsignedWrap decoration defined in this extension can be applied only to the following instructions:
-
OpIAdd
-
OpISub
-
OpIMul
-
OpShiftLeftLogical
-
OpExtInst with instruction numbers specified in the extended instruction-set specifications as accepting the decoration.
-
Decorations
Modify Section 3.20, "Decoration", adding these rows to the Decoration table:
Decoration | Enabling Capabilities | Extra Operands | |
---|---|---|---|
4469 |
NoSignedWrap If the instruction decorated with NoSignedWrap does overflow or underflow, the behavior is undefined. |
||
4470 |
NoUnsignedWrap If the instruction decorated with NoUnsignedWrap does overflow or underflow, the behavior is undefined. |
Modifications to the SPIR-V Extended Instructions for GLSL, Version 1.00, Revision 7
Modify Section 2, "Binary Form", adding the following text to the SAbs instruction description in the Extended instructions table:
This instruction can be decorated with NoSignedWrap decoration.
Modifications to the OpenCL Extended Instruction Set Specification, Version 1.00, Revision 4
Modify Section 2.2, "Integer Instructions", adding the following text to the s_abs instruction description:
This instruction can be decorated with NoSignedWrap decoration.
Issues
1) Should we add a floating point version of the decoration?
RESOLVED: No. A new decoration would provide the same information as FP Fast Math Mode.
Revision History
Rev | Date | Author | Changes |
---|---|---|---|
1 |
2018-08-10 |
Pawel Jurek |
Initial revision |
2 |
2018-08-23 |
Mariusz Merecki |
Rename to KHR, remove the capability, allow new decorations on OpUDiv, OpUMod, OpSNegate, OpSDiv, OpSMod and OpSRem. |
3 |
2018-08-29 |
Mariusz Merecki |
Use the term wrap instead of overflow in the extension name and new decorations, remove OpUMod, OpSMod and OpSRem from the list of instructions allowed to be decorated with new decorations. |
4 |
2018-09-11 |
Mariusz Merecki |
Remove OpUDiv and OpSDiv from the list of instructions allowed to be decorated with new decorations. |