Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
composable_kernel_ROCM
Commits
626ab5b6
Commit
626ab5b6
authored
Nov 28, 2024
by
Po Yen Chen
Browse files
Update num_splits heuristic for prefill phase
parent
287a53bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
4 deletions
+24
-4
example/ck_tile/01_fmha/fmha_fwd.cpp
example/ck_tile/01_fmha/fmha_fwd.cpp
+24
-4
No files found.
example/ck_tile/01_fmha/fmha_fwd.cpp
View file @
626ab5b6
...
@@ -211,8 +211,14 @@ int num_splits_heuristic(int batch_nhead_mblocks, int num_SMs, int max_splits)
...
@@ -211,8 +211,14 @@ int num_splits_heuristic(int batch_nhead_mblocks, int num_SMs, int max_splits)
return
1
;
return
1
;
}
}
int
override_num_splits_if_necessary
(
int
override_num_splits_if_necessary
(
int
batch
,
int
batch
,
int
nhead
,
int
max_seqlen_q
,
int
hdim_q
,
int
hdim_v
,
float
p_drop
,
int
num_splits
)
int
nhead
,
int
max_seqlen_q
,
int
hdim_q
,
int
hdim_v
,
float
p_drop
,
bool
is_prefill
,
int
num_splits
)
{
{
int
device
;
int
device
;
auto
status
=
hipGetDevice
(
&
device
);
auto
status
=
hipGetDevice
(
&
device
);
...
@@ -229,6 +235,13 @@ int override_num_splits_if_necessary(
...
@@ -229,6 +235,13 @@ int override_num_splits_if_necessary(
}
}
const
int
kM0
=
[
&
]
{
const
int
kM0
=
[
&
]
{
// get kM0 for prefill phase
if
(
is_prefill
)
{
return
128
;
}
// get kM0 for decode phase
/// TODO: take dtype=fp8/bf8 into consideration
/// TODO: take dtype=fp8/bf8 into consideration
const
std
::
map
<
int
,
int
>
hdim_to_m0
=
{
const
std
::
map
<
int
,
int
>
hdim_to_m0
=
{
{
32
,
32
},
{
32
,
32
},
...
@@ -553,8 +566,15 @@ bool run(const ck_tile::ArgParser& arg_parser)
...
@@ -553,8 +566,15 @@ bool run(const ck_tile::ArgParser& arg_parser)
// legalize num_splits according to other options
// legalize num_splits according to other options
if
(
num_splits
<
1
)
if
(
num_splits
<
1
)
{
{
num_splits
=
override_num_splits_if_necessary
(
num_splits
=
override_num_splits_if_necessary
(
batch
,
batch
,
nhead
,
max_seqlen_q
,
hdim_q
,
hdim_v
,
p_drop
,
num_splits
);
nhead
,
max_seqlen_q
,
hdim_q
,
hdim_v
,
p_drop
,
/*is_prefill=*/
mode
==
mode_enum
::
group
&&
0
<
page_block_size
,
num_splits
);
}
}
if
(
128
<
num_splits
)
if
(
128
<
num_splits
)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment