Skip to content

Commit d6c89c9

Browse files
committed
put sm version query inside triton function
Signed-off-by: Hao Wu <skyw@nvidia.com>
1 parent ef94309 commit d6c89c9

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

  • emerging_optimizers/triton_kernels

emerging_optimizers/triton_kernels/syrk.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727

2828
__all__ = ["ssyrk", "tsyrk_ex"]
2929

30-
_SM_VERSION = torch.cuda.get_device_capability()
31-
3230

3331
@triton.jit
3432
def cvt_tf32_rn(x: tl.tensor) -> tl.tensor:
@@ -317,8 +315,9 @@ def tsyrk_ex(
317315
Returns:
318316
Output tensor of shape (N, N)
319317
"""
320-
assert _SM_VERSION in ((8, 0), (9, 0), (10, 0), (11, 0)), (
321-
f"Correctness of Triton kernel on SM {_SM_VERSION} can not be guaranteed."
318+
sm_version = torch.cuda.get_device_capability()
319+
assert sm_version in ((8, 0), (9, 0), (10, 0), (11, 0)), (
320+
f"Correctness of Triton kernel on SM {sm_version} can not be guaranteed."
322321
)
323322
assert a.dtype == torch.bfloat16, "Input tensor must be bfloat16"
324323
assert a.dim() == 2, "Input tensor must be 2D"

0 commit comments

Comments
 (0)