Skip to content
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

[Infer] Add head_dim=96 dispatch for block attention #70763

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions paddle/phi/kernels/fusion/gpu/block_attn.h
Original file line number Diff line number Diff line change
Expand Up @@ -1600,6 +1600,9 @@ void dispatch_blha_impl_headsize(const phi::GPUContext &dev_ctx,
dispatch_blha_impl_blocksize<T, 64, 64>(
params, dev_ctx.stream(), load_func, store_func, use_cachekv_int8);
break;
case 96:
dispatch_blha_impl_blocksize<T, 96, 96>(
params, dev_ctx.stream(), load_func, store_func, use_cachekv_int8);
case 128:
dispatch_blha_impl_blocksize<T, 128, 128>(
params, dev_ctx.stream(), load_func, store_func, use_cachekv_int8);
Expand Down
24 changes: 24 additions & 0 deletions paddle/phi/kernels/fusion/gpu/mmha_util.cu.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@ struct Qk_vec_<float, 64> {
using Type = float2;
};
template <>
struct Qk_vec_<float, 96> {
using Type = float4;
};
template <>
struct Qk_vec_<float, 128> {
using Type = float4;
};
Expand All @@ -317,6 +321,10 @@ struct Qk_vec_<float16, 64> {
using Type = uint32_t;
};
template <>
struct Qk_vec_<float16, 96> {
using Type = uint2;
};
template <>
struct Qk_vec_<float16, 128> {
using Type = uint2;
};
Expand All @@ -334,6 +342,10 @@ struct Qk_vec_<bfloat16, 64> {
using Type = __nv_bfloat162;
};
template <>
struct Qk_vec_<bfloat16, 96> {
using Type = bf16_4_t;
};
template <>
struct Qk_vec_<bfloat16, 128> {
using Type = bf16_4_t;
};
Expand All @@ -355,6 +367,10 @@ struct Qk_vec_RoPE_<float16, float, 64> {
using Type = float2;
};
template <>
struct Qk_vec_RoPE_<float16, float, 96> {
using Type = float4;
};
template <>
struct Qk_vec_RoPE_<float16, float, 128> {
using Type = float4;
};
Expand All @@ -371,6 +387,10 @@ struct Qk_vec_RoPE_<float, float, 64> {
using Type = float2;
};
template <>
struct Qk_vec_RoPE_<float, float, 96> {
using Type = float4;
};
template <>
struct Qk_vec_RoPE_<float, float, 128> {
using Type = float4;
};
Expand All @@ -388,6 +408,10 @@ struct Qk_vec_RoPE_<bfloat16, float, 64> {
using Type = float2;
};
template <>
struct Qk_vec_RoPE_<bfloat16, float, 96> {
using Type = float4;
};
template <>
struct Qk_vec_RoPE_<bfloat16, float, 128> {
using Type = float4;
};
Expand Down
Loading