|
| 1 | +:extension_name: SPV_INTEL_non_constant_addrspace_printf |
| 2 | +:capability_name: NonConstantAddrspacePrintfINTEL |
| 3 | +:capability_token: 6411 |
| 4 | + |
| 5 | +{extension_name} |
| 6 | +================ |
| 7 | + |
| 8 | + |
| 9 | +== Name Strings |
| 10 | + |
| 11 | +{extension_name} |
| 12 | + |
| 13 | +== Contact |
| 14 | + |
| 15 | +To report problems with this extension, please open a new issue at: |
| 16 | + |
| 17 | +https://github.com/intel/llvm |
| 18 | + |
| 19 | +== Contributors |
| 20 | + |
| 21 | +- Leonid Pauzin, Intel + |
| 22 | +- Dmitry Sidorov, Intel + |
| 23 | +- Nikita Kornev, Intel + |
| 24 | + |
| 25 | +== Notice |
| 26 | + |
| 27 | +Copyright (c) 2022 Intel Corporation. All rights reserved. |
| 28 | + |
| 29 | +== Status |
| 30 | + |
| 31 | +Working Draft |
| 32 | + |
| 33 | +This is a preview extension specification, intended to provide early access to a |
| 34 | +feature for review and community feedback. When the feature matures, this |
| 35 | +specification may be released as a formal extension. |
| 36 | + |
| 37 | + |
| 38 | +Because the interfaces defined by this specification are not final and are |
| 39 | +subject to change they are not intended to be used by shipping software |
| 40 | +products. If you are interested in using this feature in your software product, |
| 41 | +please let us know! |
| 42 | + |
| 43 | +== Version |
| 44 | + |
| 45 | +[width="40%",cols="25,25"] |
| 46 | +|======================================== |
| 47 | +| Last Modified Date | 2022-01-13 |
| 48 | +| Revision | 1 |
| 49 | +|======================================== |
| 50 | + |
| 51 | +== Dependencies |
| 52 | + |
| 53 | +This extension is written against the SPIR-V Specification, |
| 54 | +Version 1.5, Revision 6. |
| 55 | + |
| 56 | +Also it modifies OpenCL Extended Instruction Set Specification, Version 1.00, |
| 57 | +Revision 7. |
| 58 | + |
| 59 | +This extension requires SPIR-V 1.0. |
| 60 | + |
| 61 | +== Overview |
| 62 | + |
| 63 | +The extension allows format argument of the extended SPIR-V instruction *printf* |
| 64 | +to be a pointer in generic, private, local and global address spaces. |
| 65 | + |
| 66 | + |
| 67 | +== Extension Name |
| 68 | + |
| 69 | + |
| 70 | +To use this extension within a SPIR-V module, the appropriate *OpExtension* must |
| 71 | +be present in the module: |
| 72 | + |
| 73 | +[subs="attributes"] |
| 74 | +---- |
| 75 | +OpExtension "{extension_name}" |
| 76 | +---- |
| 77 | + |
| 78 | +== New Capabilities |
| 79 | + |
| 80 | +This extension introduces new capabilities: |
| 81 | + |
| 82 | +[subs="attributes"] |
| 83 | +---- |
| 84 | +{capability_name} |
| 85 | +---- |
| 86 | + |
| 87 | +== Token Number Assignments |
| 88 | + |
| 89 | +[width="40%"] |
| 90 | +[cols="70%,30%"] |
| 91 | +[grid="rows"] |
| 92 | +|==== |
| 93 | +|*{capability_name}* | {capability_token} |
| 94 | +|==== |
| 95 | + |
| 96 | +== Modifications to the SPIR-V Specification, Version 1.5 |
| 97 | + |
| 98 | + |
| 99 | +=== Capabilities |
| 100 | + |
| 101 | +Modify Section 3.31, Capability, adding rows to the Capability table: |
| 102 | + |
| 103 | +-- |
| 104 | +[options="header"] |
| 105 | +|==== |
| 106 | +2+^| Capability ^| Implicitly Declares |
| 107 | +| {capability_token} | *{capability_name}* |
| 108 | +| Reserved. + |
| 109 | + + |
| 110 | +See also extension: *{extension_name}* |
| 111 | +|==== |
| 112 | +-- |
| 113 | + |
| 114 | + |
| 115 | +== Modifications to the OpenCL Extended Instruction Set Specification, Version 1.0, Revision 6 |
| 116 | + |
| 117 | + |
| 118 | +=== Misc instructions |
| 119 | + |
| 120 | +Modify Section 2.8, _printf_ definition: |
| 121 | + |
| 122 | +[cols="8", width="100%"] |
| 123 | +|==== |
| 124 | +8+^|*printf* + |
| 125 | +The _printf_ extended instruction writes output to an implementation-defined |
| 126 | +stream such as stdout under control of the string pointed to by format that |
| 127 | +specifies how subsequent arguments are converted for output. If there are |
| 128 | +insufficient arguments for the format, the behavior is undefined. If the format |
| 129 | +is exhausted while arguments remain, the excess arguments are evaluated (as |
| 130 | +always) but are otherwise ignored. The printf instruction returns when the end |
| 131 | +of the format string is encountered. The format string must be resolvable at |
| 132 | +compile time, i.e. cannot be dynamically created by the executing program |
| 133 | +itself. |
| 134 | + |
| 135 | +_printf_ returns 0 if it was executed successfully and -1 otherwise |
| 136 | + |
| 137 | +_Result Type_ must be _i32_. |
| 138 | + |
| 139 | +_format_ must be a _pointer(constant, generic, private, local, global)_ to _i8_. |
| 140 | + |
| 141 | +| 6 + variable | 12 | _<id>_ + |
| 142 | + _Result Type_ | _Result <id>_ | extended + |
| 143 | + instructions set + |
| 144 | + _<id>_ | 184 | _<id>_ + |
| 145 | + _format_ | _<id>, <id>, …_ + |
| 146 | + _additional_ + |
| 147 | + _arguments_ |
| 148 | +|==== |
| 149 | + |
| 150 | + |
| 151 | +=== Issues |
| 152 | + |
| 153 | +None |
| 154 | + |
| 155 | +Revision History |
| 156 | +---------------- |
| 157 | +
|
| 158 | +[cols="5,15,15,70"] |
| 159 | +[grid="rows"] |
| 160 | +[options="header"] |
| 161 | +|======================================== |
| 162 | +|Rev|Date|Author|Changes |
| 163 | +|1|2022-01-13|Leonid Pauzin|Initial revision |
| 164 | +|======================================== |
0 commit comments