Skip to content

Commit 678399a

Browse files
authored
[ESIMD] Doxygen update part II - memory APIs. (#5443)
Signed-off-by: Konstantin S Bobrovsky <[email protected]>
1 parent faaba28 commit 678399a

File tree

6 files changed

+570
-339
lines changed

6 files changed

+570
-339
lines changed

sycl/include/sycl/ext/intel/experimental/esimd.hpp

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,36 @@
1010

1111
#pragma once
1212

13+
// clang-format off
14+
///
1315
/// @defgroup sycl_esimd DPC++ Explicit SIMD API
1416
/// This is a low-level API providing direct access to Intel GPU hardware
1517
/// features. ESIMD overview can be found
1618
/// [here](https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/experimental/SYCL_EXT_INTEL_ESIMD/SYCL_EXT_INTEL_ESIMD.md).
19+
/// Some terminology used in the API documentation:
20+
/// - *lane* -
21+
/// (or "vector lane") Individual "lane" of input and output elements
22+
/// in a ESIMD vector operation, such that all lanes combined for the
23+
/// input and output vectors of the operation. Lane is indentified by
24+
/// an ordinal in the [0, N-1) range, where N is the size of the
25+
/// input/output vectors.
26+
/// - *mask* -
27+
/// a vector of predicates which can be used to enable/disable
28+
/// execution of a vector operation over the correspondin lane.
29+
/// \c 0 predicate value disables execution, non-zero - enables.
30+
/// - *word* - 2 bytes.
31+
/// - *dword* ("double word") - 4 bytes.
32+
/// - *qword* ("quad word") - 8 bytes.
33+
/// - *oword* ("octal word") - 16 bytes.
34+
/// - *pixel* A 4 byte-aligned contiguous 128-bit chunk of memory logically
35+
/// divided into 4 32-bit channels - \c R,\c G, \c B, \c A. Multiple pixels
36+
/// can be accessed by ESIMD APIs, with ability to enable/disable access
37+
/// to each channel for all pixels.
38+
///
39+
// clang-format on
1740

18-
///@{
19-
/// @ingroup sycl_esimd
41+
/// @addtogroup sycl_esimd
42+
/// @{
2043

2144
/// @defgroup sycl_esimd_core ESIMD core.
2245
/// Core APIs defining main vector data types and their interfaces.
@@ -31,22 +54,17 @@
3154
/// @defgroup sycl_esimd_bitmanip Bit and mask manipulation APIs.
3255

3356
/// @defgroup sycl_esimd_conv Explicit conversions.
34-
/// @ingroup sycl_esimd
3557
/// Defines explicit conversions (with and without saturation), truncation etc.
3658
/// between ESIMD vector types.
3759

60+
/// @defgroup sycl_esimd_raw_send Raw send APIs.
61+
/// Implements the \c send instruction to send messages to variaous components
62+
/// of the Intel(R) processor graphics, as defined in the documentation at
63+
/// https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-icllp-vol02a-commandreference-instructions_2.pdf
64+
3865
/// @defgroup sycl_esimd_misc Miscellaneous ESIMD convenience functions.
3966

40-
/// The main components of the API are:
41-
/// - @ref sycl_esimd_core - core API defining main vector data types and
42-
/// their
43-
/// interfaces.
44-
/// - @ref sycl_esimd_memory
45-
/// - @ref sycl_esimd_math
46-
/// - @ref sycl_esimd_bitmanip
47-
/// - @ref sycl_esimd_conv
48-
/// - @ref sycl_esimd_misc
49-
///@}
67+
/// @} sycl_esimd
5068

5169
#include <sycl/ext/intel/experimental/esimd/alt_ui.hpp>
5270
#include <sycl/ext/intel/experimental/esimd/common.hpp>

sycl/include/sycl/ext/intel/experimental/esimd/common.hpp

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,24 +132,48 @@ constexpr int get_num_channels_enabled(rgba_channel_mask M) {
132132
is_channel_enabled(M, rgba_channel::A);
133133
}
134134

135-
/// Represents an atomic operation.
135+
/// Represents an atomic operation. Operations always return the old value(s) of
136+
/// the target memory location(s) as it was before the operation was applied.
137+
/// Each operation is annotated with a pseudocode illustrating its semantics,
138+
/// \c addr is a memory address (one of the many, as the atomic operation is
139+
/// vector) the operation is applied at, \c src0 is its first argumnet,
140+
/// \c src1 - second.
136141
enum class atomic_op : uint8_t {
142+
/// Addition: <code>*addr = *addr + src0</code>.
137143
add = 0x0,
144+
/// Subtraction: <code>*addr = *addr - src0</code>.
138145
sub = 0x1,
146+
/// Increment: <code>*addr = *addr + 1</code>.
139147
inc = 0x2,
148+
/// Decrement: <code>*addr = *addr - 1</code>.
140149
dec = 0x3,
150+
/// Minimum: <code>*addr = min(*addr, src0)</code>.
141151
min = 0x4,
152+
/// Maximum: <code>*addr = max(*addr, src0)</code>.
142153
max = 0x5,
154+
/// Exchange. <code>*addr == src0;</code>
143155
xchg = 0x6,
156+
/// Compare and exchange. <code>if (*addr == src0) *sddr = src1;</code>
144157
cmpxchg = 0x7,
158+
/// Bit \c and: <code>*addr = *addr & src0</code>.
145159
bit_and = 0x8,
160+
/// Bit \c or: <code>*addr = *addr | src0</code>.
146161
bit_or = 0x9,
162+
/// Bit \c xor: <code>*addr = *addr | src0</code>.
147163
bit_xor = 0xa,
164+
/// Minimum (signed integer): <code>*addr = min(*addr, src0)</code>.
148165
minsint = 0xb,
166+
/// Maximum (signed integer): <code>*addr = max(*addr, src0)</code>.
149167
maxsint = 0xc,
168+
/// Minimum (floating point): <code>*addr = min(*addr, src0)</code>.
150169
fmax = 0x10,
170+
/// Maximum (floating point): <code>*addr = max(*addr, src0)</code>.
151171
fmin = 0x11,
172+
/// Compare and exchange (floating point).
173+
/// <code>if (*addr == src0) *addr = src1;</code>
152174
fcmpwr = 0x12,
175+
/// Decrement: <code>*addr = *addr - 1</code>. The only operation which
176+
/// returns new value of the destination rather than old.
153177
predec = 0xff,
154178
};
155179

sycl/include/sycl/ext/intel/experimental/esimd/detail/operators.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ namespace experimental {
3131
namespace esimd {
3232
namespace detail {
3333
// clang-format off
34-
/// @ingroup sycl_esimd_core
34+
/// @addtogroup sycl_esimd_core
3535
/// @{
36+
3637
/// @defgroup sycl_esimd_core_binops C++ binary operators overloads for ESIMD.
37-
///
3838
/// Standard C++ binary operators overloads applicable to \c simd_obj_impl
3939
/// derivatives - \c simd , \c simd_mask , \c simd_view and their combinations.
4040
/// The following overloads are defined:

sycl/include/sycl/ext/intel/experimental/esimd/detail/simd_obj_impl.hpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,14 @@ namespace intel {
2525
namespace experimental {
2626
namespace esimd {
2727

28+
/// @addtogroup sycl_esimd_core
2829
/// @{
29-
/// @ingroup sycl_esimd_core
3030

31-
/// @name Alignment type tags for use with simd load/store operations.
31+
/// @defgroup sycl_esimd_core_align Alignment control
32+
/// Alignment type tags and related APIs for use with ESIMD memory access
33+
/// operations.
34+
35+
/// @addtogroup sycl_esimd_core_align
3236
/// @{
3337
/// element_aligned_tag type. Flag of this type should be used in load and store
3438
/// operations when memory address is aligned by simd object's element type.
@@ -60,7 +64,6 @@ inline constexpr element_aligned_tag element_aligned = {};
6064
inline constexpr vector_aligned_tag vector_aligned = {};
6165

6266
template <unsigned N> inline constexpr overaligned_tag<N> overaligned = {};
63-
/// @}
6467

6568
/// Checks if type is a simd load/store flag.
6669
template <typename T> struct is_simd_flag_type : std::false_type {};
@@ -77,6 +80,8 @@ struct is_simd_flag_type<overaligned_tag<N>> : std::true_type {};
7780
template <typename T>
7881
static inline constexpr bool is_simd_flag_type_v = is_simd_flag_type<T>::value;
7982

83+
/// @} alignment tags
84+
8085
/// @cond ESIMD_DETAIL
8186

8287
namespace detail {
@@ -165,9 +170,9 @@ class simd_obj_impl {
165170
}
166171

167172
public:
168-
/// @{
169-
/// Constructors.
170173
simd_obj_impl() = default;
174+
175+
/// Copy constructor.
171176
simd_obj_impl(const simd_obj_impl &other) {
172177
__esimd_dbg_print(simd_obj_impl(const simd_obj_impl &other));
173178
set(other.data());
@@ -234,8 +239,6 @@ class simd_obj_impl {
234239
copy_from(acc, offset, Flags{});
235240
}
236241

237-
/// @}
238-
239242
// Load the object's value from array.
240243
template <int N1>
241244
std::enable_if_t<N1 == N> copy_from(const RawTy (&&Arr)[N1]) {

sycl/include/sycl/ext/intel/experimental/esimd/math.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ namespace intel {
2828
namespace experimental {
2929
namespace esimd {
3030

31+
/// @addtogroup sycl_esimd_math
3132
/// @{
32-
/// @ingroup sycl_esimd_math
3333

3434
/// Conversion of input vector elements of type \p T1 into vector of elements of
3535
/// type \p T0 with saturation.
@@ -157,8 +157,8 @@ abs(T1 src0, int flag = saturation_off) {
157157

158158
/// @} sycl_esimd_math
159159

160+
/// @addtogroup sycl_esimd_bitmanip
160161
/// @{
161-
/// @ingroup sycl_esimd_bitmanip
162162

163163
/// Shift left operation (vector version)
164164
/// \tparam T0 element type of the returned vector. Must be any integer type.
@@ -498,8 +498,8 @@ asr(T1 src0, T2 src1, int flag = saturation_off) {
498498
}
499499
/// @} sycl_esimd_bitmanip
500500

501+
/// @addtogroup sycl_esimd_math
501502
/// @{
502-
/// @ingroup sycl_esimd_math
503503

504504
// imul
505505
#ifndef ESIMD_HAS_LONG_LONG
@@ -1323,8 +1323,8 @@ __ESIMD_API simd<float, SZ> pln(simd<float, 4> src0, simd<float, SZ> src1,
13231323
}
13241324
/// @} sycl_esimd_math
13251325

1326+
/// @addtogroup sycl_esimd_bitmanip
13261327
/// @{
1327-
/// @ingroup sycl_esimd_bitmanip
13281328

13291329
/// bf_reverse
13301330
template <typename T0, typename T1, int SZ>
@@ -1402,8 +1402,8 @@ ESIMD_NODEBUG
14021402

14031403
/// @} sycl_esimd_bitmanip
14041404

1405+
/// @addtogroup sycl_esimd_math
14051406
/// @{
1406-
/// @ingroup sycl_esimd_math
14071407

14081408
////////////////////////////////////////////////////////////////////////////////
14091409
// ESIMD arithmetic intrinsics:
@@ -1712,8 +1712,8 @@ ESIMD_NODEBUG ESIMD_INLINE T exp(T src0) {
17121712
}
17131713
/// @} sycl_esimd_math
17141714

1715+
/// @addtogroup sycl_esimd_conv
17151716
/// @{
1716-
/// @ingroup sycl_esimd_conv
17171717

17181718
////////////////////////////////////////////////////////////////////////////////
17191719
// Rounding intrinsics.
@@ -1748,8 +1748,8 @@ __ESIMD_INTRINSIC_DEF(rndz)
17481748
#undef __ESIMD_INTRINSIC_DEF
17491749
/// @} sycl_esimd_conv
17501750

1751+
/// @addtogroup sycl_esimd_bitmanip
17511752
/// @{
1752-
/// @ingroup sycl_esimd_bitmanip
17531753

17541754
template <int N>
17551755
ESIMD_NODEBUG
@@ -1938,8 +1938,8 @@ fbh(simd_view<BaseTy, RegionTy> src) {
19381938

19391939
/// @} sycl_esimd_bitmanip
19401940

1941+
/// @addtogroup sycl_esimd_math
19411942
/// @{
1942-
/// @ingroup sycl_esimd_math
19431943

19441944
/// \brief DP4A.
19451945
///

0 commit comments

Comments
 (0)