choice.hh
Go to the documentation of this file.
1#pragma once
2
3/// @file
4/// @brief syr2k: triangular, vendor. evidence: docs/perf/level3.md @ingroup api_selection_ops
5
7
8#include <array>
9#include <cstdint>
10#include <string_view>
11#include <type_traits>
12#include <variant>
13
15
16struct Triangular : select::NoFields<"triangular"> {}; ///< syr2k_triangular_tiles<float>, CUDA GPU; real ConjTrans runs as Trans
17struct Vendor : select::NoFields<"vendor"> {}; ///< backend::syr2k_vendor (per-item ?syr2k loop)
18
19using Syr2kChoice = std::variant<Triangular, Vendor>; ///< fieldless: the aligned/predicated leg is derived
20
21template <class T> /// Every compiled choice, in tie-break order: triangular (float only, R7), vendor.
22constexpr auto candidates() {
23 if constexpr (std::is_same_v<T, float>)
24 return std::array<Syr2kChoice, 2>{Triangular{}, Vendor{}};
25 else
26 return std::array<Syr2kChoice, 1>{Vendor{}}; // the tile kernel is float-only (R7)
27}
28
29inline constexpr std::array<std::string_view, 2> last_resort{"triangular", "vendor"}; ///< triangular: any GPU shape
30inline constexpr select::OpSpec spec{Op::syr2k, select::Lib::level3, {last_resort}}; ///< op, vendor library, rules
31
32/// Keys: n = C's order, weight 2 (work ~ n^2 k batch); k = op(A)'s inner extent; batch.
33inline constexpr std::array<std::string_view, 3> key_names{"n:log:2", "k:log", "batch:log"};
34
35// The transcribed grid; the transcribed rule turned on batch 1|2 alone (tuned/README.md).
36inline constexpr std::array<int, 13> grid_n{1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096}; ///< n axis
37inline constexpr std::array<int, 5> grid_k{1, 8, 64, 512, 4096}; ///< k axis of the grid
38inline constexpr std::array<int, 7> grid_batch{1, 2, 3, 128, 1024, 8192, 32768}; ///< batch axis of the grid
39
40// The tile kernel puts the batch in grid z (SYCL dim 0) and its tile list in grid y: 65535 each.
41inline constexpr std::int64_t kMaxGridBatch = 65535; ///< batch ceiling of the tile kernel
42inline constexpr std::int64_t kMaxGridTiles = 65535; ///< tile-count ceiling of the tile kernel
43
44} // namespace batchlas::ops::syr2k
constexpr std::int64_t kMaxGridTiles
tile-count ceiling of the tile kernel
Definition choice.hh:42
constexpr std::array< std::string_view, 3 > key_names
Keys: n = C's order, weight 2 (work ~ n^2 k batch); k = op(A)'s inner extent; batch.
Definition choice.hh:33
constexpr auto candidates()
Every compiled choice, in tie-break order: triangular (float only, R7), vendor.
Definition choice.hh:22
constexpr std::array< std::string_view, 2 > last_resort
triangular: any GPU shape
Definition choice.hh:29
constexpr std::array< int, 5 > grid_k
k axis of the grid
Definition choice.hh:37
std::variant< Triangular, Vendor > Syr2kChoice
fieldless: the aligned/predicated leg is derived
Definition choice.hh:19
constexpr std::array< int, 7 > grid_batch
batch axis of the grid
Definition choice.hh:38
constexpr std::array< int, 13 > grid_n
n axis
Definition choice.hh:36
constexpr select::OpSpec spec
op, vendor library, rules
Definition choice.hh:30
constexpr std::int64_t kMaxGridBatch
batch ceiling of the tile kernel
Definition choice.hh:41
Flat kernel selection: one choose() per op over measured per-device tables.
syr2k_triangular_tiles<float>, CUDA GPU; real ConjTrans runs as Trans
Definition choice.hh:16
backend::syr2k_vendor (per-item ?syr2k loop)
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