Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
FlashMLA
Commits
98b7c697
Commit
98b7c697
authored
Feb 27, 2026
by
zhanghj2
Browse files
fp8 tp1性能提升
parent
24c52aee
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
367 additions
and
346 deletions
+367
-346
csrc/extension/flash_fwd_mla_kernel_fp8.h
csrc/extension/flash_fwd_mla_kernel_fp8.h
+311
-346
csrc/extension/utils.h
csrc/extension/utils.h
+56
-0
No files found.
csrc/extension/flash_fwd_mla_kernel_fp8.h
View file @
98b7c697
This diff is collapsed.
Click to expand it.
csrc/extension/utils.h
View file @
98b7c697
...
@@ -2692,6 +2692,62 @@ __forceinline__ __device__ void __ds_read_m32x32_row_col_rrow(Tensor0& src, int
...
@@ -2692,6 +2692,62 @@ __forceinline__ __device__ void __ds_read_m32x32_row_col_rrow(Tensor0& src, int
extern
__device__
__attribute__
((
const
))
float
__llvm_exp2_f32
(
float
)
__asm
(
"llvm.exp2.f32"
);
extern
__device__
__attribute__
((
const
))
float
__llvm_exp2_f32
(
float
)
__asm
(
"llvm.exp2.f32"
);
__device__
inline
uint32x4_t
make_rscr
(
unsigned
char
*
ptr
,
const
int
stride
,
const
int
zero_pad
)
{
uint32x4_t
rscr
;
*
(
uint64_t
*
)
&
rscr
=
(
reinterpret_cast
<
uint64_t
>
(
ptr
));
rscr
[
2
]
=
stride
;
rscr
[
3
]
=
(
1
<<
16
)
&
0XFFFFFFFF
;
rscr
[
3
]
|=
(
zero_pad
)
<<
8
;
return
rscr
;
}
template
<
class
SrcEngine
,
class
SrcLayout
,
class
DstEngine
,
class
DstLayout
>
CUTE_HOST_DEVICE
void
lds_direct_copy_qkvfp8_zero_lds
(
Tensor
<
SrcEngine
,
SrcLayout
>
const
&
src
,
Tensor
<
DstEngine
,
DstLayout
>
&
dst
,
int
k_idx_
)
{
constexpr
int
warp_size
=
64
;
int
tidx
=
threadIdx
.
x
;
//0-256
int
warp_id
=
__builtin_amdgcn_readfirstlane
(
tidx
/
warp_size
);
int
lane
=
tidx
%
warp_size
;
//0-63
constexpr
int
element_size
=
1
;
int
k_idx
=
__builtin_amdgcn_readfirstlane
(
k_idx_
);
//576
const
int
offset_s
=
0
;
struct
PtrWrapper
{
uint32_t
former
;
uint32_t
latter
;
};
PtrWrapper
glob_ptr
;
*
(
uint64_t
*
)
&
glob_ptr
=
reinterpret_cast
<
uint64_t
>
(
src
.
data
().
get
());
uint32x4_t
global_addr
=
{
0
};
global_addr
[
0
]
=
__builtin_amdgcn_readfirstlane
(
glob_ptr
.
former
);
global_addr
[
1
]
=
__builtin_amdgcn_readfirstlane
(
glob_ptr
.
latter
);
global_addr
[
2
]
=
0x80000000
;
global_addr
[
3
]
=
0x00020000
;
constexpr
int
elements_per_thread
=
16
;
constexpr
int
bytes_per_warp
=
warp_size
*
elements_per_thread
*
element_size
;
//64*16*1
int
offset_v
=-
1
;
int
ldsAddrPerWave
=
reinterpret_cast
<
size_t
>
(
dst
.
data
().
get
())
+
(
warp_id
%
4
)
*
bytes_per_warp
+
(
k_idx
)
*
64
*
128
*
element_size
+
(
warp_id
/
4
)
*
64
*
64
;
#if defined(__gfx938__)
asm
volatile
(
"s_mov_b32 m0, %1
\n\t
"
"buffer_load_dwordx4 %0, %2, %3 ,offen offset:0, lds
\n
"
::
"v"
(
offset_v
),
"s"
(
ldsAddrPerWave
),
"s"
(
global_addr
),
"s"
(
offset_s
)
:
);
#endif
}
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
}
// namespace flash
}
// namespace flash
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