485485----
486486namespace sycl::ext::oneapi::experimental {
487487
488- struct registered_kernel_names {
489- registered_kernel_names (); (1)
490- registered_kernel_names (const std::string &name); (2)
491- registered_kernel_names (const std::vector<std::string> &names); (3)
492- void add(const std::string &name); (4)
488+ struct registered_names {
489+ registered_names (); (1)
490+ registered_names (const std::string &name); (2)
491+ registered_names (const std::vector<std::string> &names); (3)
492+ void add(const std::string &name); (4)
493493};
494- using registered_kernel_names_key = registered_kernel_names ;
494+ using registered_names_key = registered_names ;
495495
496496template<>
497- struct is_property_key<registered_kernel_names_key > : std::true_type {};
497+ struct is_property_key<registered_names_key > : std::true_type {};
498498
499499} // namespace sycl::ext::oneapi::experimental
500500----
501501!====
502502
503- This property is useful when the source language represents kernel names
504- differently in the source code and the generated code.
505- For example, {cpp} function names in the generated code are "mangled" in an
506- implementation-defined way.
503+ This property is useful when the source language represents names differently in
504+ the source code and the generated code.
505+ For example, {cpp} function names and the names of static variables at global
506+ scope are "mangled" in an implementation-defined way in the generated code .
507507The precise meaning of this property is defined by each source language, but in
508- general it allows the application to supply a list of kernel names as they
509- appear in the source code.
508+ general it allows the application to supply a list of names as they appear in
509+ the source code.
510510The application can then get the corresponding raw (i.e. mangled) names after
511511the code is compiled.
512512See the section below "Obtaining a kernel when the language is ``sycl``" for a
513513description of how this property is used with the `source_language::sycl`
514514language.
515515
516- _Effects (1):_ Creates a new `registered_kernel_names ` property with no
517- registered kernel names.
516+ _Effects (1):_ Creates a new `registered_names ` property with no registered
517+ names.
518518
519- _Effects (2):_ Creates a new `registered_kernel_names ` property with a single
520- registered kernel name.
519+ _Effects (2):_ Creates a new `registered_names ` property with a single
520+ registered name.
521521
522- _Effects (3):_ Creates a new `registered_kernel_names` property from a vector
523- of kernel names.
522+ _Effects (3):_ Creates a new `registered_names` property from a vector of names.
524523
525- _Effects (4):_ Adds `name` to the property's list of registered kernel names.
524+ _Effects (4):_ Adds `name` to the property's list of registered names.
526525
527- _Preconditions (2-4):_ Each source language defines its own requirements for
528- the registered kernel names.
526+ _Preconditions (2-4):_ Each source language defines its own requirements for the
527+ registered names.
529528For the language `source_language::sycl`, each name must be a {cpp} expression
530529for a pointer to a kernel function as defined below under "Obtaining a kernel
531530when the language is ``sycl``".
532531
533- [_Note:_ It is not an error to have duplicate names in a
534- `registered_kernel_names` property, but the duplicates have no effect.
532+ [_Note:_ It is not an error to have duplicate names in a `registered_names`
533+ property, but the duplicates have no effect.
535534_{endnote}_]
536535|====
537536
@@ -643,8 +642,8 @@ _Constraints:_ This function is not available when `State` is
643642
644643_Returns:_ If the kernel bundle was created from a bundle of state
645644`bundle_state::ext_oneapi_source` and `name` was registered via
646- `registered_kernel_names `, returns the compiler-generated (e.g. mangled) name
647- for this kernel function.
645+ `registered_names `, returns the compiler-generated (e.g. mangled) name for this
646+ kernel function.
648647If the kernel bundle was created from a bundle of state
649648`bundle_state::ext_oneapi_source` and `name` is the same as a
650649compiler-generated name for a kernel defined in that bundle, that same
@@ -661,7 +660,7 @@ _Throws:_
661660When the kernel is defined in the language `source_language::sycl`, the host
662661code may query for the kernel or obtain the `kernel` object using either the
663662kernel's name as it is generated by the compiler (i.e. the {cpp} mangled name)
664- or by using the `registered_kernel_names ` property.
663+ or by using the `registered_names ` property.
665664
666665==== Using the compiler-generated name
667666
@@ -691,11 +690,10 @@ sycl::kernel_bundle<sycl::bundle_state::executable> kb = /*...*/;
691690sycl::kernel k = kb.ext_oneapi_get_kernel("foo");
692691----
693692
694- ==== Using the `registered_kernel_names ` property
693+ ==== Using the `registered_names ` property
695694
696695When the kernel is not declared as `extern "C"`, the compiler generates a
697- mangled name, so it is more convenient to use the `registered_kernel_names`
698- property.
696+ mangled name, so it is more convenient to use the `registered_names` property.
699697Each string in the property must be the {cpp} expression for a pointer to a
700698kernel function.
701699These expression strings are conceptually compiled at the bottom of source
@@ -724,7 +722,7 @@ The host code can compile this and get the kernel's `kernel` object like so:
724722sycl::kernel_bundle<sycl::bundle_state::ext_oneapi_source> kb_src = /*...*/;
725723
726724sycl::kernel_bundle<sycl::bundle_state::executable> kb = syclexp::build(kb_src,
727- syclexp::properties{syclexp::registered_kernel_names {"mykernels::bar"}});
725+ syclexp::properties{syclexp::registered_names {"mykernels::bar"}});
728726
729727sycl::kernel k = kb.ext_oneapi_get_kernel("mykernels::bar");
730728----
@@ -744,21 +742,21 @@ the kernel by calling `ext_oneapi_get_raw_kernel_name` like this:
744742sycl::kernel_bundle<sycl::bundle_state::ext_oneapi_source> kb_src = /*...*/;
745743
746744sycl::kernel_bundle<sycl::bundle_state::executable> kb = syclexp::build(kb_src,
747- syclexp::properties{syclexp::registered_kernel_names {"mykernels::bar"}});
745+ syclexp::properties{syclexp::registered_names {"mykernels::bar"}});
748746
749747std::string mangled_name = kb.ext_oneapi_get_raw_kernel_name("mykernels::bar");
750748----
751749
752750Again, the string passed to `ext_oneapi_get_raw_kernel_name` must have exactly
753- the same content as the string that was used to construct the
754- `registered_kernel_names` property.
751+ the same content as the string that was used to construct the `registered_names`
752+ property.
755753The application may also pass this compiler-generated (i.e. mangled) name to
756754`ext_oneapi_get_kernel` in order to get the `kernel` object.
757755
758756==== Instantiating templated kernel functions
759757
760- The `registered_kernel_names ` property can also be used to instantiate a
761- kernel that is defined as a function template.
758+ The `registered_names ` property can also be used to instantiate a kernel that is
759+ defined as a function template.
762760For example, consider source code that defines a kernel function template like
763761this:
764762
@@ -774,8 +772,8 @@ std::string source = R"""(
774772)""";
775773----
776774
777- The application can use the `registered_kernel_names ` property to instantiate
778- the template for specific template arguments.
775+ The application can use the `registered_names ` property to instantiate the
776+ template for specific template arguments.
779777For example, this host code instantiates the template twice and gets a `kernel`
780778object for each instantiation:
781779
@@ -784,7 +782,7 @@ object for each instantiation:
784782sycl::kernel_bundle<sycl::bundle_state::ext_oneapi_source> kb_src = /*...*/;
785783
786784sycl::kernel_bundle<sycl::bundle_state::executable> kb = syclexp::build(kb_src,
787- syclexp::properties{syclexp::registered_kernel_names {{"bartmpl<float>", "bartmpl<int>"}});
785+ syclexp::properties{syclexp::registered_names {{"bartmpl<float>", "bartmpl<int>"}});
788786
789787sycl::kernel k_float = kb.ext_oneapi_get_kernel("bartmpl<float>");
790788sycl::kernel k_int = kb.ext_oneapi_get_kernel("bartmpl<int>");
@@ -830,7 +828,7 @@ int main() {
830828 syclexp::source_language::sycl,
831829 source);
832830
833- // Compile the kernel. There is no need to use the "registered_kernel_names "
831+ // Compile the kernel. There is no need to use the "registered_names "
834832 // property because the kernel is declared extern "C".
835833 sycl::kernel_bundle<sycl::bundle_state::executable> kb_exe =
836834 syclexp::build(kb_src);
@@ -852,7 +850,7 @@ int main() {
852850
853851=== Disambiguating overloaded kernel functions
854852
855- This example demonstrates how to use the `registered_kernel_names ` property to
853+ This example demonstrates how to use the `registered_names ` property to
856854disambiguate a kernel function that has several overloads.
857855
858856[source,c++]
@@ -896,11 +894,11 @@ int main() {
896894 // use a C++ cast to disambiguate between them. Here, we are selecting the
897895 // "int" overload.
898896 std::string iota_name{"(void(*)(int, int*))iota"};
899- sycl::kernel_bundle<sycl::bundle_state::executable> kb_exe = syclexp::build(kb_src,
900- syclexp::properties{syclexp::registered_kernel_names {iota_name}});
897+ sycl::kernel_bundle<sycl::bundle_state::executable> kb_exe =
898+ syclexp::build(kb_src, syclexp:: properties{syclexp::registered_names {iota_name}});
901899
902900 // Get the kernel by passing the same string we used to construct the
903- // "registered_kernel_names " property.
901+ // "registered_names " property.
904902 sycl::kernel iota = kb_exe.ext_oneapi_get_kernel(iota_name);
905903
906904 int *ptr = sycl::malloc_shared<int>(NUM, q);
0 commit comments