choice.hh
Go to the documentation of this file.
1#pragma once
2
3/// @file
4/// @brief spmm: direct, vendor. evidence: docs/perf/spmm.md @ingroup api_selection_ops
5
7
8#include <array>
9#include <string_view>
10#include <variant>
11
13
14struct Direct : select::NoFields<"direct"> {}; ///< sycl_spmm::spmm_native_csr: CSR only, no GPU gate (native_cpu too)
15struct Vendor : select::NoFields<"vendor"> {}; ///< backend::spmm_vendor (cuSPARSE, rocSPARSE, netlib) less known-defect shapes
16
17using SpmmChoice = std::variant<Direct, Vendor>; ///< fieldless: body (by transA), column block, pair load derived
18
19template <class T> /// Every compiled choice, in tie-break order (§6.3).
20constexpr auto candidates() { return select::all_of<SpmmChoice>(); }
21
22inline constexpr std::array<std::string_view, 2> last_resort{"vendor", "direct"}; ///< vendor: every format
23inline constexpr select::OpSpec spec{Op::spmm, select::Lib::sparse, {last_resort}}; ///< op, library, rules
24
25/// ConjTrans folds to T; m = A.rows() as stored; no nnz key (device memory). Work ~ m nrhs batch.
26inline constexpr std::array<std::string_view, 5> key_names{
27 "transA:exact", "transB:exact", "m:log", "nrhs:log", "batch:log"};
28
29/// The transcriber (tuned/README.md) spells the same grid; the transcribed predicates read no extent.
30inline constexpr std::array<int, 5> grid_m{1, 16, 256, 4096, 65536};
31inline constexpr std::array<int, 5> grid_nrhs{1, 2, 4, 16, 64};
32inline constexpr std::array<int, 5> grid_batch{1, 8, 128, 1024, 16384};
33
34} // namespace batchlas::ops::spmm
constexpr auto all_of()
Every alternative of a field-less choice variant, in declaration (= tie-break) order.
Definition select.hh:110
constexpr std::array< int, 5 > grid_m
The transcriber (tuned/README.md) spells the same grid; the transcribed predicates read no extent.
Definition choice.hh:30
constexpr std::array< int, 5 > grid_nrhs
Definition choice.hh:31
std::variant< Direct, Vendor > SpmmChoice
fieldless: body (by transA), column block, pair load derived
Definition choice.hh:17
constexpr auto candidates()
Every compiled choice, in tie-break order (§6.3).
Definition choice.hh:20
constexpr std::array< std::string_view, 2 > last_resort
vendor: every format
Definition choice.hh:22
constexpr select::OpSpec spec
op, library, rules
Definition choice.hh:23
constexpr std::array< std::string_view, 5 > key_names
ConjTrans folds to T; m = A.rows() as stored; no nnz key (device memory). Work ~ m nrhs batch.
Definition choice.hh:26
constexpr std::array< int, 5 > grid_batch
Definition choice.hh:32
Flat kernel selection: one choose() per op over measured per-device tables.
sycl_spmm::spmm_native_csr: CSR only, no GPU gate (native_cpu too)
Definition choice.hh:14
backend::spmm_vendor (cuSPARSE, rocSPARSE, netlib) less known-defect shapes
Definition choice.hh:15
Base of a family with no knobs: struct Cta : NoFields<"cta"> {};.
Definition select.hh:101
What an op's choice.hh declares once: its name, the library its Vendor family calls (one gate for can...
Definition select.hh:529