[Fix] attn_residual: int64 program ids in the score/combine kernels (int32 overflow at 37,451 tokens) (#43438)
This commit is contained in:
@@ -83,7 +83,7 @@ def _agg_kernel(
|
||||
Taking the global max before exponentiating makes this bit-comparable to
|
||||
the 2-kernel pipeline rather than to the SM100 kernel.
|
||||
"""
|
||||
t = tl.program_id(0)
|
||||
t = tl.program_id(0).to(tl.int64) # t * stride_bm overflows int32
|
||||
offs = tl.arange(0, BLOCK_H)
|
||||
mask = offs < H
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ def _score_kernel(
|
||||
BLOCK_H: tl.constexpr,
|
||||
):
|
||||
"""One CTA per (token, row): scan H, output one scalar score."""
|
||||
pid_t = tl.program_id(0)
|
||||
pid_t = tl.program_id(0).to(tl.int64) # pid_t * stride_bm overflows int32
|
||||
j = tl.program_id(1)
|
||||
if j > NVB:
|
||||
return
|
||||
@@ -174,7 +174,7 @@ def _combine_kernel(
|
||||
Softmax is redundantly computed by each H-chunk CTA (≤16 elements, trivial).
|
||||
This gives full H-parallelism: 7 CTAs for H=7168/1024.
|
||||
"""
|
||||
pid_t = tl.program_id(0)
|
||||
pid_t = tl.program_id(0).to(tl.int64) # pid_t * stride_bm overflows int32
|
||||
pid_h = tl.program_id(1)
|
||||
h0 = pid_h * BLOCK_H
|
||||
|
||||
|
||||
Reference in New Issue
Block a user