Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion tests/unit_tests/test_minimal_async_ep_kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

import unittest

import pytest
import torch
import triton.language as tl

tl = pytest.importorskip("triton.language")

from torchtitan.distributed.minimal_async_ep.kernels import (
_copy_rows_to_peer_ptrs_kernel,
Expand Down
8 changes: 0 additions & 8 deletions tests/unit_tests/test_tp_kv_heads_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@
from types import SimpleNamespace

try:
import sys
from unittest.mock import MagicMock

# triton is Linux-only; stub it so MoE kernel imports don't crash on Windows
if "triton" not in sys.modules:
sys.modules["triton"] = MagicMock()
sys.modules["triton.language"] = MagicMock()

from torchtitan.config import ParallelismConfig
from torchtitan.models.common import (
ComplexRoPE,
Expand Down
25 changes: 15 additions & 10 deletions torchtitan/distributed/minimal_async_ep/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,21 @@
import torch.distributed as dist
import torch.distributed._symmetric_memory as symm_mem

from torchtitan.distributed.minimal_async_ep.kernels import (
copy_full_counts_to_peers_kernel,
copy_rows_to_peers_kernel,
expand_topk_grad_kernel,
fill_combine_metadata_kernel,
fill_dispatch_metadata_kernel,
invert_flat_indices_kernel,
reduce_topk_slots_kernel,
topk_scores_grad_kernel,
)
try:
from torchtitan.distributed.minimal_async_ep.kernels import (
copy_full_counts_to_peers_kernel,
copy_rows_to_peers_kernel,
expand_topk_grad_kernel,
fill_combine_metadata_kernel,
fill_dispatch_metadata_kernel,
invert_flat_indices_kernel,
reduce_topk_slots_kernel,
topk_scores_grad_kernel,
)
except ImportError:
# No triton: the shared model code imports this module, but the CUDA-only
# kernels are never launched.
pass
from torchtitan.tools.logging import logger


Expand Down
5 changes: 3 additions & 2 deletions torchtitan/overrides/fused_swiglu.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@

import spmd_types as spmd
import torch
import triton
import triton.language as tl

# Without triton, triton_compat's jit stubs raise only when a kernel is launched,
# so this module still imports.
from torch._inductor.runtime.triton_compat import tl, triton
from torch.distributed.tensor import DTensor
from torch.distributed.tensor.experimental import local_map

Expand Down
Loading