choice.hh
Go to the documentation of this file.
1#pragma once
2
3/// @file
4/// @brief trsm: cta, sg_left, blocked, vendor. evidence: docs/perf/trsm.md @ingroup api_selection_ops
5
7
8#include <array>
9#include <string_view>
10#include <variant>
11
13
14struct Cta : select::NoFields<"cta"> {}; ///< trsm_native_v1_dispatch, order <= 32
15struct SgLeft : select::NoFields<"sg_left"> {}; ///< trsm_native_sg_left_dispatch: Left, order <= 32, sg 32
16struct Blocked : select::NoFields<"blocked"> {}; ///< trsm_native_blocked + the public gemm, any order
17struct Vendor : select::NoFields<"vendor"> {}; ///< backend::trsm_vendor; needs the level-3 library
18
19using TrsmChoice = std::variant<Cta, SgLeft, Blocked, Vendor>; ///< fieldless: buckets, wg ladder, outer block derived
20
21template <class T> /// Every compiled choice, once, in tie-break order (§6.3): native first, vendor last.
22constexpr auto candidates() { return select::all_of<TrsmChoice>(); }
23
24inline constexpr select::OpSpec spec{Op::trsm, select::Lib::level3}; ///< last resort (§5.5): blocked, vendor (CPU)
25
26inline constexpr std::array<std::string_view, 5> key_names{ ///< q: B.cols (Left) or B.rows (Right)
27 "side:exact", "trans:exact", "order:log:2", "q:log", "batch:log"}; // ConjTrans is T; no uplo/diag key; work ~ order^2 q batch
28
29/// The tuner's grid; the transcriber (tuned/README.md) spells the same grid.
30/// evidence: docs/design/flat-kernel-selection-phase3-plan.md (§3)
31inline constexpr std::array<int, 18> grid_order{1, 2, 4, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 256, 384, 512,
32 768, 1024};
33inline constexpr std::array<int, 12> grid_q{1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 4096};
34inline constexpr std::array<int, 5> grid_batch{128, 512, 2048, 8192, 32768};
35
36} // namespace batchlas::ops::trsm
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, 18 > grid_order
The tuner's grid; the transcriber (tuned/README.md) spells the same grid.
Definition choice.hh:31
constexpr std::array< int, 12 > grid_q
Definition choice.hh:33
constexpr std::array< int, 5 > grid_batch
Definition choice.hh:34
std::variant< Cta, SgLeft, Blocked, Vendor > TrsmChoice
fieldless: buckets, wg ladder, outer block derived
Definition choice.hh:19
constexpr std::array< std::string_view, 5 > key_names
q: B.cols (Left) or B.rows (Right)
Definition choice.hh:26
constexpr select::OpSpec spec
last resort (§5.5): blocked, vendor (CPU)
Definition choice.hh:24
constexpr auto candidates()
Every compiled choice, once, in tie-break order (§6.3): native first, vendor last.
Definition choice.hh:22
Flat kernel selection: one choose() per op over measured per-device tables.
trsm_native_blocked + the public gemm, any order
Definition choice.hh:16
trsm_native_v1_dispatch, order <= 32
Definition choice.hh:14
trsm_native_sg_left_dispatch: Left, order <= 32, sg 32
Definition choice.hh:15
backend::trsm_vendor; needs the level-3 library
Definition choice.hh:17
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