21#ifndef EMBER_DECODE_ATTN_TILED_CUH
22#define EMBER_DECODE_ATTN_TILED_CUH
24#include <cuda_runtime.h>
66 const int n =
k1 -
k0;
70 float*
s =
reinterpret_cast<float*
>(
q4 +
d4n);
88 for (
int j = ql;
j <
d4n;
j += 4) {
132 for (
int i = g;
i <
n;
i +=
G) {
133 const float w =
s[
i];
143 const float*
pacc =
reinterpret_cast<const float*
>(
pacc4);
174 if (
tid == 0)
inv_s =
l > 0.0f ? 1.0f /
l : 0.0f;
180 const float*
p =
base + 2 + d;
const float * p[kIrDepthSourcesMax]
__host__ bool tiled_shape_ok(int heads, int head_dim, int max_len, int heads_max, int min_chunk, int max_chunks)
__host__ size_t tiled_shm_bytes(int head_dim, int max_len, int min_chunk, int max_chunks)
__host__ __device__ int tiled_nchunks(int L, int chunk)
constexpr int kTiledHeadDimMax
__device__ __forceinline__ void tiled_split_block(const float *__restrict__ Qh, const float *__restrict__ K, const float *__restrict__ V, int L, int c, int kvh, int num_kv_heads, int head_dim, float scale, int min_chunk, int max_chunks, float *__restrict__ part)
constexpr int kTiledThreads
constexpr int kTiledMaxChunks
__host__ __device__ int tiled_chunk(int L, int min_chunk, int max_chunks)
constexpr int kTiledMinChunk
constexpr int kTiledChunkMax
__device__ __forceinline__ void tiled_merge_block(const float *__restrict__ base, float *__restrict__ out_h, int L, int head_dim, int min_chunk, int max_chunks)
__host__ __device__ int tiled_grid_chunks(int max_len, int min_chunk, int max_chunks)