8000 [Inductor] Skip triton templates for mixedmm on SM70- by malfet · Pull Request #118591 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

[Inductor] Skip triton templates for mixedmm on SM70- #118591

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions torch/_inductor/kernel/mm.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import functools
import logging
from typing import Any, Dict, List
from typing import Any, Dict, List, Optional

import torch
from torch._inductor.virtualized import V
Expand Down Expand Up @@ -259,11 +260,19 @@ def fallback_mixed_mm(mat1, mat2, *, out):
aten_fallback_mixed_mm = ExternKernelChoice(fallback_mixed_mm, None)


@functools.lru_cache(None)
def _is_sm7x_or_older_gpu(index: Optional[int]) -> bool:
props = torch.cuda.get_device_properties(index or 0)
return props.major <= 7


def tuned_mixed_mm(mat1, mat2, mat2_dtype):
m, n, k, layout, mat1, mat2 = mm_args(mat1, mat2, layout=None)
choices = [aten_fallback_mixed_mm.bind((mat1, mat2), layout)]
if mat1.layout.dtype != torch.float32 and not mat2.layout.is_contiguous():
# can't use triton kernel unless one of these is true
if (
mat1.layout.dtype != torch.float32 and not mat2.layout.is_contiguous()
) or _is_sm7x_or_older_gpu(layout.device.index):
# can't use triton kernel unless one of these is true or if running on v100 (numerical issues)
return autotune_select_algorithm("mixed_mm", choices, [mat1, mat2], layout)
if inductor_config.force_mixed_mm:
choices = []
Expand Down
0