mirror of
https://github.com/deepseek-ai/DeepGEMM.git
synced 2026-11-05 00:47:26 +00:00
[GH-ISSUE #121] find out why wgrad mma will cause illegal memory access in specific shape mnk #71
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/DeepGEMM#71
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @fy1214 on GitHub (Jun 26, 2025).
Original GitHub issue: https://github.com/deepseek-ai/DeepGEMM/issues/121
in shape mnk like [1536, 256, 2048]will case the error when using
deep_gemm.wgrad_gemm_fp8_fp8_fp32_nt(a_fp8, b_fp8, out)RuntimeError: CUDA error: an illegal memory access was encounteredthis is because in fp8_wgrad_gemm_kernel there is a setting
and latter it will be used:
but in gemm.py, the method get_smem_config only set kNumStages share memory size:
in caculator, the memory caculate in python is 173184 and in cuda it is 173200.
after i set smem_barrier = (num_stages + 1)* 8 * 2, the problem goes well.
so i think maybe this is the cause of the error
@fy1214 commented on GitHub (Jun 27, 2025):
still don't know why some shape can work without (num_stages + 1)
@LyricZhao commented on GitHub (Jul 1, 2025):
@zheanxu Could you help fixing this?
@LyricZhao commented on GitHub (Jul 2, 2025):
Thanks and merged!
@fy1214 commented on GitHub (Jul 2, 2025):
but i still wandering why in some shape can work without fix, like (1536, 1024, 2048) didn't trigger this bug
@LyricZhao commented on GitHub (Jul 2, 2025):
The hardware may allocate more shared memory space sometimes (i.e. you can use more bytes than your allocation without illegal memory access; just a guess, undocumented).
@fy1214 commented on GitHub (Jul 2, 2025):
yep,i print the pointer in smem find out in the correct case, it allocate a little memory more than we assign, i guess maybe it's because nvidia gpu will aligned the smem adress so that there will generate more smem than we assign.