9#include <src/kernels/common/tiny_device.hh>
11#include <src/sycl/device_scalar.hh>
12#include <src/util/resident_capacity.hh>
13#include <src/sycl/kernel_attrs.hh>
22template <
int N,
typename R,
typename Part>
25 for (uint32_t mask = 1u; mask < static_cast<uint32_t>(N); mask <<= 1) {
26 value = sycl::fmax(value, permute_group_by_xor(part, value, mask));
31template <
int N,
typename R,
typename Part>
34 for (uint32_t mask = 1u; mask < static_cast<uint32_t>(N); mask <<= 1) {
35 value += permute_group_by_xor(part, value, mask);
46 return (n_pad == 8) ? 0 : (n_pad == 16) ? 1 : (n_pad == 32) ? 2 : -1;
52 static constexpr int at[3] = {0, 0, 0};
54 static constexpr int pin[3] = {0, 0, 0};
57 static constexpr int at[3] = {64, 91, 142};
59 static constexpr int pin[3] = {0, 0, 0};
64 static constexpr int at[3] = {84, 124, 193};
66 static constexpr int pin[3] = {0, 0, 16};
69 static constexpr int at[3] = {72, 128, 168};
71 static constexpr int pin[3] = {0, 0, 0};
76 static constexpr int at[3] = {110, 162, 226};
78 static constexpr int pin[3] = {0, 0, 0};
83 return static_cast<int>(
sizeof(D) /
sizeof(float));
93template <
typename D,
int N>
96 static_assert(slot >= 0,
"N must be on the {8, 16, 32} ladder");
112 if (regs <= 0 || wg <= 0)
return 0;
115 if (b > by_threads) b = by_threads;
123 return static_cast<std::size_t
>(n_pad) *
static_cast<std::size_t
>(c + 1) +
124 static_cast<std::size_t
>(c);
131 int matrices_per_wg) {
132 const std::size_t per_wg =
static_cast<std::size_t
>(matrices_per_wg) *
146 return resident::pack_matrices_per_wg(1u, N,
155static_assert(
kGeqrfTinyWg / tiny_native::kTinySubGroupSize >= 2,
156 "R3 wants at least two sub-groups per work-group");
160template <
typename D,
int N>
163 if (pinned > 0)
return pinned;
165 const int wg = mats * N;
169 return (N >= 4) ? N / 4 : N;
174template <
typename D,
int N>
183template <
typename D,
int N>
187 resident::kMinBlocksPerSm;
constexpr std::size_t kGeqrfTinyReferenceSlm
constexpr int kGeqrfTinyRegOverhead
constexpr int geqrf_tiny_reg_slot(int n_pad)
constexpr int kGeqrfTinyMaxBlocksPerSm
constexpr std::size_t geqrf_tiny_slm_elems(int n_pad, int c)
constexpr int geqrf_tiny_blocks_by_slm(int n_pad, int c, std::size_t elem_bytes, int matrices_per_wg)
constexpr int geqrf_tiny_slda(int c)
constexpr int geqrf_tiny_blocks_by_regs(int regs, int wg)
constexpr int kGeqrfTinyRegsPerSm
constexpr int kGeqrfTinyRegMargin
constexpr int geqrf_tiny_regs_for()
constexpr int geqrf_tiny_words()
constexpr int kGeqrfTinyWg
R geqrf_tiny_reduce_sum(const Part &part, R value)
constexpr bool geqrf_tiny_chunk_is_fixed_point()
constexpr int geqrf_tiny_matrices_per_wg()
constexpr int geqrf_tiny_regs(int n_pad, int words)
constexpr int geqrf_tiny_chunk()
R geqrf_tiny_reduce_fmax(const Part &part, R value)
constexpr int geqrf_tiny_ceil8(int regs)
constexpr int kGeqrfTinyThreadsPerSm
constexpr bool geqrf_tiny_cell_is_resident()
static constexpr int pin[3]
static constexpr int probed_chunk[3]
static constexpr int at[3]
static constexpr int at[3]
static constexpr int probed_chunk[3]
static constexpr int pin[3]
static constexpr int pin[3]
static constexpr int probed_chunk[3]
static constexpr int at[3]
static constexpr int pin[3]
static constexpr int at[3]
static constexpr int probed_chunk[3]
static constexpr int probed_chunk[3]
static constexpr int at[3]
static constexpr int pin[3]