trsm_canonical.hh
Go to the documentation of this file.
1#pragma once
2
3// The canonical fold shared by every native TRSM kernel: the 24 (side, uplo, transA,
4// diag) combinations become ONE recurrence over a canonical unit-lower Lc.
5// evidence: docs/perf/trsm.md#design-v1-v2-and-the-canonical-fold
6
8
10
11struct Canonical {
13 bool do_conj;
15 bool unit;
16 bool fwd;
17};
18
19inline Canonical canonicalise(Side side, Uplo uplo, Transpose transA, Diag diag) {
20 Canonical c{};
21 c.do_trans = (transA != Transpose::NoTrans);
22 c.do_conj = (transA == Transpose::ConjTrans);
23 c.op_is_lower = (uplo == Uplo::Lower) ? !c.do_trans : c.do_trans;
24 c.unit = (diag == Diag::Unit);
25 // Backwards fwd is silent: it solves a different triangle and still returns.
26 c.fwd = (side == Side::Left) ? c.op_is_lower : !c.op_is_lower;
27 return c;
28}
29
30} // namespace batchlas::sycl_trsm
Enumerations, scalar traits and scalar concepts shared by every public header.
Transpose
The operator op() applied to an operand: op(A) = A, A^T or A^H.
Definition enums.hh:171
Diag
Whether a triangular operand's diagonal is read or assumed to be one.
Definition enums.hh:303
Uplo
Which triangle of a symmetric, Hermitian or triangular operand is referenced.
Definition enums.hh:287
Side
Side on which a special operand multiplies: op(A) * B or B * op(A).
Definition enums.hh:319
@ NoTrans
op(A) = A.
Definition enums.hh:172
@ ConjTrans
op(A) = A^H (the same as Trans for real scalars).
Definition enums.hh:174
@ Unit
The diagonal is taken as 1 and not read.
Definition enums.hh:305
@ Lower
The lower triangle (i >= j).
Definition enums.hh:289
@ Left
The special operand is on the left.
Definition enums.hh:320
Canonical canonicalise(Side side, Uplo uplo, Transpose transA, Diag diag)