From 8a97575949f4a9e3d9e965c2ec73d31c7c86c2e6 Mon Sep 17 00:00:00 2001 From: Ben Ashbaugh Date: Sat, 17 Aug 2024 16:52:16 -0700 Subject: [PATCH] generate an OpenCL C built-in functions dictionary --- Makefile | 7 +- OpenCL_C.txt | 204 +++++++++--------- c/dictionary.asciidoc | 2 + c/functions.txt | 99 +++++++++ ...tionary.py => gen_dictionary_from_file.py} | 43 ++-- 5 files changed, 233 insertions(+), 122 deletions(-) create mode 100644 c/functions.txt rename scripts/{gen_c_feature_dictionary.py => gen_dictionary_from_file.py} (60%) diff --git a/Makefile b/Makefile index 5dcaae6f9..7dd398339 100644 --- a/Makefile +++ b/Makefile @@ -513,10 +513,12 @@ $(MANHTMLDIR)/intro.html: $(REFPATH)/intro.txt $(MANCOPYRIGHT) REGISTRY = $(ROOTDIR)/xml APIXML = $(REGISTRY)/cl.xml CFEATURES = c/features.txt +CFUNCTIONS = c/functions.txt GENSCRIPT = $(SCRIPTS)/gencl.py DICTSCRIPT = $(SCRIPTS)/gen_dictionaries.py VERSIONSCRIPT = $(SCRIPTS)/gen_version_notes.py -CFEATSCRIPT = $(SCRIPTS)/gen_c_feature_dictionary.py +CFEATSCRIPT = $(SCRIPTS)/gen_dictionary_from_file.py +CFUNCSCRIPT = $(SCRIPTS)/gen_dictionary_from_file.py GENSCRIPTOPTS = $(VERSIONOPTIONS) $(EXTOPTIONS) $(GENSCRIPTEXTRA) -registry $(APIXML) GENSCRIPTEXTRA = @@ -542,7 +544,8 @@ extinc: $(METADEPEND) $(METADEPEND): $(APIXML) $(GENSCRIPT) $(QUIET)$(MKDIR) $(METAPATH) $(QUIET)$(PYTHON) $(GENSCRIPT) $(GENSCRIPTOPTS) -o $(METAPATH) extinc - $(QUIET)$(PYTHON) $(CFEATSCRIPT) -features $(CFEATURES) -o $(METAPATH)/c-feature-dictionary.asciidoc + $(QUIET)$(PYTHON) $(CFEATSCRIPT) -file $(CFEATURES) -o $(METAPATH)/c-feature-dictionary.asciidoc + $(QUIET)$(PYTHON) $(CFUNCSCRIPT) -file $(CFUNCTIONS) -o $(METAPATH)/c-function-dictionary.asciidoc # This generates a single file containing asciidoc attributes for each # extension in the spec being built. diff --git a/OpenCL_C.txt b/OpenCL_C.txt index 610b54e3c..4db6c035e 100644 --- a/OpenCL_C.txt +++ b/OpenCL_C.txt @@ -13676,10 +13676,6 @@ execution. [[built-in-functions-kernel-query-functions]] ==== Built-in Functions - Kernel Query Functions -// Note: the Unicode "zero width space" (​) is used in some places to -// cause long function names to break much more sensibly. -// Probably the asciidoc built-in {zwsp} should be used instead. - [open,refpage='kernelQueryFunctions',desc='Built-in Functions - Kernel Query Functions',type='freeform',spec='clang',anchor='built-in-functions-kernel-query-functions',xrefs='enqueue_kernel',alias='get_kernel_preferred get_kernel_work_group_size'] -- [[table-builtin-kernel-query]] @@ -13693,9 +13689,9 @@ execution. can be used to execute a block on a specific device given by _device_. _block_ specifies the block to be enqueued. -| uint *get_kernel_preferred_​work_group_size_multiple*( +| uint *{get_kernel_preferred_work_group_size_multiple}*( void (^block)(void)) + - uint *get_kernel_preferred_​work_group_size_multiple*( + uint *{get_kernel_preferred_work_group_size_multiple}*( void (^block)(local {localArgType} *, ...)) | Returns the preferred multiple of work-group size for launch. This is a performance hint. @@ -14975,138 +14971,138 @@ This section is informational and non-normative. 3+| For OpenCL 2.1 or {cl_khr_subgroups_EXT}: -| `get_​sub_​group_​size` +| `{get_sub_group_size}` | *SubgroupSize* | *Kernel* -| `get_​max_​sub_​group_​size` +| `{get_max_sub_group_size}` | *SubgroupMaxSize* | *Kernel* -| `get_​num_​sub_​groups` +| `{get_num_sub_groups}` | *NumSubgroups* | *Kernel* -| `get_​enqueued_​num_​sub_​groups` +| `{get_enqueued_num_sub_groups}` | *NumEnqueuedSubgroups* | *Kernel* -| `get_​sub_​group_​id` +| `{get_sub_group_id}` | *SubgroupId* | *Kernel* -| `get_​sub_​group_​local_​id` +| `{get_sub_group_local_id}` | *SubgroupLocalInvocationId* | *Kernel* -| `sub_​group_​barrier` +| `{sub_group_barrier}` | *OpControlBarrier* | None Needed -| `sub_​group_​all` +| `{sub_group_all}` | *OpGroupAll* | *Groups* -| `sub_​group_​any` +| `{sub_group_any}` | *OpGroupAny* | *Groups* -| `sub_​group_​broadcast` +| `{sub_group_broadcast}` | *OpGroupBroadcast* | *Groups* -| `sub_​group_​reduce_​add` +| `{sub_group_reduce_add}` | *OpGroupIAdd*, *OpGroupFAdd* | *Groups* -| `sub_​group_​reduce_​min` +| `{sub_group_reduce_min}` | *OpGroupSMin*, *OpGroupUMin*, *OpGroupFMin* | *Groups* -| `sub_​group_​reduce_​max` +| `{sub_group_reduce_max}` | *OpGroupSMax*, *OpGroupUMax*, *OpGroupFMax* | *Groups* -| `sub_​group_​scan_​exclusive_​add` +| `{sub_group_scan_exclusive_add}` | *OpGroupIAdd*, *OpGroupFAdd* | *Groups* -| `sub_​group_​scan_​exclusive_​min` +| `{sub_group_scan_exclusive_min}` | *OpGroupSMin*, *OpGroupUMin*, *OpGroupFMin* | *Groups* -| `sub_​group_​scan_​exclusive_​max` +| `{sub_group_scan_exclusive_max}` | *OpGroupSMax*, *OpGroupUMax*, *OpGroupFMax* | *Groups* -| `sub_​group_​scan_​inclusive_​add` +| `{sub_group_scan_inclusive_add}` | *OpGroupIAdd*, *OpGroupFAdd* | *Groups* -| `sub_​group_​scan_​inclusive_​min` +| `{sub_group_scan_inclusive_min}` | *OpGroupSMin*, *OpGroupUMin*, *OpGroupFMin* | *Groups* -| `sub_​group_​scan_​inclusive_​max` +| `{sub_group_scan_inclusive_max}` | *OpGroupSMax*, *OpGroupUMax*, *OpGroupFMax* | *Groups* -| `sub_​group_​reserve_​read_​pipe` +| `{sub_group_reserve_read_pipe}` | *OpGroupReserveReadPipePackets* | *Pipes* -| `sub_​group_​reserve_​write_​pipe` +| `{sub_group_reserve_write_pipe}` | *OpGroupReserveReadWritePackets* | *Pipes* -| `sub_​group_​commit_​read_​pipe` +| `{sub_group_commit_read_pipe}` | *OpGroupCommitReadPipe* | *Pipes* -| `sub_​group_​commit_​write_​pipe` +| `{sub_group_commit_write_pipe}` | *OpGroupCommitWritePipe* | *Pipes* -| `get_​kernel_​sub_​group_​count_​for_​ndrange` +| `{get_kernel_sub_group_count_for_ndrange}` | *OpGetKernelNDrangeSubGroupCount* | *DeviceEnqueue* -| `get_​kernel_​max_​sub_​group_​size_​for_​ndrange` +| `{get_kernel_max_sub_group_size_for_ndrange}` | *OpGetKernelNDrangeMaxSubGroupSize* | *DeviceEnqueue* ifdef::cl_khr_subgroup_ballot[] 3+| For {cl_khr_subgroup_ballot_EXT}: -| `sub_​group_​non_​uniform_​broadcast` +| `{sub_group_non_uniform_broadcast}` | *OpGroupNonUniformBroadcast* | *GroupNonUniformBallot* -| `sub_​group_​broadcast_​first` +| `{sub_group_broadcast_first}` | *OpGroupNonUniformBroadcastFirst* | *GroupNonUniformBallot* -| `sub_​group_​ballot` +| `{sub_group_ballot}` | *OpGroupNonUniformBallot* | *GroupNonUniformBallot* -| `sub_​group_​inverse_​ballot` +| `{sub_group_inverse_ballot}` | *OpGroupNonUniformInverseBallot* | *GroupNonUniformBallot* -| `sub_​group_​ballot_​bit_​extract` +| `{sub_group_ballot_bit_extract}` | *OpGroupNonUniformBallotBitExtract* | *GroupNonUniformBallot* -| `sub_​group_​ballot_​bit_​count` +| `{sub_group_ballot_bit_count}` | *OpGroupNonUniformBallotBitCount* | *GroupNonUniformBallot* -| `sub_​group_​ballot_​inclusive_​scan` +| `{sub_group_ballot_inclusive_scan}` | *OpGroupNonUniformBallotBitCount* | *GroupNonUniformBallot* -| `sub_​group_​ballot_​exclusive_​scan` +| `{sub_group_ballot_exclusive_scan}` | *OpGroupNonUniformBallotBitCount* | *GroupNonUniformBallot* -| `sub_​group_​ballot_​find_​lsb` +| `{sub_group_ballot_find_lsb}` | *OpGroupNonUniformBallotFindLSB* | *GroupNonUniformBallot* -| `sub_​group_​ballot_​find_​msb` +| `{sub_group_ballot_find_msb}` | *OpGroupNonUniformBallotFindMSB* | *GroupNonUniformBallot* -| `get_​sub_​group_​eq_​mask` +| `{get_sub_group_eq_mask}` | *SubgroupEqMask* | *GroupNonUniformBallot* -| `get_​sub_​group_​ge_​mask` +| `{get_sub_group_ge_mask}` | *SubgroupGeMask* | *GroupNonUniformBallot* -| `get_​sub_​group_​gt_​mask` +| `{get_sub_group_gt_mask}` | *SubgroupGtMask* | *GroupNonUniformBallot* -| `get_​sub_​group_​le_​mask` +| `{get_sub_group_le_mask}` | *SubgroupLeMask* | *GroupNonUniformBallot* -| `get_​sub_​group_​lt_​mask` +| `{get_sub_group_lt_mask}` | *SubgroupLtMask* | *GroupNonUniformBallot* endif::cl_khr_subgroup_ballot[] @@ -15114,34 +15110,34 @@ endif::cl_khr_subgroup_ballot[] ifdef::cl_khr_subgroup_clustered_reduce[] 3+| For {cl_khr_subgroup_clustered_reduce_EXT}: -| `sub_​group_​clustered_​reduce_​add` +| `{sub_group_clustered_reduce_add}` | *OpGroupNonUniformIAdd*, *OpGroupNonUniformFAdd* | *GroupNonUniformClustered* -| `sub_​group_​clustered_​reduce_​mul` +| `{sub_group_clustered_reduce_mul}` | *OpGroupNonUniformIMul*, *OpGroupNonUniformFMul* | *GroupNonUniformClustered* -| `sub_​group_​clustered_​reduce_​min` +| `{sub_group_clustered_reduce_min}` | *OpGroupNonUniformSMin*, *OpGroupNonUniformUMin*, *OpGroupNonUniformFMin* | *GroupNonUniformClustered* -| `sub_​group_​clustered_​reduce_​max` +| `{sub_group_clustered_reduce_max}` | *OpGroupNonUniformSMax*, *OpGroupNonUniformUMax*, *OpGroupNonUniformFMax* | *GroupNonUniformClustered* -| `sub_​group_​clustered_​reduce_​and` +| `{sub_group_clustered_reduce_and}` | *OpGroupNonUniformBitwiseAnd* | *GroupNonUniformClustered* -| `sub_​group_​clustered_​reduce_​or` +| `{sub_group_clustered_reduce_or}` | *OpGroupNonUniformBitwiseOr* | *GroupNonUniformClustered* -| `sub_​group_​clustered_​reduce_​xor` +| `{sub_group_clustered_reduce_xor}` | *OpGroupNonUniformBitwiseXor* | *GroupNonUniformClustered* -| `sub_​group_​clustered_​reduce_​logical_​and` +| `{sub_group_clustered_reduce_logical_and}` | *OpGroupNonUniformLogicalAnd* | *GroupNonUniformClustered* -| `sub_​group_​clustered_​reduce_​logical_​or` +| `{sub_group_clustered_reduce_logical_or}` | *OpGroupNonUniformLogicalOr* | *GroupNonUniformClustered* -| `sub_​group_​clustered_​reduce_​logical_​xor` +| `{sub_group_clustered_reduce_logical_xor}` | *OpGroupNonUniformLogicalXor* | *GroupNonUniformClustered* endif::cl_khr_subgroup_clustered_reduce[] @@ -15150,37 +15146,37 @@ ifdef::cl_khr_subgroup_extended_types[] 3+| For {cl_khr_subgroup_extended_types_EXT}: + Note: This extension adds new types to uniform sub-group operations. -| `sub_​group_​broadcast` +| `{sub_group_broadcast}` | *OpGroupBroadcast* | *Groups* -| `sub_​group_​reduce_​add` +| `{sub_group_reduce_add}` | *OpGroupIAdd*, *OpGroupFAdd* | *Groups* -| `sub_​group_​reduce_​min` +| `{sub_group_reduce_min}` | *OpGroupSMin*, *OpGroupUMin*, *OpGroupFMin* | *Groups* -| `sub_​group_​reduce_​max` +| `{sub_group_reduce_max}` | *OpGroupSMax*, *OpGroupUMax*, *OpGroupFMax* | *Groups* -| `sub_​group_​scan_​exclusive_​add` +| `{sub_group_scan_exclusive_add}` | *OpGroupIAdd*, *OpGroupFAdd* | *Groups* -| `sub_​group_​scan_​exclusive_​min` +| `{sub_group_scan_exclusive_min}` | *OpGroupSMin*, *OpGroupUMin*, *OpGroupFMin* | *Groups* -| `sub_​group_​scan_​exclusive_​max` +| `{sub_group_scan_exclusive_max}` | *OpGroupSMax*, *OpGroupUMax*, *OpGroupFMax* | *Groups* -| `sub_​group_​scan_​inclusive_​add` +| `{sub_group_scan_inclusive_add}` | *OpGroupIAdd*, *OpGroupFAdd* | *Groups* -| `sub_​group_​scan_​inclusive_​min` +| `{sub_group_scan_inclusive_min}` | *OpGroupSMin*, *OpGroupUMin*, *OpGroupFMin* | *Groups* -| `sub_​group_​scan_​inclusive_​max` +| `{sub_group_scan_inclusive_max}` | *OpGroupSMax*, *OpGroupUMax*, *OpGroupFMax* | *Groups* endif::cl_khr_subgroup_extended_types[] @@ -15188,96 +15184,96 @@ endif::cl_khr_subgroup_extended_types[] ifdef::cl_khr_subgroup_non_uniform_arithmetic[] 3+| For {cl_khr_subgroup_non_uniform_arithmetic_EXT}: -| `sub_​group_​non_​uniform_​reduce_​add` +| `{sub_group_non_uniform_reduce_add}` | *OpGroupNonUniformIAdd*, *OpGroupNonUniformFAdd* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​reduce_​mul` +| `{sub_group_non_uniform_reduce_mul}` | *OpGroupNonUniformIMul*, *OpGroupNonUniformFMul* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​reduce_​min` +| `{sub_group_non_uniform_reduce_min}` | *OpGroupNonUniformSMin*, *OpGroupNonUniformUMin*, *OpGroupNonUniformFMin* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​reduce_​max` +| `{sub_group_non_uniform_reduce_max}` | *OpGroupNonUniformSMax*, *OpGroupNonUniformUMax*, *OpGroupNonUniformFMax* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​reduce_​and` +| `{sub_group_non_uniform_reduce_and}` | *OpGroupNonUniformBitwiseAnd* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​reduce_​or` +| `{sub_group_non_uniform_reduce_or}` | *OpGroupNonUniformBitwiseOr* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​reduce_​xor` +| `{sub_group_non_uniform_reduce_xor}` | *OpGroupNonUniformBitwiseXor* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​reduce_​logical_​and` +| `{sub_group_non_uniform_reduce_logical_and}` | *OpGroupNonUniformLogicalAnd* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​reduce_​logical_​or` +| `{sub_group_non_uniform_reduce_logical_or}` | *OpGroupNonUniformLogicalOr* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​reduce_​logical_​xor` +| `{sub_group_non_uniform_reduce_logical_xor}` | *OpGroupNonUniformLogicalXor* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​scan_​inclusive_​add` +| `{sub_group_non_uniform_scan_inclusive_add}` | *OpGroupNonUniformIAdd*, *OpGroupNonUniformFAdd* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​scan_​inclusive_​mul` +| `{sub_group_non_uniform_scan_inclusive_mul}` | *OpGroupNonUniformIMul*, *OpGroupNonUniformFMul* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​scan_​inclusive_​min` +| `{sub_group_non_uniform_scan_inclusive_min}` | *OpGroupNonUniformSMin*, *OpGroupNonUniformUMin*, *OpGroupNonUniformFMin* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​scan_​inclusive_​max` +| `{sub_group_non_uniform_scan_inclusive_max}` | *OpGroupNonUniformSMax*, *OpGroupNonUniformUMax*, *OpGroupNonUniformFMax* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​scan_​inclusive_​and` +| `{sub_group_non_uniform_scan_inclusive_and}` | *OpGroupNonUniformBitwiseAnd* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​scan_​inclusive_​or` +| `{sub_group_non_uniform_scan_inclusive_or}` | *OpGroupNonUniformBitwiseOr* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​scan_​inclusive_​xor` +| `{sub_group_non_uniform_scan_inclusive_xor}` | *OpGroupNonUniformBitwiseXor* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​scan_​inclusive_​logical_​and` +| `{sub_group_non_uniform_scan_inclusive_logical_and}` | *OpGroupNonUniformLogicalAnd* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​scan_​inclusive_​logical_​or` +| `{sub_group_non_uniform_scan_inclusive_logical_or}` | *OpGroupNonUniformLogicalOr* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​scan_​inclusive_​logical_​xor` +| `{sub_group_non_uniform_scan_inclusive_logical_xor}` | *OpGroupNonUniformLogicalXor* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​scan_​exclusive_​add` +| `{sub_group_non_uniform_scan_exclusive_add}` | *OpGroupNonUniformIAdd*, *OpGroupNonUniformFAdd* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​scan_​exclusive_​mul` +| `{sub_group_non_uniform_scan_exclusive_mul}` | *OpGroupNonUniformIMul*, *OpGroupNonUniformFMul* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​scan_​exclusive_​min` +| `{sub_group_non_uniform_scan_exclusive_min}` | *OpGroupNonUniformSMin*, *OpGroupNonUniformUMin*, *OpGroupNonUniformFMin* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​​scan_​exclusive_​max` +| `{sub_group_non_uniform_scan_exclusive_max}` | *OpGroupNonUniformSMax*, *OpGroupNonUniformUMax*, *OpGroupNonUniformFMax* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​​scan_​exclusive_​and` +| `{sub_group_non_uniform_scan_exclusive_and}` | *OpGroupNonUniformBitwiseAnd* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​​scan_​exclusive_​or` +| `{sub_group_non_uniform_scan_exclusive_or}` | *OpGroupNonUniformBitwiseOr* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​​scan_​exclusive_​xor` +| `{sub_group_non_uniform_scan_exclusive_xor}` | *OpGroupNonUniformBitwiseXor* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​​scan_​exclusive_​logical_​and` +| `{sub_group_non_uniform_scan_exclusive_logical_and}` | *OpGroupNonUniformLogicalAnd* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​​scan_​exclusive_​logical_​or` +| `{sub_group_non_uniform_scan_exclusive_logical_or}` | *OpGroupNonUniformLogicalOr* | *GroupNonUniformArithmetic* -| `sub_​group_​non_​uniform_​​scan_​exclusive_​logical_​xor` +| `{sub_group_non_uniform_scan_exclusive_logical_xor}` | *OpGroupNonUniformLogicalXor* | *GroupNonUniformArithmetic* endif::cl_khr_subgroup_non_uniform_arithmetic[] @@ -15285,16 +15281,16 @@ endif::cl_khr_subgroup_non_uniform_arithmetic[] ifdef::cl_khr_subgroup_non_uniform_vote[] 3+| For {cl_khr_subgroup_non_uniform_vote_EXT}: -| `sub_​group_​elect` +| `{sub_group_elect}` | *OpGroupNonUniformElect* | *GroupNonUniform* -| `sub_​group_​non_​uniform_​all` +| `{sub_group_non_uniform_all}` | *OpGroupNonUniformAll* | *GroupNonUniformVote* -| `sub_​group_​non_​uniform_​any` +| `{sub_group_non_uniform_any}` | *OpGroupNonUniformAny* | *GroupNonUniformVote* -| `sub_​group_​non_​uniform_​all_​equal` +| `{sub_group_non_uniform_all_equal}` | *OpGroupNonUniformAllEqual* | *GroupNonUniformVote* endif::cl_khr_subgroup_non_uniform_vote[] @@ -15302,10 +15298,10 @@ endif::cl_khr_subgroup_non_uniform_vote[] ifdef::cl_khr_subgroup_shuffle[] 3+| For {cl_khr_subgroup_shuffle_EXT}: -| `sub_​group_​shuffle` +| `{sub_group_shuffle}` | *OpGroupNonUniformShuffle* | *GroupNonUniformShuffle* -| `sub_​group_​shuffle_​xor` +| `{sub_group_shuffle_xor}` | *OpGroupNonUniformShuffleXor* | *GroupNonUniformShuffle* endif::cl_khr_subgroup_shuffle[] @@ -15313,10 +15309,10 @@ endif::cl_khr_subgroup_shuffle[] ifdef::cl_khr_subgroup_shuffle_relative[] 3+| For {cl_khr_subgroup_shuffle_relative_EXT}: -| `sub_​group_​shuffle_​up` +| `{sub_group_shuffle_up}` | *OpGroupNonUniformShuffleUp* | *GroupNonUniformShuffleRelative* -| `sub_​group_​shuffle_​down` +| `{sub_group_shuffle_down}` | *OpGroupNonUniformShuffleDown* | *GroupNonUniformShuffleRelative* endif::cl_khr_subgroup_shuffle_relative[] diff --git a/c/dictionary.asciidoc b/c/dictionary.asciidoc index ef7a9401b..bde39ebc1 100644 --- a/c/dictionary.asciidoc +++ b/c/dictionary.asciidoc @@ -4,3 +4,5 @@ include::{generated}/api/api-dictionary-no-links.asciidoc[] include::{generated}/api/ext-dictionary-no-links.asciidoc[] + +include::{generated}/meta/c-function-dictionary.asciidoc[] diff --git a/c/functions.txt b/c/functions.txt new file mode 100644 index 000000000..c9a9f640c --- /dev/null +++ b/c/functions.txt @@ -0,0 +1,99 @@ +get_kernel_preferred_work_group_size_multiple +get_sub_group_size +get_max_sub_group_size +get_num_sub_groups +get_enqueued_num_sub_groups +get_sub_group_id +get_sub_group_local_id +sub_group_barrier +sub_group_all +sub_group_any +sub_group_broadcast +sub_group_reduce_add +sub_group_reduce_min +sub_group_reduce_max +sub_group_scan_exclusive_add +sub_group_scan_exclusive_min +sub_group_scan_exclusive_max +sub_group_scan_inclusive_add +sub_group_scan_inclusive_min +sub_group_scan_inclusive_max +sub_group_reserve_read_pipe +sub_group_reserve_write_pipe +sub_group_commit_read_pipe +sub_group_commit_write_pipe +get_kernel_sub_group_count_for_ndrange +get_kernel_max_sub_group_size_for_ndrange +sub_group_non_uniform_broadcast +sub_group_broadcast_first +sub_group_ballot +sub_group_inverse_ballot +sub_group_ballot_bit_extract +sub_group_ballot_bit_count +sub_group_ballot_inclusive_scan +sub_group_ballot_exclusive_scan +sub_group_ballot_find_lsb +sub_group_ballot_find_msb +get_sub_group_eq_mask +get_sub_group_ge_mask +get_sub_group_gt_mask +get_sub_group_le_mask +get_sub_group_lt_mask +sub_group_clustered_reduce_add +sub_group_clustered_reduce_mul +sub_group_clustered_reduce_min +sub_group_clustered_reduce_max +sub_group_clustered_reduce_and +sub_group_clustered_reduce_or +sub_group_clustered_reduce_xor +sub_group_clustered_reduce_logical_and +sub_group_clustered_reduce_logical_or +sub_group_clustered_reduce_logical_xor +sub_group_broadcast +sub_group_reduce_add +sub_group_reduce_min +sub_group_reduce_max +sub_group_scan_exclusive_add +sub_group_scan_exclusive_min +sub_group_scan_exclusive_max +sub_group_scan_inclusive_add +sub_group_scan_inclusive_min +sub_group_scan_inclusive_max +sub_group_non_uniform_reduce_add +sub_group_non_uniform_reduce_mul +sub_group_non_uniform_reduce_min +sub_group_non_uniform_reduce_max +sub_group_non_uniform_reduce_and +sub_group_non_uniform_reduce_or +sub_group_non_uniform_reduce_xor +sub_group_non_uniform_reduce_logical_and +sub_group_non_uniform_reduce_logical_or +sub_group_non_uniform_reduce_logical_xor +sub_group_non_uniform_scan_inclusive_add +sub_group_non_uniform_scan_inclusive_mul +sub_group_non_uniform_scan_inclusive_min +sub_group_non_uniform_scan_inclusive_max +sub_group_non_uniform_scan_inclusive_and +sub_group_non_uniform_scan_inclusive_or +sub_group_non_uniform_scan_inclusive_xor +sub_group_non_uniform_scan_inclusive_logical_and +sub_group_non_uniform_scan_inclusive_logical_or +sub_group_non_uniform_scan_inclusive_logical_xor +sub_group_non_uniform_scan_exclusive_add +sub_group_non_uniform_scan_exclusive_mul +sub_group_non_uniform_scan_exclusive_min +sub_group_non_uniform_scan_exclusive_max +sub_group_non_uniform_scan_exclusive_and +sub_group_non_uniform_scan_exclusive_or +sub_group_non_uniform_scan_exclusive_xor +sub_group_non_uniform_scan_exclusive_logical_and +sub_group_non_uniform_scan_exclusive_logical_or +sub_group_non_uniform_scan_exclusive_logical_xor +sub_group_elect +sub_group_non_uniform_all +sub_group_non_uniform_any +sub_group_non_uniform_all_equal +sub_group_shuffle +sub_group_shuffle_xor +sub_group_shuffle_up +sub_group_shuffle_down diff --git a/scripts/gen_c_feature_dictionary.py b/scripts/gen_dictionary_from_file.py similarity index 60% rename from scripts/gen_c_feature_dictionary.py rename to scripts/gen_dictionary_from_file.py index f9b071735..dcfe5cc49 100644 --- a/scripts/gen_c_feature_dictionary.py +++ b/scripts/gen_dictionary_from_file.py @@ -11,40 +11,41 @@ if __name__ == "__main__": parser = argparse.ArgumentParser() - parser.add_argument('-features', action='store', + parser.add_argument('-file', action='store', default='', - help='File with OpenCL C features to generate, one per line') + help='Input file with dictionary source to generate, one per line, stdin is used if no file is provided.') parser.add_argument('-o', action='store', default='', - help='Output file in which to store the feature dictionary. stdout is used if no file is provided.') + help='Output file in which to store the generated dictionary, stdout is used if no file is provided.') args = parser.parse_args() - features = [] - if len(args.features) > 0: - print('Generating feature dictionaries from: ' + args.features) - with open(args.features) as f: - features = f.readlines() + entries = [] + if len(args.file) > 0: + print('Generating dictionary from source file: ' + args.file) + with open(args.file) as f: + entries = f.readlines() else: - print('Reading feature dictionaries from stdin...') + print('Generating dictionary from stdin.') for line in sys.stdin: - features.append(line) + entries.append(line) print('Generating...\n') numberOfFeatures = 0 + numberOfEntries = 0 if args.o: outfile = open(args.o, 'w') else: outfile = sys.stdout - for name in features: + for name in entries: name = name.strip() if len(name) == 0: continue # OpenCL C features start with __opencl_c if name.startswith('__opencl_c'): - #print('found enum: ' + name) + #print('found feature: ' + name) # Create a variant of the name that precedes underscores with # "zero width" spaces. This causes some long names to be @@ -74,14 +75,24 @@ numberOfFeatures = numberOfFeatures + 1 - # everything else is a function + # everything else else: - print('Unexpected feature name: ' + name + ', features should start with __opencl_c!') - sys.exit(1) + htmlName = name[:4] + name[4:].replace("_", "_") + otherName = name[:4] + name[4:].replace("_", "_​") + + outfile.write('// ' + name + '\n') + outfile.write('ifdef::backend-html5[]\n') + outfile.write(':' + name + ': pass:q[' + htmlName + ']\n') + outfile.write('endif::[]\n') + outfile.write('ifndef::backend-html5[]\n') + outfile.write(':' + name + ': pass:q[' + otherName + ']\n') + outfile.write('endif::[]\n') + + numberOfEntries = numberOfEntries + 1 outfile.write('\n') if args.o: outfile.close() - print('Found ' + str(numberOfFeatures) + ' features.') + print('Found ' + str(numberOfFeatures) + ' OpenCL C features and ' + str(numberOfEntries) + ' other entries.')