ggml
[Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685)
Brought by drakestapleton
ggml / src / ggml-metal / kernels / fa_f32.metal
| 1 | #include "common.h" |
| 2 | #include "dequantize.h" |
| 3 | #include "fa_common.metal" |
| 4 | |
| 5 | #define FA_TYPES \ |
| 6 | half, half4, simdgroup_half8x8, \ |
| 7 | half, half4x4, simdgroup_half8x8, \ |
| 8 | half, half4x4, simdgroup_half8x8, \ |
| 9 | float, simdgroup_float8x8, \ |
| 10 | float, float2, simdgroup_float8x8, \ |
| 11 | float, float4, simdgroup_float8x8 |
| 12 | //half, half4, simdgroup_half8x8 |
| 13 | |
| 14 | #define FA_TYPES_BF \ |
| 15 | bfloat, bfloat4, simdgroup_bfloat8x8, \ |
| 16 | bfloat, bfloat4x4, simdgroup_bfloat8x8, \ |
| 17 | bfloat, bfloat4x4, simdgroup_bfloat8x8, \ |
| 18 | float, simdgroup_float8x8, \ |
| 19 | float, float2, simdgroup_float8x8, \ |
| 20 | half, half4, simdgroup_half8x8 |
| 21 | //float, float4, simdgroup_float8x8 |
| 22 | |
| 23 | #define FA_TYPES_F32 \ |
| 24 | half, half4, simdgroup_half8x8, \ |
| 25 | float, float4x4, simdgroup_float8x8, \ |
| 26 | float, float4x4, simdgroup_float8x8, \ |
| 27 | float, simdgroup_float8x8, \ |
| 28 | float, float2, simdgroup_float8x8, \ |
| 29 | float, float4, simdgroup_float8x8 |
| 30 | //half, half4, simdgroup_half8x8 |
| 31 | |
| 32 | typedef decltype(kernel_flash_attn_ext<FA_TYPES, half4x4, 1, dequantize_f16, half4x4, 1, dequantize_f16, 64, 64>) flash_attn_ext_t; |
| 33 | |
| 34 | template [[host_name("kernel_flash_attn_ext_f32_dk32_dv32" )]] kernel flash_attn_ext_t kernel_flash_attn_ext<FA_TYPES_F32, float4x4, 1, dequantize_f32, float4x4, 1, dequantize_f32, 32, 32>; |
| 35 | template [[host_name("kernel_flash_attn_ext_f32_dk40_dv40" )]] kernel flash_attn_ext_t kernel_flash_attn_ext<FA_TYPES_F32, float4x4, 1, dequantize_f32, float4x4, 1, dequantize_f32, 40, 40>; |
| 36 | template [[host_name("kernel_flash_attn_ext_f32_dk48_dv48" )]] kernel flash_attn_ext_t kernel_flash_attn_ext<FA_TYPES_F32, float4x4, 1, dequantize_f32, float4x4, 1, dequantize_f32, 48, 48>; |
| 37 | template [[host_name("kernel_flash_attn_ext_f32_dk64_dv64" )]] kernel flash_attn_ext_t kernel_flash_attn_ext<FA_TYPES_F32, float4x4, 1, dequantize_f32, float4x4, 1, dequantize_f32, 64, 64>; |
| 38 | template [[host_name("kernel_flash_attn_ext_f32_dk72_dv72" )]] kernel flash_attn_ext_t kernel_flash_attn_ext<FA_TYPES_F32, float4x4, 1, dequantize_f32, float4x4, 1, dequantize_f32, 72, 72>; |
| 39 | template [[host_name("kernel_flash_attn_ext_f32_dk80_dv80" )]] kernel flash_attn_ext_t kernel_flash_attn_ext<FA_TYPES_F32, float4x4, 1, dequantize_f32, float4x4, 1, dequantize_f32, 80, 80>; |
| 40 | template [[host_name("kernel_flash_attn_ext_f32_dk96_dv96" )]] kernel flash_attn_ext_t kernel_flash_attn_ext<FA_TYPES_F32, float4x4, 1, dequantize_f32, float4x4, 1, dequantize_f32, 96, 96>; |
| 41 | template [[host_name("kernel_flash_attn_ext_f32_dk96_dv64" )]] kernel flash_attn_ext_t kernel_flash_attn_ext<FA_TYPES_F32, float4x4, 1, dequantize_f32, float4x4, 1, dequantize_f32, 96, 64>; |
| 42 | template [[host_name("kernel_flash_attn_ext_f32_dk112_dv112")]] kernel flash_attn_ext_t kernel_flash_attn_ext<FA_TYPES_F32, float4x4, 1, dequantize_f32, float4x4, 1, dequantize_f32, 112, 112>; |
| 43 | template [[host_name("kernel_flash_attn_ext_f32_dk128_dv128")]] kernel flash_attn_ext_t kernel_flash_attn_ext<FA_TYPES_F32, float4x4, 1, dequantize_f32, float4x4, 1, dequantize_f32, 128, 128>; |
| 44 | template [[host_name("kernel_flash_attn_ext_f32_dk128_dv96" )]] kernel flash_attn_ext_t kernel_flash_attn_ext<FA_TYPES_F32, float4x4, 1, dequantize_f32, float4x4, 1, dequantize_f32, 128, 96>; |
| 45 | template [[host_name("kernel_flash_attn_ext_f32_dk192_dv192")]] kernel flash_attn_ext_t kernel_flash_attn_ext<FA_TYPES_F32, float4x4, 1, dequantize_f32, float4x4, 1, dequantize_f32, 192, 192>; |
| 46 | template [[host_name("kernel_flash_attn_ext_f32_dk192_dv128")]] kernel flash_attn_ext_t kernel_flash_attn_ext<FA_TYPES_F32, float4x4, 1, dequantize_f32, float4x4, 1, dequantize_f32, 192, 128>; |
| 47 | template [[host_name("kernel_flash_attn_ext_f32_dk256_dv256")]] kernel flash_attn_ext_t kernel_flash_attn_ext<FA_TYPES_F32, float4x4, 1, dequantize_f32, float4x4, 1, dequantize_f32, 256, 256>; |
| 48 | template [[host_name("kernel_flash_attn_ext_f32_dk320_dv256")]] kernel flash_attn_ext_t kernel_flash_attn_ext<FA_TYPES_F32, float4x4, 1, dequantize_f32, float4x4, 1, dequantize_f32, 320, 256>; |
| 49 | template [[host_name("kernel_flash_attn_ext_f32_dk512_dv512")]] kernel flash_attn_ext_t kernel_flash_attn_ext<FA_TYPES_F32, float4x4, 1, dequantize_f32, float4x4, 1, dequantize_f32, 512, 512>; |
| 50 | template [[host_name("kernel_flash_attn_ext_f32_dk576_dv512")]] kernel flash_attn_ext_t kernel_flash_attn_ext<FA_TYPES_F32, float4x4, 1, dequantize_f32, float4x4, 1, dequantize_f32, 576, 512>; |
| 51 | |
| 52 | #undef FA_TYPES |
| 53 | #undef FA_TYPES_BF |
| 54 | #undef FA_TYPES_F32 |