Skip to content

Commit 1dfc9b4

Browse files
authored
remove the OpenCL extension specification (#1516)
* move extension content into the OpenCL API and OpenCL C specifications * tidy up * remove the toolchain for building the OpenCL extension specification * remove a few more references to the extensions spec * remove the dead link reference page There should be no more dead links. * add refpage markup for extension conventions and function pointers
1 parent 86fe52c commit 1dfc9b4

21 files changed

Lines changed: 294 additions & 1008 deletions

.github/workflows/presubmit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
4646
- name: Generate core specs (HTML and PDF)
4747
run: |
48-
python3 makeSpec -clean -spec core OUTDIR=out.core -j 5 -O api c env ext cxx4opencl
48+
python3 makeSpec -clean -spec core OUTDIR=out.core -j 5 -O api c env cxx4opencl
4949
5050
- name: Generate core + KHR extension specs (HTML)
5151
run: |

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
4444
- name: Build Specs
4545
run: |
46-
python3 makeSpec -clean -spec khr+ext OUTDIR=out.release -j 5 api c env ext cxx4opencl
46+
python3 makeSpec -clean -spec khr+ext OUTDIR=out.release -j 5 api c env cxx4opencl
4747
4848
- name: Release Specs
4949
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0

Makefile

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -173,16 +173,14 @@ $(OUTDIR)/katex/README.md: katex/README.md
173173
$(QUIET)$(RMRF) $(OUTDIR)/katex
174174
$(QUIET)$(CP) -rf katex $(OUTDIR)
175175

176-
all: api env ext extensions cxx c icdinst
176+
all: api env extensions cxx c icdinst
177177

178178
allman: manhtmlpages
179179

180180
api: apihtml apipdf
181181

182182
env: envhtml envpdf
183183

184-
ext: exthtml extpdf
185-
186184
extensions: extensionshtml extensionspdf
187185

188186
cxx: cxxhtml cxxpdf
@@ -193,13 +191,13 @@ c: chtml cpdf
193191

194192
icdinst: icdinsthtml icdinstpdf
195193

196-
html: apihtml envhtml exthtml extensionshtml cxxhtml chtml icdinsthtml
194+
html: apihtml envhtml extensionshtml cxxhtml chtml icdinsthtml
197195

198196
# PDF optimizer - usage $(OPTIMIZEPDF) in.pdf out.pdf
199197
# OPTIMIZEPDFOPTS=--compress-pages is slightly better, but much slower
200198
OPTIMIZEPDF = hexapdf optimize $(OPTIMIZEPDFOPTS)
201199

202-
pdf: apipdf envpdf extpdf extensionspdf cxxpdf cpdf icdinstpdf
200+
pdf: apipdf envpdf extensionspdf cxxpdf cpdf icdinstpdf
203201

204202
# Spec targets.
205203
# There is some complexity to try and avoid short virtual targets like
@@ -256,24 +254,6 @@ $(PDFDIR)/$(ENVSPEC).pdf: $(ENVSPECSRC)
256254
$(QUIET)$(ASCIIDOCTOR) -b pdf $(ADOCOPTS) $(ADOCPDFOPTS) -o $@ $(ENVSPEC).txt
257255
$(QUIET)$(OPTIMIZEPDF) $@ $@.out.pdf && mv $@.out.pdf $@
258256

259-
# Extensions spec
260-
EXTSPEC = OpenCL_Ext
261-
EXTSPECSRC = $(EXTSPEC).txt $(GENDEPENDS) \
262-
$(shell scripts/find_adoc_deps $(EXTSPEC).txt $(GENERATED))
263-
264-
exthtml: $(HTMLDIR)/$(EXTSPEC).html $(EXTSPECSRC)
265-
266-
$(HTMLDIR)/$(EXTSPEC).html: $(EXTSPECSRC) $(KATEXINST)
267-
$(QUIET)$(ASCIIDOCTOR) -b html5 $(ADOCOPTS) $(ADOCHTMLOPTS) -o $@ $(EXTSPEC).txt
268-
269-
extpdf: $(PDFDIR)/$(EXTSPEC).pdf $(EXTSPECSRC)
270-
271-
$(PDFDIR)/$(EXTSPEC).pdf: $(EXTSPECSRC)
272-
$(QUIET)$(MKDIR) $(PDFDIR)
273-
$(QUIET)$(MKDIR) $(PDFMATHDIR)
274-
$(QUIET)$(ASCIIDOCTOR) -b pdf $(ADOCOPTS) $(ADOCPDFOPTS) -o $@ $(EXTSPEC).txt
275-
$(QUIET)$(OPTIMIZEPDF) $@ $@.out.pdf && mv $@.out.pdf $@
276-
277257
# Individual extensions spec(s)
278258
EXTDIR = extensions
279259
EXTENSIONSSPEC = extensions

OpenCL_C.txt

Lines changed: 85 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,9 @@ Extensions to OpenCL C are described in the OpenCL C specification or in
287287
vendor-provided documentation.
288288
When an OpenCL C extension is supported an associated extension macro will be
289289
predefined.
290-
Please refer to the <<opencl-extension-spec,OpenCL Extension Specification>> for
291-
more information about predefined extension macros.
290+
Please refer to <<preprocessor-directives-for-optional-extensions,Preprocessor
291+
Directives for Optional Extensions>> for more information about predefined
292+
extension macros.
292293

293294
When an optional core language feature began as an extension it may have both an
294295
associated feature macro and an associated extension macro. If an optional core
@@ -3979,6 +3980,7 @@ ifdef::cl_khr_initialize_memory[]
39793980
endif::cl_khr_initialize_memory[]
39803981

39813982

3983+
[[EXTENSION]]
39823984
[[preprocessor-directives-and-macros]]
39833985
== Preprocessor Directives and Macros
39843986

@@ -4008,10 +4010,6 @@ following forms whose meanings are described elsewhere:
40084010
----------
40094011
// on-off-switch is one of ON, OFF, or DEFAULT
40104012
#pragma OPENCL FP_CONTRACT on-off-switch
4011-
4012-
#pragma OPENCL EXTENSION extensionname : behavior
4013-
4014-
#pragma OPENCL EXTENSION all : behavior
40154013
----------
40164014

40174015
The following predefined macro names are available.
@@ -4116,6 +4114,86 @@ indicating optional language features. Such macros are listed in the
41164114
--
41174115

41184116

4117+
[[preprocessor-directives-for-optional-extensions]]
4118+
=== Preprocessor Directives for Optional Extensions
4119+
4120+
The *#pragma OPENCL EXTENSION* directive controls the behavior of the OpenCL
4121+
compiler with respect to extensions.
4122+
The *#pragma OPENCL EXTENSION* directive is defined as:
4123+
4124+
[source,opencl_c]
4125+
----
4126+
#pragma OPENCL EXTENSION <extension_name> : <behavior>
4127+
#pragma OPENCL EXTENSION all : <behavior>
4128+
----
4129+
4130+
where _extension_name_ is the name of the extension.
4131+
The token *all* means that the behavior applies to all extensions supported
4132+
by the compiler.
4133+
The _behavior_ can be set to one of the following values given by the table
4134+
below.
4135+
4136+
[cols="1,3",options="header",]
4137+
|====
4138+
| *behavior* | *Description*
4139+
| *enable*
4140+
| Behave as specified by the extension _extension_name_.
4141+
4142+
Report an error on the *`#pragma OPENCL EXTENSION`* if the
4143+
_extension_name_ is not supported, or if *all* is specified.
4144+
4145+
| *disable*
4146+
| Behave (including issuing errors and warnings) as if the extension
4147+
_extension_name_ is not part of the language definition.
4148+
4149+
If *all* is specified, then behavior must revert back to that of the
4150+
non-extended core version of the language being compiled to.
4151+
4152+
Warn on the *`#pragma OPENCL EXTENSION`* if the extension _extension_name_
4153+
is not supported.
4154+
4155+
|====
4156+
4157+
The *`#pragma OPENCL EXTENSION`* directive is a simple, low-level mechanism
4158+
to set the behavior for each extension.
4159+
It does not define policies such as which combinations are appropriate;
4160+
those must be defined elsewhere.
4161+
The order of directives matter in setting the behavior for each extension.
4162+
Directives that occur later override those seen earlier.
4163+
The *all* variant sets the behavior for all extensions, overriding all
4164+
previously issued extension directives, but only if the _behavior_ is set to
4165+
*disable*.
4166+
4167+
The initial state of the compiler is as if the directive
4168+
4169+
[source,opencl_c]
4170+
----
4171+
#pragma OPENCL EXTENSION all : disable
4172+
----
4173+
4174+
was issued, telling the compiler that all error and warning reporting must
4175+
be done according to this specification, ignoring any extensions.
4176+
4177+
Every extension which affects the OpenCL language semantics, syntax or adds
4178+
built-in functions to the language must create a preprocessor `#define` that
4179+
matches the extension name string.
4180+
This `#define` would be available in the language if and only if the
4181+
extension is supported on a given implementation.
4182+
4183+
For example, compilers that support the {cl_khr_3d_image_writes_EXT} extension
4184+
will add a preprocessor `#define` called {cl_khr_3d_image_writes_EXT}.
4185+
A kernel can now use this preprocessor `#define` to do something like:
4186+
4187+
[source,opencl_c]
4188+
----
4189+
#ifdef cl_khr_3d_image_writes
4190+
// do something using the extension
4191+
#else
4192+
// do something else or #error!
4193+
#endif
4194+
----
4195+
4196+
41194197
[[attribute-qualifiers]]
41204198
== Attribute Qualifiers
41214199

@@ -4586,9 +4664,6 @@ compile-time constant expression.
45864664

45874665
The attribute syntax can be extended for standard language extensions and
45884666
vendor specific extensions.
4589-
Any extensions should follow the naming conventions outlined in the
4590-
introduction to <<opencl-extension-spec,section 9 in the OpenCL 2.0
4591-
Extension Specification>>.
45924667

45934668
Attributes are intended as useful hints to the compiler.
45944669
It is our intention that a particular implementation of OpenCL be free to
@@ -12384,7 +12459,7 @@ endif::cl_khr_mipmap_image_writes[]
1238412459
[[built-in-image-query-functions]]
1238512460
==== Built-in Image Query Functions
1238612461

12387-
[open,refpage='imageQueryFunctions',desc='Built-in Image Query Functions',type='freeform',spec='clang',anchor='built-in-image-query-functions',xrefs='imageReadFunctions imageSamplerlessReadFunctions imageWriteFunctions',alias='get_image_width get_image_height get_image_depth get_image_channel_data_type get_image_channel_order get_image_dim get_image_array_size']
12462+
[open,refpage='imageQueryFunctions',desc='Built-in Image Query Functions',type='freeform',spec='clang',anchor='built-in-image-query-functions',xrefs='imageReadFunctions imageSamplerlessReadFunctions imageWriteFunctions',alias='get_image_width get_image_height get_image_depth get_image_channel_data_type get_image_channel_order get_image_dim get_image_array_size get_image_num_samples get_image_num_mip_levels']
1238812463
--
1238912464

1239012465
The following built-in function calls to query image information are
@@ -17835,10 +17910,6 @@ one of the integers 0, 1, ... h~t~ - 1.
1783517910
"`Image Format Descriptor`" section (5.3.1.1), and the individual
1783617911
channel data types are defined in the "`List of supported Image Channel
1783717912
Data Types" table (5.7) of that Specification.
17838-
. [[opencl-extension-spec]] "`The OpenCL Extension Specification, Version
17839-
3.0, Unified`", https://www.khronos.org/registry/OpenCL/ .
17840-
References are to sections and tables of this specific version, although
17841-
other versions exists.
1784217913
. [[sRGB-spec]] "`IEC 61966-2-1:1999 Multimedia systems and equipment -
1784317914
Colour measurement and management - Part 2-1: Colour management -
1784417915
Default RGB colour space - sRGB`",

OpenCL_Ext.txt

Lines changed: 0 additions & 62 deletions
This file was deleted.

README.adoc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ We intend to maintain a linear history on the GitHub `main` branch.
6363
| `cxx/` | Individual sections of the C++ Specification
6464
| `OpenCL_Env.txt` | Main source file for the OpenCL SPIR-V Environment Specification
6565
| `env/` | Individual sections of the Environment Specification
66-
| `OpenCL_Ext.txt` | Main source file for the OpenCL Extensions Specification
67-
| `ext/` | Individual sections of the Extensions Specification
6866
| `CXX_for_OpenCL.txt` | Main source file for the C++ for OpenCL Documentation
6967
| `cxx4opencl/` | Individual sections of the C++ for OpenCL Documentation
7068
| `images/` | Shared images, used by all specs

0 commit comments

Comments
 (0)