dsa: widen the fp8 k-cache quant kernel's token_id to int64 (#30859)
This commit is contained in:
@@ -134,7 +134,7 @@ def _dequantize_k_cache_fast_kernel(
|
|||||||
DIM_NOPE: tl.constexpr,
|
DIM_NOPE: tl.constexpr,
|
||||||
DIM_ROPE: tl.constexpr,
|
DIM_ROPE: tl.constexpr,
|
||||||
):
|
):
|
||||||
token_id = tl.program_id(0)
|
token_id = tl.program_id(0).to(tl.int64)
|
||||||
raw_block_id = tl.program_id(1)
|
raw_block_id = tl.program_id(1)
|
||||||
|
|
||||||
if raw_block_id < NUM_NOPE_BLOCKS:
|
if raw_block_id < NUM_NOPE_BLOCKS:
|
||||||
@@ -249,8 +249,8 @@ def _dequantize_k_cache_paged_kernel(
|
|||||||
DIM_NOPE: tl.constexpr,
|
DIM_NOPE: tl.constexpr,
|
||||||
DIM_ROPE: tl.constexpr,
|
DIM_ROPE: tl.constexpr,
|
||||||
):
|
):
|
||||||
token_id = tl.program_id(0)
|
token_id = tl.program_id(0).to(tl.int64)
|
||||||
token_id_paged = tl.load(page_table_1_ptr + token_id).to(tl.int32)
|
token_id_paged = tl.load(page_table_1_ptr + token_id).to(tl.int64)
|
||||||
raw_block_id = tl.program_id(1)
|
raw_block_id = tl.program_id(1)
|
||||||
|
|
||||||
if raw_block_id < NUM_NOPE_BLOCKS:
|
if raw_block_id < NUM_NOPE_BLOCKS:
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ def _quantize_k_cache_fast_kernel(
|
|||||||
FP8_MIN: tl.constexpr,
|
FP8_MIN: tl.constexpr,
|
||||||
FP8_MAX: tl.constexpr,
|
FP8_MAX: tl.constexpr,
|
||||||
):
|
):
|
||||||
token_id = tl.program_id(0)
|
token_id = tl.program_id(0).to(tl.int64)
|
||||||
raw_block_id = tl.program_id(1)
|
raw_block_id = tl.program_id(1)
|
||||||
|
|
||||||
if raw_block_id < NUM_NOPE_BLOCKS:
|
if raw_block_id < NUM_NOPE_BLOCKS:
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ def _dequantize_k_cache_paged_kernel(
|
|||||||
):
|
):
|
||||||
# One program per token: load page_table[token_id] once and emit all
|
# One program per token: load page_table[token_id] once and emit all
|
||||||
# NUM_SCALE_TILES nope tiles + rope tail via tl.static_range.
|
# NUM_SCALE_TILES nope tiles + rope tail via tl.static_range.
|
||||||
token_id = tl.program_id(0)
|
token_id = tl.program_id(0).to(tl.int64)
|
||||||
loc = tl.load(page_table_ptr + token_id).to(tl.int64)
|
loc = tl.load(page_table_ptr + token_id).to(tl.int64)
|
||||||
page_idx = loc // PAGE_SIZE
|
page_idx = loc // PAGE_SIZE
|
||||||
in_page = loc % PAGE_SIZE
|
in_page = loc % PAGE_SIZE
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ def _quant_k_cache_fused_kernel(
|
|||||||
FP8_MAX: tl.constexpr,
|
FP8_MAX: tl.constexpr,
|
||||||
EPS: tl.constexpr,
|
EPS: tl.constexpr,
|
||||||
):
|
):
|
||||||
token_id = tl.program_id(0)
|
token_id = tl.program_id(0).to(tl.int64)
|
||||||
tile_id = tl.program_id(1)
|
tile_id = tl.program_id(1)
|
||||||
|
|
||||||
if tile_id == NUM_TILES:
|
if tile_id == NUM_TILES:
|
||||||
|
|||||||
Reference in New Issue
Block a user