Skip to content

Commit 844fa88

Browse files
authored
OpenCL 3.0 Refpages (#671)
* First cut at 3.0 refpages Import relevant changes from update-refpages-2.2-from-0a92eee branch Update copyrights on relevant files to use SPDX license identifiers (should do this for all files and make repository REUSE-compliant, but that's a different issue). Update refpage generation scripts to use 3.0 specs / version numbers instead of 2.2. * Fix problem with clCreateImageWithProperties rewrite rule * Synchronize scripts, improve generation actions (#680) * Move extracted refpage sources to generated/refpages Considerable changes to the Makefile to accomplish this, but basically a no-op in terms of the output HTML. Also a few minor fixes to address build warnings. * Further Makefile cleanup to copy static files to the right place Also cleans up copyright boilerplate to avoid duplicate section titles. * Build refpages as part of CI
1 parent 4e84f10 commit 844fa88

94 files changed

Lines changed: 2380 additions & 1225 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ before_install:
1818

1919
script:
2020
- git describe --tags --dirty
21-
- make api c env ext cxx4opencl
21+
- make -O -j 5 api c env ext cxx4opencl manhtmlpages
2222

2323
deploy:
2424
provider: releases

Makefile

Lines changed: 45 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,23 @@ SPECREMARK = from git branch: $(shell echo `git symbolic-ref --short HEAD`) \
6969
commit: $(shell echo `git log -1 --format="%H"`)
7070
endif
7171

72-
ATTRIBOPTS_NO_VERSION = -a revdate="$(SPECDATE)" \
73-
-a revremark="$(SPECREMARK)" \
74-
-a stem=latexmath \
75-
-a generated=$(GENERATED) \
76-
-a sectnumlevels=5
72+
ATTRIBOPTS_NO_VERSION = -a revdate="$(SPECDATE)" \
73+
-a revremark="$(SPECREMARK)" \
74+
-a stem=latexmath \
75+
-a generated=$(GENERATED) \
76+
-a sectnumlevels=5
7777

7878
ATTRIBOPTS = -a revnumber="$(SPECREVISION)" \
79-
$(ATTRIBOPTS_NO_VERSION)
79+
$(ATTRIBOPTS_NO_VERSION)
8080

81-
ADOCEXTS = -r $(CURDIR)/config/sectnumoffset-treeprocessor.rb -r $(CURDIR)/config/spec-macros.rb
81+
ADOCEXTS = -r $(CURDIR)/config/sectnumoffset-treeprocessor.rb -r $(CURDIR)/config/spec-macros.rb
8282
ADOCOPTS_NO_VERSION = -d book $(ATTRIBOPTS_NO_VERSION) $(NOTEOPTS) $(VERBOSE) $(ADOCEXTS)
83-
ADOCOPTS = -d book $(ATTRIBOPTS) $(NOTEOPTS) $(VERBOSE) $(ADOCEXTS)
84-
ADOCMANOPTS = -d manpage $(ATTRIBOPTS) $(NOTEOPTS) $(VERBOSE) $(ADOCEXTS)
83+
ADOCCOMMONOPTS = -a apispec="$(CURDIR)/api" \
84+
-a config="$(CURDIR)/config" \
85+
-a cspec="$(CURDIR)/c" \
86+
$(ATTRIBOPTS) $(NOTEOPTS) $(VERBOSE) $(ADOCEXTS)
87+
ADOCOPTS = -d book $(ADOCCOMMONOPTS)
88+
ADOCMANOPTS = -d manpage $(ADOCCOMMONOPTS)
8589

8690
# ADOCHTMLOPTS relies on the relative runtime path from the output HTML
8791
# file to the katex scripts being set with KATEXDIR. This is overridden
@@ -103,6 +107,7 @@ ADOCPDFOPTS = $(ADOCPDFEXTS) -a mathematical-format=svg \
103107
# the API interface includes.
104108
# GENDEPENDS could have multiple dependencies.
105109
GENERATED = $(CURDIR)/generated
110+
REFPATH = $(GENERATED)/refpage
106111
APIINCDIR = $(GENERATED)/api
107112
VERSIONDIR = $(APIINCDIR)/version-notes
108113
GENDEPENDS = $(APIINCDIR)/timeMarker
@@ -395,9 +400,9 @@ clean_pdf:
395400
$(QUIET)$(RMRF) $(PDFDIR) $(PDFMATHDIR)
396401

397402
clean_generated:
398-
$(QUIET)$(RMRF) $(APIINCDIR)/* $(SCRIPTS)/clapi.py
399-
$(QUIET)$(RM) man/apispec.txt $(MANGENSOURCES) $(MANTMP)
403+
$(QUIET)$(RMRF) $(APIINCDIR)/* $(GENERATED)/api.py $($(REFPATH)/
400404
$(QUIET)$(RMRF) $(PDFMATHDIR)
405+
$(QUIET)$(RMRF) $(GENERATED)/__pycache__
401406

402407
# Ref page targets for individual pages
403408
MANDIR := man
@@ -406,22 +411,12 @@ MANSECTION := 3
406411
# These lists should be autogenerated
407412

408413
# Ref page sources for all CL interfaces
409-
# Most are autogenerated; $(MANCOPYRIGHT) are static
410-
411-
# Static asciidoctor files in the man/ directory that aren't refpages
412-
MANCOPYRIGHT = $(MANDIR)/copyright-ccby.txt $(MANDIR)/footer.txt
414+
# Most are autogenerated; man/static/*.txt are hand-coded at present
413415

414416
# MANSOURCES is the list of individual refpage sources, excluding the
415-
# copyright, single-page index, and any include files.
416-
MANSOURCES = $(filter-out $(MANCOPYRIGHT) $(MANDIR)/apispec.txt $(wildcard $(MANDIR)/*Inc.txt), $(wildcard $(MANDIR)/[A-Za-z]*.txt))
417-
418-
# MANGENSOURCES is the list of generated refpage sources, excluding the
419-
# static index page but including the files copied from static/
420-
MANGENSOURCES= $(filter-out $(MANDIR)/intro.txt, $(MANSOURCES))
421-
422-
# MANTMP are temp files created by the rules
423-
MANTMP = $(LOGFILE) $(MANDIR)/tocbody $(MANDIR)/toc.html \
424-
$(MANDIR)/rewritebody $(MANDIR)/.htaccess
417+
# single-page index, boilerplate document footer, and include files.
418+
# For now, always build all refpages.
419+
MANSOURCES = $(filter-out $(REFPATH)/apispec.txt $(REFPATH)/footer.txt $(wildcard $(REFPATH)/*Inc.txt), $(wildcard $(REFPATH)/*.txt))
425420

426421
# Generation of ref page asciidoctor sources by extraction from the
427422
# specification(s).
@@ -432,49 +427,53 @@ MANTMP = $(LOGFILE) $(MANDIR)/tocbody $(MANDIR)/toc.html \
432427
#
433428
# Should pass in $(EXTOPTIONS) to determine which pages to generate.
434429
# For now, all core and extension ref pages are extracted by genRef.py.
435-
LOGFILE = man/logfile
436430
## Temporary - eventually should be all spec asciidoctor source files
437-
SPECFILES = $(wildcard api/*.asciidoc) $(wildcard man/static/*.txt) OpenCL_API.txt OpenCL_C.txt
438-
##SPECFILES = api/opencl_platform_layer.txt
431+
SPECFILES = $(wildcard api/*.asciidoc) OpenCL_API.txt OpenCL_C.txt
439432
SCRIPTS = scripts
440433
GENREF = $(SCRIPTS)/genRef.py
434+
LOGFILE = $(REFPATH)/refpage.log
441435

442-
man/apispec.txt: $(SPECFILES) $(GENREF) $(SCRIPTS)/reflib.py $(SCRIPTS)/clapi.py
443-
$(PYTHON) $(GENREF) -rewrite man/rewritebody -toc man/tocbody \
436+
refpages: $(REFPATH)/apispec.txt
437+
$(REFPATH)/apispec.txt: $(SPECFILES) $(GENREF) $(SCRIPTS)/reflib.py $(GENERATED)/api.py
438+
$(QUIET)$(MKDIR) $(REFPATH)
439+
$(PYTHON) $(GENREF) -genpath $(GENERATED) -basedir $(REFPATH) \
440+
-rewrite $(REFPATH)/rewritebody -toc $(REFPATH)/tocbody \
444441
-log $(LOGFILE) $(SPECFILES)
445-
cat man/tochead man/tocbody man/toctail > man/toc.html
446-
cat man/rewritehead > man/.htaccess
447-
sort < man/rewritebody >> man/.htaccess
448-
$(CP) -p $(MANDIR)/static/*.txt $(MANDIR)/
442+
cat $(MANDIR)/tochead $(REFPATH)/tocbody $(MANDIR)/toctail > $(REFPATH)/toc.html
443+
(cat $(MANDIR)/rewritehead ; \
444+
echo ; echo "# Aliases hard-coded in refpage markup" ; \
445+
sort < $(REFPATH)/rewritebody) > $(REFPATH)/.htaccess
446+
$(CP) $(MANDIR)/static/*.txt $(REFPATH)
449447

450448
# These targets are HTML5 ref pages
451449
#
452450
# The recursive $(MAKE) is an apparently unavoidable hack, since the
453451
# actual list of man page sources isn't known until after
454-
# man/apispec.txt is generated. $(GENDEPENDS) is generated before
452+
# $(REFPATH)/apispec.txt is generated. $(GENDEPENDS) is generated before
455453
# running the recursive make, so it doesn't trigger twice
456-
manhtmlpages: man/apispec.txt $(GENDEPENDS)
454+
manhtmlpages: $(REFPATH)/apispec.txt $(GENDEPENDS)
457455
$(MAKE) -e buildmanpages
458-
$(CP) $(MANDIR)/*.jpg $(MANDIR)/*.gif $(MANDIR)/*.css $(MANDIR)/*.html $(MANHTMLDIR)
459-
$(CP) $(MANDIR)/.htaccess $(MANHTMLDIR)/.htaccess
456+
$(CP) $(MANDIR)/*.html $(MANDIR)/*.css $(MANDIR)/*.gif $(MANDIR)/*.jpg $(MANHTMLDIR)
457+
$(CP) $(REFPATH)/.htaccess $(REFPATH)/*.html $(MANHTMLDIR)
460458

461459
MANHTMLDIR = $(OUTDIR)/man/html
462-
MANHTML = $(MANSOURCES:$(MANDIR)/%.txt=$(MANHTMLDIR)/%.html)
460+
MANHTML = $(MANSOURCES:$(REFPATH)/%.txt=$(MANHTMLDIR)/%.html)
461+
463462
buildmanpages: $(MANHTML)
464463

465464
$(MANHTMLDIR)/%.html: KATEXDIR = ../../katex
466-
$(MANHTMLDIR)/%.html: $(MANDIR)/%.txt $(MANCOPYRIGHT) $(GENDEPENDS) $(KATEXINST)
465+
$(MANHTMLDIR)/%.html: $(REFPATH)/%.txt $(MANCOPYRIGHT) $(GENDEPENDS) $(KATEXINST)
467466
$(QUIET)$(MKDIR) $(MANHTMLDIR)
468467
$(QUIET)$(ASCIIDOCTOR) -b html5 -a cross-file-links \
469468
$(ADOCMANOPTS) $(ADOCHTMLOPTS) -o $@ $<
470469

471-
$(MANHTMLDIR)/intro.html: $(MANDIR)/intro.txt $(MANCOPYRIGHT)
470+
$(MANHTMLDIR)/intro.html: $(REFPATH)/intro.txt $(MANCOPYRIGHT)
472471
$(QUIET)$(MKDIR) $(MANHTMLDIR)
473472
$(QUIET)$(ASCIIDOCTOR) -b html5 -a cross-file-links \
474473
$(ADOCOPTS) $(ADOCHTMLOPTS) -o $@ $<
475474

476475
# Targets generated from the XML and registry processing scripts
477-
# clapi.py - Python encoding of the registry
476+
# api.py - Python encoding of the registry
478477
# $(APIINCDIR)/timeMarker - proxy for 'apiinc' - generate API interfaces
479478
#
480479
# $(GENSCRIPTEXTRA) are extra options that can be passed to the
@@ -489,15 +488,14 @@ VERSIONSCRIPT = $(SCRIPTS)/gen_version_notes.py
489488
GENSCRIPTOPTS = $(VERSIONOPTIONS) $(EXTOPTIONS) $(GENSCRIPTEXTRA) -registry $(APIXML)
490489
GENSCRIPTEXTRA =
491490

492-
$(SCRIPTS)/clapi.py: $(APIXML) $(GENSCRIPT)
493-
$(QUIET)$(PYTHON) $(GENSCRIPT) $(GENSCRIPTOPTS) -o $(SCRIPTS) clapi.py
491+
$(GENERATED)/api.py: $(APIXML) $(GENSCRIPT)
492+
$(QUIET)$(PYTHON) $(GENSCRIPT) $(GENSCRIPTOPTS) -o $(GENERATED) api.py
494493

495494
apiinc: $(APIINCDIR)/timeMarker
496495

497496
$(APIINCDIR)/timeMarker: $(APIXML) $(DICTSCRIPT) $(GENSCRIPT) $(VERSIONSCRIPT)
498-
$(QUIET)$(MKDIR) -p $(APIINCDIR)
497+
$(QUIET)$(MKDIR) $(APIINCDIR)
499498
$(QUIET)$(PYTHON) $(DICTSCRIPT) -registry $(APIXML) -o $(APIINCDIR)
500-
$(QUIET)$(MKDIR) -p $(VERSIONDIR)
499+
$(QUIET)$(MKDIR) $(VERSIONDIR)
501500
$(QUIET)$(PYTHON) $(VERSIONSCRIPT) -registry $(APIXML) -o $(VERSIONDIR)
502501
$(QUIET)$(PYTHON) $(GENSCRIPT) $(GENSCRIPTOPTS) -o $(APIINCDIR) apiinc
503-

OpenCL_C.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ for earlier OpenCL C versions are allowed to define feature test macros
221221
but they are not required to do so. This means that applications which
222222
target earlier OpenCL C versions should not rely on the presence of
223223
feature test macros because there is no guarantee that feature test macros
224-
will be defined and that if defined they will indicate the presence of the
224+
will be defined and that if defined they will indicate the presence of the
225225
corresponding optional functionality.
226226

227227
[[extensions]]
@@ -2446,7 +2446,7 @@ For all other cases that are not listed above the address space is inferred to
24462446
are inferred to be in the private address space.
24472447

24482448
Examples:
2449-
2449+
24502450
[source,c]
24512451
----------
24522452
// Note: these examples assume OpenCL C 2.0 or the
@@ -2490,7 +2490,7 @@ Qualifiers must be explicitly specified for:
24902490

24912491
* Program scope variables or variables inside functions with
24922492
a `static` or `extern` type specifier for OpenCL C prior to version 2.0 or
2493-
OpenCL C 3.0 without {opencl_c_program_scope_global_variables} feature,
2493+
OpenCL C 3.0 without {opencl_c_program_scope_global_variables} feature,
24942494

24952495
* Pointers used as arguments to kernel functions (the address space pointed
24962496
to must be specified explicitly).
@@ -2588,7 +2588,7 @@ definition in section 5 of the <<embedded-c-spec, Embedded C Specification>>. In
25882588
OpenCL C, no objects can be allocated in this address space. It can only be used
25892589
with pointer types, where a pointer pointing to a location in the generic
25902590
address space can be used for objects allocated in any of the concrete named
2591-
address spaces `private`, `local`, or `global`.
2591+
address spaces `private`, `local`, or `global`.
25922592
====
25932593

25942594
Following section 5.3 of the <<embedded-c-spec, Embedded C Specification>>, it
@@ -2816,10 +2816,10 @@ Various clarifications and examples illustrating how changes to ISO/IEC
28162816
9899:1999 detailed in <<embedded-c-spec, Embedded C, section 5.3>> apply
28172817
to OpenCL C with the generic address space.
28182818

2819-
*Clause 6.2.5 - Types*:
2819+
*Clause 6.2.5 - Types*:
28202820

28212821
If address space qualifier on type T is omitted refer to
2822-
<<addr-spaces-inference>>.
2822+
<<addr-spaces-inference>>.
28232823

28242824
*Clause 6.3.2.3 - Pointers*
28252825

@@ -6239,7 +6239,7 @@ in a subgroup.
62396239
spaces.
62406240
For the *sub_group_barrier* variant that does not take a
62416241
memory scope, the _scope_ is `memory_scope_sub_group`.
6242-
6242+
62436243
`CLK_LOCAL_MEM_FENCE` - The *sub_group_barrier* function will either flush
62446244
any variables stored in local memory or queue a memory fence to ensure
62456245
correct ordering of memory operations to local memory.
@@ -6325,7 +6325,7 @@ The OpenCL C programming language implements the following explicit memory fence
63256325
[[address-space-qualifier-functions]]
63266326
=== Address Space Qualifier Functions
63276327

6328-
[open,refpage='addressSpaceQualifierFuncs',desc='Address Space Qualifier Functions',type='freeform',spec='clang',anchor='address-space-qualifier-functions',xrefs='qualifiers',alias='get_fence to_global to_local to_private']
6328+
[open,refpage='addressSpaceQualifierFuncs',desc='Address Space Qualifier Functions',type='freeform',spec='clang',anchor='address-space-qualifier-functions',alias='get_fence to_global to_local to_private']
63296329
--
63306330

63316331
NOTE: The functionality described in this section <<unified-spec, requires>>

config/copyright-ccby.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Copyright 2014-2021 The Khronos Group Inc.
2+
3+
SPDX-License-Identifier: CC-BY-4.0

man/copyright-ccby.txt

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

man/footer.txt

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

0 commit comments

Comments
 (0)