register_launchers.hh
Go to the documentation of this file.
1#pragma once
2
4
5#include <stdexcept>
6
7namespace batchlas::sycl_gemm {
8
9// One row of the register-tiled GEMM dispatch table: launch_register_tiled<>'s
10// template parameters as a structural NTTP. The rows are ops::gemm::reg_configs
11// (src/ops/gemm/choice.hh). TRAP: TC defaults to 4 here but to ThreadTileRows
12// there, so every row states TR and TC.
13// evidence: docs/perf/gemm.md#gemm-the-register-tiled-launcher-table
14struct RegTile {
15 int M; // TileM
16 int N; // TileN
17 int K; // TileK
18 int TR = 4; // ThreadTileRows
19 int TC = 4; // ThreadTileCols
20 int VA = 4; // VecA
21 int VB = 4; // VecB
22 int Unroll = 1; // UnrollK
23 int Stages = 1; // software-pipeline depth (1 or 2)
26 // try_aligned: unpredicated when eligible, else predicated. require_aligned:
27 // throw when ineligible (...S2U1Aligned). NN rows only (static_asserted).
28 bool try_aligned = false;
29 bool require_aligned = false;
30};
31
32// The single register-tiled launcher. `trace` names the predicated
33// instantiation's trace scope, `trace_aligned` (if given) the unpredicated one.
34template <typename T, RegTile P>
39 T alpha,
40 T beta,
41 const char* trace,
42 const char* trace_aligned = nullptr) {
43 if constexpr (P.try_aligned || P.require_aligned) {
44 const bool eligible = can_use_aligned_nn_fast_path<T, P.M, P.N, P.K, P.VA, P.VB>(A, B, C);
45 if constexpr (P.require_aligned) {
46 if (!eligible) {
48 "Requested aligned GEMM kernel for a non-eligible matrix layout");
49 }
50 }
51 if (eligible) {
52 return launch_register_tiled<T, P.M, P.N, P.K, P.TR, P.TC, P.VA, P.VB, P.Unroll,
53 P.Stages, true, P.OpA, P.OpB>(
54 ctx, A, B, C, alpha, beta, trace_aligned != nullptr ? trace_aligned : trace);
55 }
56 }
57 return launch_register_tiled<T, P.M, P.N, P.K, P.TR, P.TC, P.VA, P.VB, P.Unroll, P.Stages,
58 false, P.OpA, P.OpB>(ctx, A, B, C, alpha, beta, trace);
59}
60
61} // namespace batchlas::sycl_gemm
Non-owning view of a batch of matrices: the argument type of every entry point.
Definition matrix.hh:485
No kernel, backend or vendor entry point in this build on this device serves the request.
Definition error.hh:122
Transpose
The operator op() applied to an operand: op(A) = A, A^T or A^H.
Definition enums.hh:171
@ NoTrans
op(A) = A.
Definition enums.hh:172
Event launch_register_tiled(Queue &ctx, const MatrixView< T, MatrixFormat::Dense > &A, const MatrixView< T, MatrixFormat::Dense > &B, const MatrixView< T, MatrixFormat::Dense > &C, T alpha, T beta, const char *kernel_trace_name)
bool can_use_aligned_nn_fast_path(const MatrixView< T, MatrixFormat::Dense > &A, const MatrixView< T, MatrixFormat::Dense > &B, const MatrixView< T, MatrixFormat::Dense > &C)
Event launch_reg(Queue &ctx, const MatrixView< T, MatrixFormat::Dense > &A, const MatrixView< T, MatrixFormat::Dense > &B, const MatrixView< T, MatrixFormat::Dense > &C, T alpha, T beta, const char *trace, const char *trace_aligned=nullptr)
Completion handle of enqueued work, returned by every entry point.
Where BatchLAS work runs: a device, a backend, an ordered SYCL queue and a workspace arena.