Skip to content

Commit 08d3fcb

Browse files
[oneMKL][BLAS] add out-of-place TRMM and TRSM (#523)
* [oneMKL][BLAS] update TRMM spec for out-of-place operation * [oneMKL][BLAS] update TRSM spec for out-of-place operation * Consistent indentation * Consistent uplo / upper_lower naming
1 parent 6a7fb9e commit 08d3fcb

File tree

2 files changed

+575
-15
lines changed

2 files changed

+575
-15
lines changed

source/elements/oneMKL/source/domains/blas/trmm.rst

Lines changed: 288 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ the matrices in the multiplication is triangular. The argument
1919
``left_right`` determines if the triangular matrix, ``A``, is on the
2020
left of the multiplication (``left_right`` = ``side::left``) or on
2121
the right (``left_right`` = ``side::right``). Depending on
22-
``left_right``. The operation is defined as:
22+
``left_right``.
23+
24+
There are two operations available, an in-place operation and an out-of-place operation. The in-place operation is defined as:
2325

2426
.. math::
2527
@@ -31,16 +33,28 @@ or
3133
3234
B \leftarrow alpha*B*op(A)
3335
36+
The out-of-place operation is defined as:
37+
38+
.. math::
39+
40+
C \leftarrow alpha*op(A)*B + beta*C
41+
42+
or
43+
44+
.. math::
45+
46+
C \leftarrow alpha*B*op(A) + beta*C
47+
3448
where:
3549

3650
op(``A``) is one of op(``A``) = *A*, or op(``A``) = ``A``\ :sup:`T`,
3751
or op(``A``) = ``A``\ :sup:`H`,
3852

39-
``alpha`` is a scalar,
53+
``alpha`` and ``beta`` are scalars,
4054

41-
``A`` is a triangular matrix, and ``B`` is a general matrix.
55+
``A`` is a triangular matrix, and ``B`` and ``C`` are general matrices.
4256

43-
Here ``B`` is ``m`` x ``n`` and ``A`` is either ``m`` x ``m`` or
57+
Here ``B`` and ``C`` are ``m`` x ``n`` and ``A`` is either ``m`` x ``m`` or
4458
``n`` x ``n``, depending on ``left_right``.
4559

4660
``trmm`` supports the following precisions.
@@ -59,12 +73,16 @@ Here ``B`` is ``m`` x ``n`` and ``A`` is either ``m`` x ``m`` or
5973
trmm (Buffer Version)
6074
---------------------
6175

76+
**In-place API**
77+
----------------
78+
6279
.. rubric:: Syntax
6380

6481
.. code-block:: cpp
6582
6683
namespace oneapi::mkl::blas::column_major {
6784
void trmm(sycl::queue &queue,
85+
onemkl::side left_right,
6886
onemkl::uplo upper_lower,
6987
onemkl::transpose transa,
7088
onemkl::diag unit_diag,
@@ -80,6 +98,7 @@ trmm (Buffer Version)
8098
8199
namespace oneapi::mkl::blas::row_major {
82100
void trmm(sycl::queue &queue,
101+
onemkl::side left_right,
83102
onemkl::uplo upper_lower,
84103
onemkl::transpose transa,
85104
onemkl::diag unit_diag,
@@ -103,7 +122,7 @@ trmm (Buffer Version)
103122
Specifies whether ``A`` is on the left side of the multiplication
104123
(``side::left``) or on the right side (``side::right``). See :ref:`onemkl_datatypes` for more details.
105124

106-
uplo
125+
upper_lower
107126
Specifies whether the matrix ``A`` is upper or lower triangular. See :ref:`onemkl_datatypes` for more details.
108127

109128
trans
@@ -181,19 +200,149 @@ trmm (Buffer Version)
181200

182201

183202
:ref:`oneapi::mkl::unimplemented<onemkl_exception_unimplemented>`
184-
185203

204+
**Out-of-place API**
205+
--------------------
206+
207+
.. rubric:: Syntax
208+
209+
.. code-block:: cpp
210+
211+
namespace oneapi::mkl::blas::column_major {
212+
void trmm(sycl::queue &queue,
213+
onemkl::side left_right,
214+
onemkl::uplo upper_lower,
215+
onemkl::transpose trans,
216+
onemkl::diag unit_diag,
217+
std::int64_t m,
218+
std::int64_t n,
219+
T alpha,
220+
sycl::buffer<T,1> &a,
221+
std::int64_t lda,
222+
sycl::buffer<T,1> &b,
223+
std::int64_t ldb,
224+
T beta,
225+
sycl::buffer<T,1> &c,
226+
std::int64_t ldc)
227+
}
228+
229+
.. code-block:: cpp
230+
231+
namespace oneapi::mkl::blas::row_major {
232+
void trmm(sycl::queue &queue,
233+
onemkl::side left_right,
234+
onemkl::uplo upper_lower,
235+
onemkl::transpose trans,
236+
onemkl::diag unit_diag,
237+
std::int64_t m,
238+
std::int64_t n,
239+
T alpha,
240+
sycl::buffer<T,1> &a,
241+
std::int64_t lda,
242+
sycl::buffer<T,1> &b,
243+
std::int64_t ldb,
244+
T beta,
245+
sycl::buffer<T,1> &c,
246+
std::int64_t ldc)
247+
}
248+
249+
250+
.. container:: section
251+
252+
.. rubric:: Input Parameters
253+
254+
queue
255+
The queue where the routine should be executed.
256+
257+
left_right
258+
Specifies whether ``A`` is on the left side of the multiplication
259+
(``side::left``) or on the right side (``side::right``). See :ref:`onemkl_datatypes` for more details.
260+
261+
upper_lower
262+
Specifies whether the matrix ``A`` is upper or lower triangular. See :ref:`onemkl_datatypes` for more details.
263+
264+
trans
265+
Specifies op(``A``), the transposition operation applied to matrix ``A``. See :ref:`onemkl_datatypes` for more details.
266+
267+
unit_diag
268+
Specifies whether ``A`` is assumed to be unit triangular (all diagonal elements are 1). See :ref:`onemkl_datatypes` for more details.
269+
270+
m
271+
Specifices the number of rows of ``B``. The value of ``m`` must be at least zero.
272+
273+
n
274+
Specifies the Number of columns of ``B``. The value of ``n`` must be at least zero.
275+
276+
alpha
277+
Scaling factor for matrix-matrix product.
278+
279+
a
280+
Buffer holding input matrix ``A``. Must have size at least
281+
``lda``\ \*\ ``m`` if ``left_right`` = ``side::left`` or ``lda``\ \*\ ``n`` if ``left_right`` = ``side::right``. See :ref:`matrix-storage` for more details.
282+
283+
lda
284+
Leading dimension of ``A``. Must be at least ``m`` if ``left_right`` = ``side::left`` or at least ``n`` if ``left_right`` = ``side::right``. Must be positive.
285+
286+
b
287+
Buffer holding input matrix ``B``. Must have size at least
288+
``ldb``\ \*\ ``n`` if column major layout or at least ``ldb``\ \*\ ``m`` if row major layout is used. See :ref:`matrix-storage` for more details.
289+
290+
ldb
291+
Leading dimension of matrix ``B``. It must be positive and at least ``m`` if column major layout or at least ``n`` if row major layout is used.
292+
293+
beta
294+
Scaling factor for matrix ``C``.
295+
296+
c
297+
Buffer holding input/output matrix ``C``. Size of the buffer must be at least
298+
``ldc``\ \*\ ``n`` if column major layout or at least ``ldc``\ \*\ ``m`` if row major layout is used. See :ref:`matrix-storage` for more details.
299+
300+
ldc
301+
Leading dimension of matrix ``C``. Must be at least ``m`` if column major layout or at least ``n`` if row major layout is used. Must be positive.
302+
303+
.. container:: section
304+
305+
.. rubric:: Output Parameters
306+
307+
c
308+
Output buffer overwritten by ``alpha``\ \*\ op(``A``)\ \*\ ``B`` + ``beta``\ \*\ ``C`` if ``left_right`` = ``side::left`` or ``alpha``\ \*\ ``B``\ \*\ op(``A``) + ``beta``\ \*\ ``C`` if ``left_right`` = ``side::right``.
309+
310+
.. container:: section
311+
312+
.. rubric:: Throws
313+
314+
This routine shall throw the following exceptions if the associated condition is detected. An implementation may throw additional implementation-specific exception(s) in case of error conditions not covered here.
315+
316+
:ref:`oneapi::mkl::invalid_argument<onemkl_exception_invalid_argument>`
317+
318+
319+
:ref:`oneapi::mkl::unsupported_device<onemkl_exception_unsupported_device>`
320+
321+
322+
:ref:`oneapi::mkl::host_bad_alloc<onemkl_exception_host_bad_alloc>`
323+
324+
325+
:ref:`oneapi::mkl::device_bad_alloc<onemkl_exception_device_bad_alloc>`
326+
327+
328+
:ref:`oneapi::mkl::unimplemented<onemkl_exception_unimplemented>`
329+
330+
186331
.. _onemkl_blas_trmm_usm:
187332

188333
trmm (USM Version)
189334
------------------
190335

336+
**In-place API**
337+
----------------
338+
191339
.. rubric:: Syntax
192340

193341
.. code-block:: cpp
194342
195343
namespace oneapi::mkl::blas::column_major {
196344
sycl::event trmm(sycl::queue &queue,
345+
onemkl::side left_right,
197346
onemkl::uplo upper_lower,
198347
onemkl::transpose transa,
199348
onemkl::diag unit_diag,
@@ -210,6 +359,7 @@ trmm (USM Version)
210359
211360
namespace oneapi::mkl::blas::row_major {
212361
sycl::event trmm(sycl::queue &queue,
362+
onemkl::side left_right,
213363
onemkl::uplo upper_lower,
214364
onemkl::transpose transa,
215365
onemkl::diag unit_diag,
@@ -235,7 +385,7 @@ trmm (USM Version)
235385
multiplication (``side::left``) or on the right side
236386
(``side::right``). See :ref:`onemkl_datatypes` for more details.
237387

238-
uplo
388+
upper_lower
239389
Specifies whether the matrix ``A`` is upper or lower
240390
triangular. See :ref:`onemkl_datatypes` for more details.
241391

@@ -328,5 +478,136 @@ trmm (USM Version)
328478

329479
:ref:`oneapi::mkl::unimplemented<onemkl_exception_unimplemented>`
330480

481+
**Out-of-place API**
482+
--------------------
483+
484+
.. rubric:: Syntax
485+
486+
.. code-block:: cpp
487+
488+
namespace oneapi::mkl::blas::column_major {
489+
void trmm(sycl::queue &queue,
490+
onemkl::side left_right,
491+
onemkl::uplo upper_lower,
492+
onemkl::transpose trans,
493+
onemkl::diag unit_diag,
494+
std::int64_t m,
495+
std::int64_t n,
496+
value_or_pointer<T> alpha,
497+
const T *a,
498+
std::int64_t lda,
499+
const T *b,
500+
std::int64_t ldb,
501+
value_or_pointer<T> beta,
502+
T *c,
503+
std::int64_t ldc,
504+
const std::vector<sycl::event> &dependencies = {})
505+
}
506+
507+
.. code-block:: cpp
508+
509+
namespace oneapi::mkl::blas::row_major {
510+
void trmm(sycl::queue &queue,
511+
onemkl::side left_right,
512+
onemkl::uplo upper_lower,
513+
onemkl::transpose trans,
514+
onemkl::diag unit_diag,
515+
std::int64_t m,
516+
std::int64_t n,
517+
value_or_pointer<T> alpha,
518+
const T *a,
519+
std::int64_t lda,
520+
const T *b,
521+
std::int64_t ldb,
522+
value_or_pointer<T> beta,
523+
T *c,
524+
std::int64_t ldc,
525+
const std::vector<sycl::event> &dependencies = {})
526+
}
527+
528+
529+
.. container:: section
530+
531+
.. rubric:: Input Parameters
532+
533+
queue
534+
The queue where the routine should be executed.
535+
536+
left_right
537+
Specifies whether ``A`` is on the left side of the multiplication
538+
(``side::left``) or on the right side (``side::right``). See :ref:`onemkl_datatypes` for more details.
539+
540+
upper_lower
541+
Specifies whether the matrix ``A`` is upper or lower triangular. See :ref:`onemkl_datatypes` for more details.
542+
543+
trans
544+
Specifies op(``A``), the transposition operation applied to matrix ``A``. See :ref:`onemkl_datatypes` for more details.
545+
546+
unit_diag
547+
Specifies whether ``A`` is assumed to be unit triangular (all diagonal elements are 1). See :ref:`onemkl_datatypes` for more details.
548+
549+
m
550+
Specifices the number of rows of ``B``. The value of ``m`` must be at least zero.
551+
552+
n
553+
Specifies the Number of columns of ``B``. The value of ``n`` must be at least zero.
554+
555+
alpha
556+
Scaling factor for matrix-matrix product. See :ref:`value_or_pointer` for more details.
557+
558+
a
559+
Pointer to input matrix ``A``. Must have size at least
560+
``lda``\ \*\ ``m`` if ``left_right`` = ``side::left`` or ``lda``\ \*\ ``n`` if ``left_right`` = ``side::right``. See :ref:`matrix-storage` for more details.
561+
562+
lda
563+
Leading dimension of ``A``. Must be at least ``m`` if ``left_right`` = ``side::left`` or at least ``n`` if ``left_right`` = ``side::right``. Must be positive.
564+
565+
b
566+
Pointer to input matrix ``B``. Must have size at least
567+
``ldb``\ \*\ ``n`` if column major layout or at least ``ldb``\ \*\ ``m`` if row major layout is used. See :ref:`matrix-storage` for more details.
568+
569+
ldb
570+
Leading dimension of matrix ``B``. It must be positive and at least ``m`` if column major layout or at least ``n`` if row major layout is used.
571+
572+
beta
573+
Scaling factor for matrix ``C``. See :ref:`value_or_pointer` for more details.
574+
575+
c
576+
Pointer to input/output matrix ``C``. Must have size at least
577+
``ldc``\ \*\ ``n`` if column major layout or at least ``ldc``\ \*\ ``m`` if row major layout is used. See :ref:`matrix-storage` for more details.
578+
579+
ldc
580+
Leading dimension of matrix ``C``. Must be at least ``m`` if column major layout or at least ``n`` if row major layout is used. Must be positive.
581+
582+
dependencies
583+
List of events to wait for before starting computation, if any.
584+
If omitted, defaults to no dependencies.
585+
586+
.. container:: section
587+
588+
.. rubric:: Output Parameters
589+
590+
c
591+
Pointer to the output matrix, overwritten by ``alpha``\ \*\ op(``A``)\ \*\ ``B`` + ``beta``\ \*\ ``C`` if ``left_right`` = ``side::left`` or ``alpha``\ \*\ ``B``\ \*\ op(``A``) + ``beta``\ \*\ ``C`` if ``left_right`` = ``side::right``.
592+
593+
.. container:: section
594+
595+
.. rubric:: Throws
596+
597+
This routine shall throw the following exceptions if the associated condition is detected. An implementation may throw additional implementation-specific exception(s) in case of error conditions not covered here.
598+
599+
:ref:`oneapi::mkl::invalid_argument<onemkl_exception_invalid_argument>`
600+
601+
602+
:ref:`oneapi::mkl::unsupported_device<onemkl_exception_unsupported_device>`
603+
604+
605+
:ref:`oneapi::mkl::host_bad_alloc<onemkl_exception_host_bad_alloc>`
606+
607+
608+
:ref:`oneapi::mkl::device_bad_alloc<onemkl_exception_device_bad_alloc>`
609+
610+
611+
:ref:`oneapi::mkl::unimplemented<onemkl_exception_unimplemented>`
331612

332613
**Parent topic:** :ref:`blas-level-3-routines`

0 commit comments

Comments
 (0)