-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xe: ocl: sdpa: pull grouped scales out of gemm where possible #2409
base: main
Are you sure you want to change the base?
Conversation
#if VAL_SCALES == QUANTIZE_1D | ||
DECLARE_2D_TILE(v_scales_tile_type, KEY_ATTR_SCALES_DATA_T, SUBGROUP_SIZE, | ||
ugemm_kq_sg_tile_m, 1, 1, 1) | ||
DECLARE_2D_TILE(v_scales_tile_type_float, float, SUBGROUP_SIZE, | ||
ugemm_kq_sg_tile_m, 1, 1, 1) | ||
DECLARE_2D_TILE_BLOCK_OPS(v_scales_tile_type, KEY_ATTR_SCALES_DATA_T, | ||
SUBGROUP_SIZE, ugemm_kq_sg_tile_m, 1, 1, 1) | ||
|
||
DECLARE_2D_TILE_HREDUCE(s_tile_type, SUBGROUP_SIZE, ugemm_kq_c_type_block0, | ||
ugemm_kq_c_type_block1, ugemm_kq_c_type_nblock0, | ||
ugemm_kq_c_type_nblock1, v_scales_tile_type_float, SUBGROUP_SIZE, | ||
ugemm_kq_sg_tile_m, 1, 1, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if VAL_SCALES == QUANTIZE_1D | |
DECLARE_2D_TILE(v_scales_tile_type, KEY_ATTR_SCALES_DATA_T, SUBGROUP_SIZE, | |
ugemm_kq_sg_tile_m, 1, 1, 1) | |
DECLARE_2D_TILE(v_scales_tile_type_float, float, SUBGROUP_SIZE, | |
ugemm_kq_sg_tile_m, 1, 1, 1) | |
DECLARE_2D_TILE_BLOCK_OPS(v_scales_tile_type, KEY_ATTR_SCALES_DATA_T, | |
SUBGROUP_SIZE, ugemm_kq_sg_tile_m, 1, 1, 1) | |
DECLARE_2D_TILE_HREDUCE(s_tile_type, SUBGROUP_SIZE, ugemm_kq_c_type_block0, | |
ugemm_kq_c_type_block1, ugemm_kq_c_type_nblock0, | |
ugemm_kq_c_type_nblock1, v_scales_tile_type_float, SUBGROUP_SIZE, | |
ugemm_kq_sg_tile_m, 1, 1, 1) | |
#if VAL_SCALES == QUANTIZE_1D | |
DECLARE_2D_TILE(v_scales_tile_type, VAL_ATTR_SCALES_DATA_T, SUBGROUP_SIZE, | |
ugemm_kq_sg_tile_m, 1, 1, 1) | |
DECLARE_2D_TILE(v_scales_tile_type_float, float, SUBGROUP_SIZE, | |
ugemm_kq_sg_tile_m, 1, 1, 1) | |
DECLARE_2D_TILE_BLOCK_OPS(v_scales_tile_type, VAL_ATTR_SCALES_DATA_T, | |
SUBGROUP_SIZE, ugemm_kq_sg_tile_m, 1, 1, 1) | |
DECLARE_2D_TILE_HREDUCE(s_tile_type, SUBGROUP_SIZE, ugemm_kq_c_type_block0, | |
ugemm_kq_c_type_block1, ugemm_kq_c_type_nblock0, | |
ugemm_kq_c_type_nblock1, v_scales_tile_type_float, SUBGROUP_SIZE, | |
ugemm_kq_sg_tile_m, 1, 1, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thanks.
@@ -21,11 +21,14 @@ | |||
#include "gemm_kq.h" | |||
#include "gemm_vs.h" | |||
|
|||
/* The quantization parameter may be unique for each token/element */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Random spot: do we have test cases covering new per-token scaling optimized path and the old path?
Hoists the K scaling out of the GEMM microkernel where possible. Here, "where possible" means no zp and group size >= head size (so effectively per-token scaling).