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
0d96a891
"tests/pipelines/vscode:/vscode.git/clone" did not exist on "beb848e2b6cc888bd5039e6f6cac7c932c6c3225"
Unverified
Commit
0d96a891
authored
Jan 30, 2025
by
Max Podkorytov
Browse files
fix numeric mismatches
parent
ee0654c4
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
8 deletions
+13
-8
example/ck_tile/18_flexattn/CMakeLists.txt
example/ck_tile/18_flexattn/CMakeLists.txt
+1
-1
example/ck_tile/18_flexattn/fmha_fwd.cpp
example/ck_tile/18_flexattn/fmha_fwd.cpp
+6
-3
include/ck_tile/ops/fmha/kernel/fmha_flex_fwd_kernel.hpp
include/ck_tile/ops/fmha/kernel/fmha_flex_fwd_kernel.hpp
+4
-1
include/ck_tile/ops/fmha/pipeline/block_fmha_pipeline_flex_qr_ks_vs.hpp
...e/ops/fmha/pipeline/block_fmha_pipeline_flex_qr_ks_vs.hpp
+1
-2
include/ck_tile/ops/fmha/pipeline/block_fmha_pipeline_flex_qr_ks_vs_async.hpp
...fmha/pipeline/block_fmha_pipeline_flex_qr_ks_vs_async.hpp
+1
-1
No files found.
example/ck_tile/18_flexattn/CMakeLists.txt
View file @
0d96a891
...
@@ -7,7 +7,7 @@ if(FMHA_FWD_ENABLE_APIS STREQUAL "all")
...
@@ -7,7 +7,7 @@ if(FMHA_FWD_ENABLE_APIS STREQUAL "all")
endif
()
endif
()
variable_watch
(
FMHA_SCORE_MOD_F
)
variable_watch
(
FMHA_SCORE_MOD_F
)
set
(
FMHA_SCORE_MOD_F
[[s + static_cast<decltype(s)>(q_idx - v_idx)]]
)
set
(
FMHA_SCORE_MOD_F
[[s + static_cast<decltype(s)>(
(
q_idx - v_idx)
% 8)
]]
)
foreach
(
api
${
FMHA_FWD_ENABLE_APIS
}
)
foreach
(
api
${
FMHA_FWD_ENABLE_APIS
}
)
if
(
NOT
"
${
api
}
"
IN_LIST FMHA_FWD_KNOWN_APIS
)
if
(
NOT
"
${
api
}
"
IN_LIST FMHA_FWD_KNOWN_APIS
)
...
...
example/ck_tile/18_flexattn/fmha_fwd.cpp
View file @
0d96a891
...
@@ -1384,17 +1384,20 @@ bool run(const ck_tile::ArgParser& arg_parser)
...
@@ -1384,17 +1384,20 @@ bool run(const ck_tile::ArgParser& arg_parser)
#endif
#endif
auto
score_mod
=
[]
(
auto
s
,
ck_tile
::
index_t
b
,
ck_tile
::
index_t
h
,
ck_tile
::
index_t
q_idx
,
ck_tile
::
index_t
v_idx
)
{
auto
score_mod
=
[]
(
auto
s
,
ck_tile
::
index_t
b
,
ck_tile
::
index_t
h
,
ck_tile
::
index_t
q_idx
,
ck_tile
::
index_t
v_idx
)
{
(
void
)
s
;
(
void
)
b
;
(
void
)
h
;
(
void
)
q_idx
;
(
void
)
v_idx
;
ck_tile
::
detail
::
swallow
(
s
,
b
,
h
,
q_idx
,
v_idx
)
;
return
CK_TILE_SCORE_MOD_F
;
return
CK_TILE_SCORE_MOD_F
;
};
};
s_host_ref
.
ForEach
([
&
](
auto
&
self
,
auto
i
)
{
s_host_ref
.
ForEach
([
&
](
auto
&
self
,
auto
i
)
{
self
(
i
)
=
score_mod
(
self
(
i
),
i
[
0
],
i
[
1
],
i
[
2
],
i
[
3
]);
auto
new_score
=
score_mod
(
self
(
i
),
wb
,
i
[
0
],
i
[
1
],
i
[
2
]);
// printf("host score_mod at (%d %lu %lu %lu), score before: %f, score after: %f\n",
// wb, i[0], i[1], i[2], self(i), new_score);
self
(
i
)
=
new_score
;
});
});
auto
scale_def
=
ck_tile
::
scales
(
scale_s
);
auto
scale_def
=
ck_tile
::
scales
(
scale_s
);
s_host_ref
.
ForEach
([
&
](
auto
&
self
,
auto
i
)
{
s_host_ref
.
ForEach
([
&
](
auto
&
self
,
auto
i
)
{
scale_def
(
self
(
i
));
self
(
i
)
=
scale_def
(
self
(
i
));
});
});
if
(
bias
.
type
==
bias_enum
::
elementwise_bias
)
if
(
bias
.
type
==
bias_enum
::
elementwise_bias
)
...
...
include/ck_tile/ops/fmha/kernel/fmha_flex_fwd_kernel.hpp
View file @
0d96a891
...
@@ -1309,7 +1309,10 @@ struct FmhaFwdKernel
...
@@ -1309,7 +1309,10 @@ struct FmhaFwdKernel
typename
ScoreModFunction_
::
TScore
s
,
typename
ScoreModFunction_
::
TScore
s
,
ck_tile
::
index_t
q_idx
,
ck_tile
::
index_t
q_idx
,
ck_tile
::
index_t
v_idx
)
{
ck_tile
::
index_t
v_idx
)
{
return
score_mod_def
(
s
,
b
,
h
,
q_idx
,
v_idx
);
auto
new_score
=
score_mod_def
(
s
,
b
,
h
,
q_idx
,
v_idx
);
\
// printf("device score_mod at (%d %d %d %d), score before: %f, score after: %f score_clip: %f\n",
// b, h, q_idx, v_idx, s, new_score, new_score_after_clip);
return
new_score
;
};
};
auto
o_acc_tile
=
[
&
]()
{
auto
o_acc_tile
=
[
&
]()
{
...
...
include/ck_tile/ops/fmha/pipeline/block_fmha_pipeline_flex_qr_ks_vs.hpp
View file @
0d96a891
...
@@ -350,9 +350,8 @@ struct BlockFmhaPipelineQRKSVS
...
@@ -350,9 +350,8 @@ struct BlockFmhaPipelineQRKSVS
s_acc
.
get_tile_distribution
(),
make_tuple
(
idx0
,
idx1
));
s_acc
.
get_tile_distribution
(),
make_tuple
(
idx0
,
idx1
));
const
auto
row
=
q_origin
.
at
(
number
<
0
>
{})
+
tile_idx
.
at
(
number
<
0
>
{});
const
auto
row
=
q_origin
.
at
(
number
<
0
>
{})
+
tile_idx
.
at
(
number
<
0
>
{});
const
auto
col
=
k_origin
.
at
(
number
<
0
>
{})
+
tile_idx
.
at
(
number
<
1
>
{});
const
auto
col
=
k_origin
.
at
(
number
<
1
>
{})
+
tile_idx
.
at
(
number
<
1
>
{});
constexpr
auto
i_j_idx
=
make_tuple
(
idx0
,
idx1
);
constexpr
auto
i_j_idx
=
make_tuple
(
idx0
,
idx1
);
s_acc
(
i_j_idx
)
=
score_mod
(
s_acc
(
i_j_idx
),
row
,
col
);
s_acc
(
i_j_idx
)
=
score_mod
(
s_acc
(
i_j_idx
),
row
,
col
);
});
});
});
});
...
...
include/ck_tile/ops/fmha/pipeline/block_fmha_pipeline_flex_qr_ks_vs_async.hpp
View file @
0d96a891
...
@@ -420,7 +420,7 @@ struct BlockFmhaPipelineQRKSVSAsync
...
@@ -420,7 +420,7 @@ struct BlockFmhaPipelineQRKSVSAsync
s_acc
.
get_tile_distribution
(),
make_tuple
(
idx0
,
idx1
));
s_acc
.
get_tile_distribution
(),
make_tuple
(
idx0
,
idx1
));
const
auto
row
=
q_origin
.
at
(
number
<
0
>
{})
+
tile_idx
.
at
(
number
<
0
>
{});
const
auto
row
=
q_origin
.
at
(
number
<
0
>
{})
+
tile_idx
.
at
(
number
<
0
>
{});
const
auto
col
=
k_origin
.
at
(
number
<
0
>
{})
+
tile_idx
.
at
(
number
<
1
>
{});
const
auto
col
=
k_origin
.
at
(
number
<
1
>
{})
+
tile_idx
.
at
(
number
<
1
>
{});
constexpr
auto
i_j_idx
=
make_tuple
(
idx0
,
idx1
);
constexpr
auto
i_j_idx
=
make_tuple
(
idx0
,
idx1
);
s_acc
(
i_j_idx
)
=
score_mod
(
s_acc
(
i_j_idx
),
row
,
col
);
s_acc
(
i_j_idx
)
=
score_mod
(
s_acc
(
i_j_idx
),
row
,
col
);
...
...
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