Skip to content

Commit c90c2a7

Browse files
fix comments
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
1 parent fb91c2b commit c90c2a7

File tree

14 files changed

+154
-78
lines changed

14 files changed

+154
-78
lines changed

libsycl/include/sycl/__impl/backend.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
_LIBSYCL_BEGIN_NAMESPACE_SYCL
2525

26-
// SYCL 2020 4.1. Backends
26+
// SYCL 2020 4.1. Backends.
2727
enum class backend : unsigned char {
2828
opencl = 0,
2929
level_zero,
@@ -35,7 +35,7 @@ namespace detail {
3535
template <typename T> struct is_backend_info_desc : std::false_type {};
3636
} // namespace detail
3737

38-
// SYCL 2020 4.5.1.1. Type traits backend_traits
38+
// SYCL 2020 4.5.1.1. Type traits backend_traits.
3939
template <backend Backend> class backend_traits;
4040

4141
template <backend Backend, typename SyclType>

libsycl/include/sycl/__impl/detail/obj_utils.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ SyclObject createSyclObjFromImpl(From &&from) {
6161
return ImplUtils::createSyclObjFromImpl<SyclObject>(std::forward<From>(from));
6262
}
6363

64-
// SYCL 2020 4.5.2. Common reference semantics (std::hash support)
64+
// SYCL 2020 4.5.2. Common reference semantics (std::hash support).
6565
template <typename T> struct HashBase {
6666
size_t operator()(const T &Obj) const {
6767
auto &Impl = sycl::detail::getSyclObjImpl(Obj);

libsycl/include/sycl/__impl/exception.hpp

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,29 @@ enum class errc : int {
4444
backend_mismatch = 14,
4545
};
4646

47-
/// Constructs an error code using E and sycl_category()
47+
/// Constructs an error code using sycl::errc and sycl_category().
48+
///
49+
/// \param E SYCL 2020 error code.
50+
///
51+
/// \returns constructed error code.
4852
_LIBSYCL_EXPORT std::error_code make_error_code(sycl::errc E) noexcept;
4953

5054
/// Obtains a reference to the static error category object for SYCL errors.
55+
///
56+
/// This object overrides the virtual function error_category::name() to return
57+
/// a pointer to the string "sycl". When the implementation throws an
58+
/// sycl::exception object Ex with this category, the error code value contained
59+
/// by the exception (Ex.code().value()) is one of the enumerated values in
60+
/// sycl::errc.
61+
///
62+
/// \returns the error category object for SYCL errors.
5163
_LIBSYCL_EXPORT const std::error_category &sycl_category() noexcept;
5264

53-
// Derive from std::exception so uncaught exceptions are printed in c++ default
54-
// exception handler.
55-
// Virtual inheritance is mandated by SYCL 2020.
56-
// SYCL 2020 4.13.2. Exception class interface
65+
/// \brief SYCL 2020 exception class (4.13.2.) for sync and async error handling
66+
/// in a SYCL application (host code).
67+
///
68+
/// Derived from std::exception so uncaught exceptions are printed in c++
69+
/// default exception handler. Virtual inheritance is mandated by SYCL 2020.
5770
class _LIBSYCL_EXPORT exception : public virtual std::exception {
5871
public:
5972
exception(std::error_code, const char *);
@@ -70,11 +83,26 @@ class _LIBSYCL_EXPORT exception : public virtual std::exception {
7083

7184
virtual ~exception();
7285

86+
/// Returns the error code stored inside the exception.
87+
///
88+
/// \returns the error code stored inside the exception.
7389
const std::error_code &code() const noexcept;
90+
91+
/// Returns the error category of the error code stored inside the exception.
92+
///
93+
/// \returns the error category of the error code stored inside the exception.
7494
const std::error_category &category() const noexcept;
7595

96+
/// Returns string that describes the error that triggered the exception.
97+
///
98+
/// \returns an implementation-defined non-null constant C-style string that
99+
/// describes the error that triggered the exception.
76100
const char *what() const noexcept final;
77101

102+
/// Checks if the exception has an associated SYCL context.
103+
///
104+
/// \returns true if this SYCL exception has an associated SYCL context and
105+
/// false if it does not.
78106
bool has_context() const noexcept;
79107

80108
private:
@@ -84,8 +112,7 @@ class _LIBSYCL_EXPORT exception : public virtual std::exception {
84112
std::error_code MErrC = make_error_code(sycl::errc::invalid);
85113
};
86114

87-
/// Used as a container for a list of asynchronous exceptions
88-
///
115+
/// \brief Used as a container for a list of asynchronous exceptions.
89116
class _LIBSYCL_EXPORT exception_list {
90117
public:
91118
using value_type = std::exception_ptr;
@@ -95,10 +122,21 @@ class _LIBSYCL_EXPORT exception_list {
95122
using iterator = std::vector<std::exception_ptr>::const_iterator;
96123
using const_iterator = std::vector<std::exception_ptr>::const_iterator;
97124

125+
/// Returns the size of the list.
126+
///
127+
/// \returns the size of the list.
98128
size_type size() const;
99-
// first asynchronous exception
129+
130+
/// Returns an iterator to the beginning of the list of asynchronous
131+
/// exceptions.
132+
///
133+
/// \returns an iterator to the beginning of the list of asynchronous
134+
/// exceptions.
100135
iterator begin() const;
101-
// refer to past-the-end last asynchronous exception
136+
137+
/// Returns an iterator to the end of the list of asynchronous exceptions.
138+
///
139+
/// \returns an iterator to the end of the list of asynchronous exceptions.
102140
iterator end() const;
103141

104142
private:

libsycl/include/sycl/__impl/info/desc_base.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//===----------------------------------------------------------------------===//
88
///
99
/// \file
10-
/// This file contains helpers for info descriptors
10+
/// This file contains helpers for info descriptors.
1111
///
1212
//===----------------------------------------------------------------------===//
1313

libsycl/include/sycl/__impl/info/platform.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ template <typename T>
2828
using is_platform_info_desc_t = typename is_info_desc<T, platform>::return_type;
2929
} // namespace detail
3030

31-
// SYCL 2020 A.1. Platform information descriptors
31+
// SYCL 2020 A.1. Platform information descriptors.
3232
namespace info {
3333
namespace platform {
34-
// SYCL 2020 4.6.2.4. Information descriptors
34+
// SYCL 2020 4.6.2.4. Information descriptors.
3535
struct version : detail::info_desc_tag<version, sycl::platform> {
3636
using return_type = std::string;
3737
};

libsycl/include/sycl/__impl/platform.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ namespace detail {
2929
class platform_impl;
3030
} // namespace detail
3131

32-
// SYCL 2020 4.6.2. Platform class
32+
/// \brief SYCL 2020 platform class (4.6.2.) encapsulating a single SYCL
33+
/// platform on which kernel functions may be executed.
3334
class _LIBSYCL_EXPORT platform {
3435
public:
3536
platform(const platform &rhs) = default;
@@ -46,7 +47,7 @@ class _LIBSYCL_EXPORT platform {
4647

4748
/// Returns the backend associated with this platform.
4849
///
49-
/// \return the backend associated with this platform
50+
/// \return the backend associated with this platform.
5051
backend get_backend() const noexcept;
5152

5253
/// Queries this SYCL platform for info.

libsycl/src/detail/global_objects.hpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,19 @@ _LIBSYCL_BEGIN_NAMESPACE_SYCL
2121
namespace detail {
2222
class platform_impl;
2323

24-
// Offload topologies (one per backend) discovered from liboffload.
24+
/// Returns offload topologies (one per backend) discovered from liboffload.
25+
///
26+
/// This vector is populated only once at the first call of get_platforms().
27+
///
28+
/// \returns std::vector of all offload topologies.
2529
std::vector<detail::OffloadTopology> &getOffloadTopologies();
2630

31+
/// Returns implementation class objects for all platforms discovered from
32+
/// liboffload.
33+
///
34+
/// This vector is populated only once at the first call of get_platforms().
35+
///
36+
/// \returns std::vector of implementation objects for all platforms.
2737
std::vector<std::unique_ptr<platform_impl>> &getPlatformCache();
2838

2939
} // namespace detail

libsycl/src/detail/offload/offload_topology.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ void discoverOffloadDevices() {
3434
ol_platform_handle_t Plat = nullptr;
3535
ol_result_t Res = call_nocheck(
3636
olGetDeviceInfo, Dev, OL_DEVICE_INFO_PLATFORM, sizeof(Plat), &Plat);
37-
// If error occures, ignore platform and continue iteration
37+
// If error occurs, ignore platform and continue iteration
3838
if (Res != OL_SUCCESS)
3939
return true;
4040

4141
ol_platform_backend_t OlBackend = OL_PLATFORM_BACKEND_UNKNOWN;
4242
Res = call_nocheck(olGetPlatformInfo, Plat, OL_PLATFORM_INFO_BACKEND,
4343
sizeof(OlBackend), &OlBackend);
44-
// If error occures, ignore platform and continue iteration
44+
// If error occurs, ignore platform and continue iteration
4545
if (Res != OL_SUCCESS)
4646
return true;
4747

libsycl/src/detail/offload/offload_topology.hpp

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ _LIBSYCL_BEGIN_NAMESPACE_SYCL
2121

2222
namespace detail {
2323

24-
// Minimal span-like view
24+
// Minimal span-like view.
2525
template <class T> struct range_view {
2626
T *ptr{};
2727
size_t len{};
@@ -34,28 +34,42 @@ template <class T> struct range_view {
3434
using PlatformWithDevStorageType =
3535
std::unordered_map<ol_platform_handle_t, std::vector<ol_device_handle_t>>;
3636

37-
// Contiguous global storage of platform handlers and device handles (grouped by
38-
// platform) for a backend.
37+
/// Contiguous global storage of platform handlers and device handles (grouped
38+
/// by platform) for a backend.
3939
struct OffloadTopology {
4040
OffloadTopology() : MBackend(OL_PLATFORM_BACKEND_UNKNOWN) {}
4141
OffloadTopology(ol_platform_backend_t OlBackend) : MBackend(OlBackend) {}
4242

43+
/// Updates backend for this topology.
44+
///
45+
/// \param B new backend value.
4346
void set_backend(ol_platform_backend_t B) { MBackend = B; }
4447

45-
// Platforms for this backend
48+
/// Returns all platforms associated with this topology.
49+
///
50+
/// \returns minimal span-like view to platforms associated with this
51+
/// topology.
4652
range_view<const ol_platform_handle_t> platforms() const {
4753
return {MPlatforms.data(), MPlatforms.size()};
4854
}
4955

50-
// Devices for a specific platform (platform_id is index into Platforms)
56+
/// Returns all devices associated with specific platform.
57+
///
58+
/// \param PlatformId platform_id is index into Platforms.
59+
///
60+
/// \returns minimal span-like view to devices associated with specified
61+
/// platform.
5162
range_view<const ol_device_handle_t>
5263
devicesForPlatform(size_t PlatformId) const {
5364
if (PlatformId >= MDevRangePerPlatformId.size())
5465
return {nullptr, 0};
5566
return MDevRangePerPlatformId[PlatformId];
5667
}
5768

58-
// Register new platform and devices into this topology under that platform.
69+
/// Register new platform and devices into this topology.
70+
///
71+
/// \param PlatformsAndDev associative container with platforms & devices.
72+
/// \param TotalDevCount total device count for the platform.
5973
void
6074
registerNewPlatformsAndDevices(PlatformWithDevStorageType &PlatformsAndDev,
6175
size_t TotalDevCount) {
@@ -77,6 +91,9 @@ struct OffloadTopology {
7791
assert(TotalDevCount == MDevices.size());
7892
}
7993

94+
/// Queries backend of this topology.
95+
///
96+
/// \returns backend of this topology.
8097
ol_platform_backend_t backend() const { return MBackend; }
8198

8299
private:

libsycl/src/detail/offload/offload_utils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
_LIBSYCL_BEGIN_NAMESPACE_SYCL
1212
namespace detail {
1313

14-
const char *stringifyErrorCode(ol_errc_t error) {
15-
switch (error) {
14+
const char *stringifyErrorCode(ol_errc_t Error) {
15+
switch (Error) {
1616
#define _OFFLOAD_ERRC(NAME) \
1717
case NAME: \
1818
return #NAME;

0 commit comments

Comments
 (0)