Skip to content

Commit 079597d

Browse files
author
Alexander Batashev
authored
[SYCL][Doc] Improve ESIMD docs rendering in doxygen (#2811)
1 parent bd5893a commit 079597d

File tree

4 files changed

+351
-350
lines changed

4 files changed

+351
-350
lines changed

sycl/include/CL/sycl/INTEL/esimd.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
#pragma once
1212

13+
/// \defgroup sycl_esimd DPC++ Explicit SIMD API
14+
1315
#include <CL/sycl/INTEL/esimd/esimd.hpp>
1416
#include <CL/sycl/INTEL/esimd/esimd_math.hpp>
1517
#include <CL/sycl/INTEL/esimd/esimd_memory.hpp>

sycl/include/CL/sycl/INTEL/esimd/esimd.hpp

Lines changed: 67 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,30 @@ namespace sycl {
1818
namespace INTEL {
1919
namespace gpu {
2020

21-
//
22-
// The simd vector class.
23-
//
24-
// This is a wrapper class for llvm vector values. Additionally this class
25-
// supports region operations that map to Intel GPU regions. The type of
26-
// a region select or format operation is of simd_view type, which models
27-
// read-update-write semantics.
28-
//
21+
/// The simd vector class.
22+
///
23+
/// This is a wrapper class for llvm vector values. Additionally this class
24+
/// supports region operations that map to Intel GPU regions. The type of
25+
/// a region select or format operation is of simd_view type, which models
26+
/// read-update-write semantics.
27+
///
28+
/// \ingroup sycl_esimd
2929
template <typename Ty, int N> class simd {
3030
public:
31-
// The underlying builtin data type.
31+
/// The underlying builtin data type.
3232
using vector_type = vector_type_t<Ty, N>;
3333

34-
// The element type of this simd object.
34+
/// The element type of this simd object.
3535
using element_type = Ty;
3636

37-
// The number of elements in this simd object.
37+
/// The number of elements in this simd object.
3838
static constexpr int length = N;
3939

4040
// TODO @rolandschulz
4141
// Provide examples why constexpr is needed here.
4242
//
43-
// Constructors.
43+
/// @{
44+
/// Constructors.
4445
constexpr simd() = default;
4546
constexpr simd(const simd &other) { set(other.data()); }
4647
constexpr simd(simd &&other) { set(other.data()); }
@@ -72,7 +73,7 @@ template <typename Ty, int N> class simd {
7273
}
7374
}
7475

75-
// Initialize a simd with an initial value and step.
76+
/// Initialize a simd with an initial value and step.
7677
constexpr simd(Ty Val, Ty Step = Ty()) noexcept {
7778
if (Step == Ty())
7879
M_data = Val;
@@ -84,6 +85,7 @@ template <typename Ty, int N> class simd {
8485
}
8586
}
8687
}
88+
/// @}
8789

8890
operator const vector_type &() const & { return M_data; }
8991
operator vector_type &() & { return M_data; }
@@ -96,14 +98,16 @@ template <typename Ty, int N> class simd {
9698
#endif
9799
}
98100

99-
// Whole region read and write.
101+
/// Whole region read.
100102
simd read() const { return data(); }
103+
104+
/// Whole region write.
101105
simd &write(const simd &Val) {
102106
set(Val.data());
103107
return *this;
104108
}
105109

106-
// whole region update with predicates
110+
/// Whole region update with predicates.
107111
void merge(const simd &Val, const mask_type_t<N> &Mask) {
108112
set(__esimd_wrregion<element_type, N, N, 0 /*VS*/, N, 1, N>(
109113
data(), Val.data(), 0, Mask));
@@ -113,11 +117,13 @@ template <typename Ty, int N> class simd {
113117
set(Val2.data());
114118
}
115119

116-
// Assignment operators.
120+
/// {@
121+
/// Assignment operators.
117122
constexpr simd &operator=(const simd &) & = default;
118123
constexpr simd &operator=(simd &&) & = default;
124+
/// @}
119125

120-
// View this simd object in a different element type.
126+
/// View this simd object in a different element type.
121127
template <typename EltTy> auto format() & {
122128
using TopRegionTy = compute_format_type_t<simd, EltTy>;
123129
using RetTy = simd_view<simd, TopRegionTy>;
@@ -127,40 +133,32 @@ template <typename Ty, int N> class simd {
127133

128134
// TODO @Ruyk, @iburyl - should renamed to bit_cast similar to std::bit_cast.
129135
//
130-
// View as a 2-dimensional simd_view.
136+
/// View as a 2-dimensional simd_view.
131137
template <typename EltTy, int Height, int Width> auto format() & {
132138
using TopRegionTy = compute_format_type_2d_t<simd, EltTy, Height, Width>;
133139
using RetTy = simd_view<simd, TopRegionTy>;
134140
TopRegionTy R(0, 0);
135141
return RetTy{*this, R};
136142
}
137143

138-
// \brief 1D region select, apply a region on top of this LValue object.
139-
//
140-
// @param Size the number of elements to be selected.
141-
//
142-
// @param Stride the element distance between two consecutive elements.
143-
//
144-
// @param Offset the starting element offset.
145-
//
146-
// @return the representing region object.
147-
//
144+
/// 1D region select, apply a region on top of this LValue object.
145+
///
146+
/// \tparam Size is the number of elements to be selected.
147+
/// \tparam Stride is the element distance between two consecutive elements.
148+
/// \param Offset is the starting element offset.
149+
/// \return the representing region object.
148150
template <int Size, int Stride>
149151
simd_view<simd, region1d_t<Ty, Size, Stride>> select(uint16_t Offset = 0) & {
150152
region1d_t<Ty, Size, Stride> Reg(Offset);
151153
return {*this, Reg};
152154
}
153155

154-
// \brief 1D region select, apply a region on top of this RValue object.
155-
//
156-
// @param Size the number of elements to be selected.
157-
//
158-
// @param Stride the element distance between two consecutive elements.
159-
//
160-
// @param Offset the starting element offset.
161-
//
162-
// @return the value this region object refers to.
163-
//
156+
/// 1D region select, apply a region on top of this RValue object.
157+
///
158+
/// \tparam Size is the number of elements to be selected.
159+
/// \tparam Stride is the element distance between two consecutive elements.
160+
/// \param Offset is the starting element offset.
161+
/// \return the value this region object refers to.
164162
template <int Size, int Stride>
165163
simd<Ty, Size> select(uint16_t Offset = 0) && {
166164
simd<Ty, N> &&Val = *this;
@@ -176,7 +174,7 @@ template <typename Ty, int N> class simd {
176174
// This would allow you to use the subscript operator to write to an
177175
// element.
178176
// {/quote}
179-
// Read a single element, by value only.
177+
/// Read a single element, by value only.
180178
Ty operator[](int i) const { return data()[i]; }
181179

182180
// TODO
@@ -278,28 +276,30 @@ template <typename Ty, int N> class simd {
278276
return Ret;
279277
}
280278

281-
// \brief replicate operation, replicate simd instance given a region
282-
//
283-
// @param Rep number of times region has to be replicated
284-
//
285-
// @param Offset offset in number of elements in src region
286-
//
287-
// @param VS vertical stride of src region to replicate
288-
//
289-
// @param W width of src region to replicate
290-
//
291-
// @param HS horizontal stride of src region to replicate
292-
//
293-
// @return replicated simd instance
279+
/// \name Replicate
280+
/// Replicate simd instance given a region.
281+
/// @{
282+
///
294283

284+
/// \tparam Rep is number of times region has to be replicated.
285+
/// \return replicated simd instance.
295286
template <int Rep> simd<Ty, Rep * N> replicate() {
296287
return replicate<Rep, N>(0);
297288
}
298289

290+
/// \tparam Rep is number of times region has to be replicated.
291+
/// \tparam W is width of src region to replicate.
292+
/// \param Offset is offset in number of elements in src region.
293+
/// \return replicated simd instance.
299294
template <int Rep, int W> simd<Ty, Rep * W> replicate(uint16_t Offset) {
300295
return replicate<Rep, W, W, 1>(Offset);
301296
}
302297

298+
/// \tparam Rep is number of times region has to be replicated.
299+
/// \tparam VS vertical stride of src region to replicate.
300+
/// \tparam W is width of src region to replicate.
301+
/// \param Offset is offset in number of elements in src region.
302+
/// \return replicated simd instance.
303303
template <int Rep, int VS, int W>
304304
simd<Ty, Rep * W> replicate(uint16_t Offset) {
305305
return replicate<Rep, VS, W, 1>(Offset);
@@ -318,35 +318,40 @@ template <typename Ty, int N> class simd {
318318
// s.replicate<R>(i).width<W>().vstride<VS>().hstride<HS>()
319319
// {/quote}
320320
// @jasonsewall-intel +1 for this
321+
/// \tparam Rep is number of times region has to be replicated.
322+
/// \tparam VS vertical stride of src region to replicate.
323+
/// \tparam W is width of src region to replicate.
324+
/// \tparam HS horizontal stride of src region to replicate.
325+
/// \param Offset is offset in number of elements in src region.
326+
/// \return replicated simd instance.
321327
template <int Rep, int VS, int W, int HS>
322328
simd<Ty, Rep * W> replicate(uint16_t Offset) {
323329
return __esimd_rdregion<element_type, N, Rep * W, VS, W, HS, N>(
324330
data(), Offset * sizeof(Ty));
325331
}
332+
///@}
326333

327-
// \brief any operation
328-
//
329-
// @return 1 if any element is set, 0 otherwise
330-
334+
/// Any operation.
335+
///
336+
/// \return 1 if any element is set, 0 otherwise.
331337
template <
332338
typename T1 = element_type, typename T2 = Ty,
333339
typename = sycl::detail::enable_if_t<std::is_integral<T1>::value, T2>>
334340
uint16_t any() {
335341
return __esimd_any<Ty, N>(data());
336342
}
337343

338-
// \brief all operation
339-
//
340-
// @return 1 if all elements are set, 0 otherwise
341-
344+
/// All operation.
345+
///
346+
/// \return 1 if all elements are set, 0 otherwise.
342347
template <
343348
typename T1 = element_type, typename T2 = Ty,
344349
typename = sycl::detail::enable_if_t<std::is_integral<T1>::value, T2>>
345350
uint16_t all() {
346351
return __esimd_all<Ty, N>(data());
347352
}
348353

349-
// \brief write a simd-vector into a basic region of a simd object
354+
/// Write a simd-vector into a basic region of a simd object.
350355
template <typename RTy>
351356
ESIMD_INLINE void writeRegion(
352357
RTy Region,
@@ -373,7 +378,7 @@ template <typename Ty, int N> class simd {
373378
}
374379
}
375380

376-
// \brief write a simd-vector into a nested region of a simd object
381+
/// Write a simd-vector into a nested region of a simd object.
377382
template <typename TR, typename UR>
378383
ESIMD_INLINE void
379384
writeRegion(std::pair<TR, UR> Region,

0 commit comments

Comments
 (0)