Skip to content

Commit 1d5cf11

Browse files
committed
Tweak properties
* Change the properties that contain a list of things: * There is a constructor that creates a property with an empty list and an `add` function which adds elements to the list. * There is a constructor that creates a property with one element, which seems like a common case for some of these properties. * In the case where each list element is a single string, also add a constructor that takes a vector of strings, which allows the property to be constructed concisely with an initializer list. * Remove the member variables from the property APIs. This is now an implementation detail, and access to the property is purely through the member functions.
1 parent bb1e69f commit 1d5cf11

File tree

1 file changed

+45
-28
lines changed

1 file changed

+45
-28
lines changed

sycl/doc/extensions/experimental/sycl_ext_oneapi_kernel_compiler.asciidoc

Lines changed: 45 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -327,11 +327,9 @@ a!
327327
namespace sycl::ext::oneapi::experimental {
328328
329329
struct include_files {
330-
std::vector<std::string> names;
331-
std::vector<std::string> contents;
332-
include_files(const std::string &name, const std::string &content); (1)
333-
include_files(const std::vector<std::string> &names, (2)
334-
const std::vector<std::string> &contents);
330+
include_files(); (1)
331+
include_files(const std::string &name, const std::string &content); (2)
332+
void add(const std::string &name, const std::string &content); (3)
335333
};
336334
using include_files_key = include_files;
337335
@@ -374,13 +372,18 @@ content via the `include_files` property:
374372
The include files defined via the `include_files` property are searched first,
375373
before these implicitly available headers.
376374

377-
_Effects (1):_ Constructs an `include_files` property with a single (_Name_,
375+
_Effects (1):_ Creates a new `include_files` property with no (_Name_,
376+
_Content_) pairs.
377+
378+
_Effects (2):_ Creates a new `include_files` property with a single (_Name_,
378379
_Content_) pair.
379380

380-
_Effects (2):_ Constructs an `include_files` property with a collection of
381-
(_Name_, _Content_) pairs.
382-
The `names` vector provides the _Name_ strings, and the `contents` vector
383-
provides the _Content_ strings.
381+
_Effects (3):_ Adds a (_Name_, _Content_) pair to the property.
382+
383+
_Throws (3):_
384+
385+
* An `exception` with the `errc::invalid` error code if there is already an
386+
entry with `name` in this property.
384387
|====
385388

386389
=== New properties for the `build` function
@@ -398,9 +401,10 @@ a!
398401
namespace sycl::ext::oneapi::experimental {
399402
400403
struct build_options {
401-
std::vector<std::string> opts;
402-
build_options(const std::string &opt); (1)
403-
build_options(const std::vector<std::string> &opts); (2)
404+
build_options(); (1)
405+
build_options(const std::string &opt); (2)
406+
build_options(const std::vector<std::string> &opts); (3)
407+
void add(const std::string &opt); (4)
404408
};
405409
using build_options_key = build_options;
406410
@@ -420,12 +424,16 @@ options.
420424
The `source_language::sycl` language does not define any standard build
421425
options, but an implementation may support implementation-defined options.
422426

423-
_Effects (1):_ Constructs a `build_options` property with a single build
427+
_Effects (1):_ Constructs a `build_options` property with no build options.
428+
429+
_Effects (2):_ Constructs a `build_options` property with a single build
424430
option.
425431

426-
_Effects (2):_ Constructs a `build_options` property from a vector of build
432+
_Effects (3):_ Constructs a `build_options` property from a vector of build
427433
options.
428434

435+
_Effects (4):_ Adds `opt` to the end of the property's list of build options.
436+
429437
a|
430438
[frame=all,grid=none]
431439
!====
@@ -435,7 +443,6 @@ a!
435443
namespace sycl::ext::oneapi::experimental {
436444
437445
struct save_log {
438-
std::string *log;
439446
save_log(std::string *to); (1)
440447
};
441448
using save_log_key = save_log;
@@ -478,9 +485,10 @@ a!
478485
namespace sycl::ext::oneapi::experimental {
479486
480487
struct registered_kernel_names {
481-
std::vector<std::string> names;
482-
registered_kernel_names(const std::string &name); (1)
483-
registered_kernel_names(const std::vector<std::string> &names); (2)
488+
registered_kernel_names(); (1)
489+
registered_kernel_names(const std::string &name); (2)
490+
registered_kernel_names(const std::vector<std::string> &names); (3)
491+
void add(const std::string &name); (4)
484492
};
485493
using registered_kernel_names_key = registered_kernel_names;
486494
@@ -504,17 +512,26 @@ See the section below "Obtaining a kernel when the language is ``sycl``" for a
504512
description of how this property is used with the `source_language::sycl`
505513
language.
506514

507-
_Preconditions:_ Each source language defines its own requirements for the
508-
strings in the `name` and `names` parameters.
509-
For the language `source_language::sycl`, each string must be a {cpp}
510-
expression for a pointer to a kernel function as defined below under "Obtaining
511-
a kernel when the language is ``sycl``".
515+
_Effects (1):_ Creates a new `registered_kernel_names` property with no
516+
registered kernel names.
512517

513-
_Effects (1):_ Constructs a `registered_kernel_names` property with a single
514-
kernel name.
518+
_Effects (2):_ Creates a new `registered_kernel_names` property with a single
519+
registered kernel name.
515520

516-
_Effects (2):_ Constructs a `registered_kernel_names` property from a vector of
517-
kernel names.
521+
_Effects (3):_ Creates a new `registered_kernel_names` property from a vector
522+
of kernel names.
523+
524+
_Effects (4):_ Adds `name` to the property's list of registered kernel names.
525+
526+
_Preconditions (2-4):_ Each source language defines its own requirements for
527+
the registered kernel names.
528+
For the language `source_language::sycl`, each name must be a {cpp} expression
529+
for a pointer to a kernel function as defined below under "Obtaining a kernel
530+
when the language is ``sycl``".
531+
532+
[_Note:_ It is not an error to have duplicate names in a
533+
`registered_kernel_names` property, but the duplicates have no effect.
534+
_{endnote}_]
518535
|====
519536

520537
=== New constraint for kernel bundle member functions

0 commit comments

Comments
 (0)