From 601181effd8a4f275ac43685add663c91e7d0004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pekka=20J=C3=A4=C3=A4skel=C3=A4inen?= Date: Fri, 8 Apr 2022 14:54:45 +0300 Subject: [PATCH 1/3] cl_pocl_relaxed_printf_string_address_space rev 1 --- ...laxed_printf_string_address_space.asciidoc | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 extensions/cl_pocl_relaxed_printf_string_address_space.asciidoc diff --git a/extensions/cl_pocl_relaxed_printf_string_address_space.asciidoc b/extensions/cl_pocl_relaxed_printf_string_address_space.asciidoc new file mode 100644 index 000000000..bca4da5f1 --- /dev/null +++ b/extensions/cl_pocl_relaxed_printf_string_address_space.asciidoc @@ -0,0 +1,96 @@ +cl_pocl_relaxed_printf_address_space +==================================== + +// This section needs to be after the document title. +:doctype: book +:toc2: +:toc: left +:encoding: utf-8 +:lang: en +:blank: pass:[ +] +:data-uri: +:icons: font +include::../config/attribs.txt[] +:source-highlighter: coderay + +== Name Strings + ++cl_pocl_relaxed_printf_address_space+ + +== Contact + +Pekka Jääskeläinen, Parmance (pekka /at/ parmance /dot/ com) + +== Contributors + +Pekka Jääskeläinen, Parmance + +Henry Linjamäki, Parmance + +Brice Videau, Argonne National Laboratory + +== Notice + +Copyright (c) 2022 Parmance + +== Status + +Early Draft + +== Version + +Built On: {docdate} + +Revision: 1 + +== Dependencies + +This extension is written against the OpenCL Specification Version 1.2, Revision 19. + +This extension requires OpenCL 1.2. + +== Overview + +The printf as defined OpenCL 1.2 deviates from the C99 printf enough that makes +using it as a drop-in function for programs originally written in C99 and using +printf sometimes cumbersome. + +This extension addresses a major gap in this regard by allowing the format +string specifier and the arguments to the %s conversion specifier to originate +from any address space, not only from the constant address space as specified +in the OpenCL 1.2 specification. + +This relaxation implies that the format strings and the strings passed as %s +arguments can be dynamically produced during the execution time of the kernel. + +== Modifications to the OpenCL C Specification + +=== Modify Table 6.21 + +Add new function overloads (added to the bottom left cell of Table 6.21): :: ++ + +indexterm:[clGetKernelSubGroupInfoKHR] +[source,c] +---- +int printf(global char * restrict format, ...) +int printf(local char * restrict format, ...) +int printf(private char * restrict format, ...) +---- + + +=== Modify Section 6.12.13.3 - "Differences between OpenCL C and C99 printf" + +Remove the last bullet point: :: + +---- +* In OpenCL C, the conversion specifier s can only be used for arguments that +are literal strings. +---- + +== Version History + +[cols="5,15,15,70"] +[grid="rows"] +[options="header"] +|==== +| Version | Date | Author | Changes +| 1 | 2022-04-08 | Pekka Jääskeläinen | *Initial revision for comments* +|==== From 5dea5b04f92612797dd97c790ac5ceb718144570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pekka=20J=C3=A4=C3=A4skel=C3=A4inen?= Date: Sat, 14 May 2022 08:06:19 +0300 Subject: [PATCH 2/3] Changed to an ext extension --- ...axed_printf_string_address_space.asciidoc} | 14 +- ...t_relaxed_printf_string_address_space.html | 604 ++++++++++++++++++ 2 files changed, 611 insertions(+), 7 deletions(-) rename extensions/{cl_pocl_relaxed_printf_string_address_space.asciidoc => cl_ext_relaxed_printf_string_address_space.asciidoc} (86%) create mode 100644 extensions/cl_ext_relaxed_printf_string_address_space.html diff --git a/extensions/cl_pocl_relaxed_printf_string_address_space.asciidoc b/extensions/cl_ext_relaxed_printf_string_address_space.asciidoc similarity index 86% rename from extensions/cl_pocl_relaxed_printf_string_address_space.asciidoc rename to extensions/cl_ext_relaxed_printf_string_address_space.asciidoc index bca4da5f1..74b4743a1 100644 --- a/extensions/cl_pocl_relaxed_printf_string_address_space.asciidoc +++ b/extensions/cl_ext_relaxed_printf_string_address_space.asciidoc @@ -1,4 +1,4 @@ -cl_pocl_relaxed_printf_address_space +cl_ext_relaxed_printf_address_space ==================================== // This section needs to be after the document title. @@ -15,7 +15,7 @@ include::../config/attribs.txt[] == Name Strings -+cl_pocl_relaxed_printf_address_space+ ++cl_ext_relaxed_printf_address_space+ == Contact @@ -29,7 +29,7 @@ Brice Videau, Argonne National Laboratory == Notice -Copyright (c) 2022 Parmance +Copyright (c) 2022 Parmance and Argonne National Laboratory. == Status @@ -38,7 +38,7 @@ Early Draft == Version Built On: {docdate} + -Revision: 1 +Revision: 2 == Dependencies @@ -49,7 +49,7 @@ This extension requires OpenCL 1.2. == Overview The printf as defined OpenCL 1.2 deviates from the C99 printf enough that makes -using it as a drop-in function for programs originally written in C99 and using +using it as a drop-in function for programs originally written in C99 that use printf sometimes cumbersome. This extension addresses a major gap in this regard by allowing the format @@ -67,7 +67,6 @@ arguments can be dynamically produced during the execution time of the kernel. Add new function overloads (added to the bottom left cell of Table 6.21): :: + -indexterm:[clGetKernelSubGroupInfoKHR] [source,c] ---- int printf(global char * restrict format, ...) @@ -92,5 +91,6 @@ are literal strings. [options="header"] |==== | Version | Date | Author | Changes -| 1 | 2022-04-08 | Pekka Jääskeläinen | *Initial revision for comments* +| 2 | 2022-05-14 | Pekka Jääskeläinen, Brice Videau | *Changed to an 'ext' extension for multi-vendor adoption promotion.* +| 1 | 2022-04-08 | Pekka Jääskeläinen | *Initial revision for comments.* |==== diff --git a/extensions/cl_ext_relaxed_printf_string_address_space.html b/extensions/cl_ext_relaxed_printf_string_address_space.html new file mode 100644 index 000000000..88cafbdb7 --- /dev/null +++ b/extensions/cl_ext_relaxed_printf_string_address_space.html @@ -0,0 +1,604 @@ + + + + + + + +cl_ext_relaxed_printf_address_space + + + + + +
+
+

Name Strings

+
+
+

cl_ext_relaxed_printf_address_space

+
+
+
+
+

Contact

+
+
+

Pekka Jääskeläinen, Parmance (pekka /at/ parmance /dot/ com)

+
+
+
+
+

Contributors

+
+
+

Pekka Jääskeläinen, Parmance
+Henry Linjamäki, Parmance
+Brice Videau, Argonne National Laboratory

+
+
+
+
+

Notice

+
+
+

Copyright (c) 2022 Parmance and Argonne National Laboratory.

+
+
+
+
+

Status

+
+
+

Early Draft

+
+
+
+
+

Version

+
+
+

Built On: 2022-05-14
+Revision: 2

+
+
+
+
+

Dependencies

+
+
+

This extension is written against the OpenCL Specification Version 1.2, Revision 19.

+
+
+

This extension requires OpenCL 1.2.

+
+
+
+
+

Overview

+
+
+

The printf as defined OpenCL 1.2 deviates from the C99 printf enough that makes +using it as a drop-in function for programs originally written in C99 that use +printf sometimes cumbersome.

+
+
+

This extension addresses a major gap in this regard by allowing the format +string specifier and the arguments to the %s conversion specifier to originate +from any address space, not only from the constant address space as specified +in the OpenCL 1.2 specification.

+
+
+

This relaxation implies that the format strings and the strings passed as %s +arguments can be dynamically produced during the execution time of the kernel.

+
+
+
+
+

Modifications to the OpenCL C Specification

+
+
+

Modify Table 6.21

+
+
+
Add new function overloads (added to the bottom left cell of Table 6.21):
+
+
+
+
int printf(global char * restrict format, ...)
+int printf(local char * restrict format, ...)
+int printf(private char * restrict format, ...)
+
+
+
+
+
+
+
+

Modify Section 6.12.13.3 - "Differences between OpenCL C and C99 printf"

+
+
+
Remove the last bullet point:
+
+
+
+
+
* In OpenCL C, the conversion specifier s can only be used for arguments that
+are literal strings.
+
+
+
+
+
+
+

Version History

+
+ ++++++ + + + + + + + + + + + + + + + + + + + + + + +
VersionDateAuthorChanges

2

2022-05-14

Pekka Jääskeläinen, Brice Videau

Changed to an ext extension for multi-vendor adoption promotion.

1

2022-04-08

Pekka Jääskeläinen

Initial revision for comments.

+
+
+
+ + + \ No newline at end of file From e95c2be61869a7852c14187edeceee5d3bdec36a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pekka=20J=C3=A4=C3=A4skel=C3=A4inen?= Date: Mon, 13 Jun 2022 14:45:33 +0300 Subject: [PATCH 3/3] Added OpenCL C 2.0 generic address space overload. Suggested by Anastasia Stulova / Arm. --- ...laxed_printf_string_address_space.asciidoc | 45 ++++++++++--- ...t_relaxed_printf_string_address_space.html | 66 ++++++++++++++++--- 2 files changed, 92 insertions(+), 19 deletions(-) diff --git a/extensions/cl_ext_relaxed_printf_string_address_space.asciidoc b/extensions/cl_ext_relaxed_printf_string_address_space.asciidoc index 74b4743a1..3554886b5 100644 --- a/extensions/cl_ext_relaxed_printf_string_address_space.asciidoc +++ b/extensions/cl_ext_relaxed_printf_string_address_space.asciidoc @@ -25,7 +25,8 @@ Pekka Jääskeläinen, Parmance (pekka /at/ parmance /dot/ com) Pekka Jääskeläinen, Parmance + Henry Linjamäki, Parmance + -Brice Videau, Argonne National Laboratory +Brice Videau, Argonne National Laboratory + +Anastasia Stulova, Arm == Notice @@ -38,19 +39,21 @@ Early Draft == Version Built On: {docdate} + -Revision: 2 +Revision: 3 == Dependencies -This extension is written against the OpenCL Specification Version 1.2, Revision 19. +This extension is written against the OpenCL Specification Version 1.2, Revision 19 and +the OpenCL C 2.0 Specification, Revision 29. -This extension requires OpenCL 1.2. +The extension works with OpenCL 1.2 for the overloads that do not require generic address +space support, and requires at least OpenCL 2.0 for the generic address space one. == Overview -The printf as defined OpenCL 1.2 deviates from the C99 printf enough that makes -using it as a drop-in function for programs originally written in C99 that use -printf sometimes cumbersome. +The printf as originally defined in OpenCL 1.2 deviates from the C99 printf +enough that makes using it as a drop-in function for programs originally +written in C99 that use printf sometimes cumbersome. This extension addresses a major gap in this regard by allowing the format string specifier and the arguments to the %s conversion specifier to originate @@ -60,7 +63,7 @@ in the OpenCL 1.2 specification. This relaxation implies that the format strings and the strings passed as %s arguments can be dynamically produced during the execution time of the kernel. -== Modifications to the OpenCL C Specification +== Modifications to the OpenCL C 1.2 Specification === Modify Table 6.21 @@ -74,7 +77,6 @@ int printf(local char * restrict format, ...) int printf(private char * restrict format, ...) ---- - === Modify Section 6.12.13.3 - "Differences between OpenCL C and C99 printf" Remove the last bullet point: :: @@ -84,6 +86,30 @@ Remove the last bullet point: :: are literal strings. ---- +== Modifications to the OpenCL C 2.0 Specification + +=== Modify Table 20 - "Built-in printf Function" + +Add new function overloads (added to the bottom left cell of the Table): :: ++ + +[source,c] +---- +int printf(global char * restrict format, ...) +int printf(local char * restrict format, ...) +int printf(private char * restrict format, ...) +int printf(char * restrict format, ...) +---- + +=== Modify Subsection of 6.13.13, "Differences between OpenCL C and C99 printf" + +Remove the last bullet point: :: + +---- +* In OpenCL C, the conversion specifier s can only be used for arguments that +are literal strings. +---- + == Version History [cols="5,15,15,70"] @@ -91,6 +117,7 @@ are literal strings. [options="header"] |==== | Version | Date | Author | Changes +| 3 | 2022-06-13 | Pekka Jääskeläinen, Anastasia Stulova | *Added OpenCL C 2.0 'generic' address space overload.* | 2 | 2022-05-14 | Pekka Jääskeläinen, Brice Videau | *Changed to an 'ext' extension for multi-vendor adoption promotion.* | 1 | 2022-04-08 | Pekka Jääskeläinen | *Initial revision for comments.* |==== diff --git a/extensions/cl_ext_relaxed_printf_string_address_space.html b/extensions/cl_ext_relaxed_printf_string_address_space.html index 88cafbdb7..9d357a916 100644 --- a/extensions/cl_ext_relaxed_printf_string_address_space.html +++ b/extensions/cl_ext_relaxed_printf_string_address_space.html @@ -463,7 +463,8 @@

Contributors

Pekka Jääskeläinen, Parmance
Henry Linjamäki, Parmance
-Brice Videau, Argonne National Laboratory

+Brice Videau, Argonne National Laboratory
+Anastasia Stulova, Arm

@@ -487,8 +488,8 @@

Status

Version

-

Built On: 2022-05-14
-Revision: 2

+

Built On: 2022-06-13
+Revision: 3

@@ -496,10 +497,12 @@

Version

Dependencies

-

This extension is written against the OpenCL Specification Version 1.2, Revision 19.

+

This extension is written against the OpenCL Specification Version 1.2, Revision 19 and +the OpenCL C 2.0 Specification, Revision 29.

-

This extension requires OpenCL 1.2.

+

The extension works with OpenCL 1.2 for the overloads that do not require generic address +space support, and requires at least OpenCL 2.0 for the generic address space one.

@@ -507,9 +510,9 @@

Dependencies

Overview

-

The printf as defined OpenCL 1.2 deviates from the C99 printf enough that makes -using it as a drop-in function for programs originally written in C99 that use -printf sometimes cumbersome.

+

The printf as originally defined in OpenCL 1.2 deviates from the C99 printf +enough that makes using it as a drop-in function for programs originally +written in C99 that use printf sometimes cumbersome.

This extension addresses a major gap in this regard by allowing the format @@ -524,7 +527,7 @@

Overview

-

Modifications to the OpenCL C Specification

+

Modifications to the OpenCL C 1.2 Specification

Modify Table 6.21

@@ -560,6 +563,43 @@

M

+

Modifications to the OpenCL C 2.0 Specification

+
+
+

Modify Table 20 - "Built-in printf Function"

+
+
+
Add new function overloads (added to the bottom left cell of the Table):
+
+
+
+
int printf(global char * restrict format, ...)
+int printf(local char * restrict format, ...)
+int printf(private char * restrict format, ...)
+int printf(char * restrict format, ...)
+
+
+
+
+
+
+
+

Modify Subsection of 6.13.13, "Differences between OpenCL C and C99 printf"

+
+
+
Remove the last bullet point:
+
+
+
+
+
* In OpenCL C, the conversion specifier s can only be used for arguments that
+are literal strings.
+
+
+
+
+
+

Version History

@@ -579,6 +619,12 @@

Version History

+ + + + + + @@ -597,7 +643,7 @@

Version History

3

2022-06-13

Pekka Jääskeläinen, Anastasia Stulova

Added OpenCL C 2.0 generic address space overload.

2

2022-05-14

Pekka Jääskeläinen, Brice Videau