[Bugfix][Engram] Fix intermittent Triton 3.8 crash in the lookup kernel (#59639)
Signed-off-by: Djordje Ramic <djoramic@amd.com> Signed-off-by: Andreas Karatzas <andreas.karatzas@protonmail.com> Co-authored-by: Andreas Karatzas <andreas.karatzas@protonmail.com> Co-authored-by: Andreas Karatzas <akaratza@amd.com>
This commit is contained in:
co-authored by
Andreas Karatzas
Andreas Karatzas
parent
7b44aad5db
commit
840c7c2f4b
@@ -605,6 +605,15 @@ def _engram_head_shard_weight_loader(
|
|||||||
param.data.copy_(shard)
|
param.data.copy_(shard)
|
||||||
|
|
||||||
|
|
||||||
|
# Branching on SORTED at runtime intermittently crashes Triton 3.8's
|
||||||
|
# RemoveLayoutConversions.
|
||||||
|
# TODO: Remove the 3.8 check once Triton ships
|
||||||
|
# https://github.com/triton-lang/triton/pull/10706.
|
||||||
|
_SORTED_IS_CONSTEXPR = tl.constexpr(
|
||||||
|
triton.__version__.startswith("3.8") and current_platform.is_rocm()
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@triton.jit(
|
@triton.jit(
|
||||||
do_not_specialize=[
|
do_not_specialize=[
|
||||||
"vocab_start",
|
"vocab_start",
|
||||||
@@ -613,7 +622,7 @@ def _engram_head_shard_weight_loader(
|
|||||||
"ids_stride_t",
|
"ids_stride_t",
|
||||||
"ids_stride_h",
|
"ids_stride_h",
|
||||||
"GRID",
|
"GRID",
|
||||||
"SORTED",
|
*(() if _SORTED_IS_CONSTEXPR else ("SORTED",)),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
def _engram_lookup_kernel(
|
def _engram_lookup_kernel(
|
||||||
@@ -634,7 +643,7 @@ def _engram_lookup_kernel(
|
|||||||
QUANT_BLOCK: tl.constexpr,
|
QUANT_BLOCK: tl.constexpr,
|
||||||
BLOCK_R: tl.constexpr,
|
BLOCK_R: tl.constexpr,
|
||||||
GRID,
|
GRID,
|
||||||
SORTED,
|
SORTED: tl.constexpr if _SORTED_IS_CONSTEXPR else None, # type: ignore[valid-type]
|
||||||
):
|
):
|
||||||
"""Gather fp8 rows, apply their ue8m0 block scales, write bf16.
|
"""Gather fp8 rows, apply their ue8m0 block scales, write bf16.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user