Skip to content

[Triton/Gluon] Consolidate and reorganize ops/triton utils - #5023

Closed
Boss2002n wants to merge 2 commits into
mainfrom
satya/cleanup-triton-utils
Closed

Boss2002n wants to merge 2 commits into
mainfrom
satya/cleanup-triton-utils

Conversation

@Boss2002n

Copy link
Copy Markdown
Contributor

Structure
utils/config_utils.py (new) absorbs, in this order:
utils/core.py -> "Shared core" section
utils/gemm_config_utils.py -> "GEMM"
utils/conv_config_utils.py -> "Conv"
utils/mhc_config_utils.py -> "MHC"
utils/tuned_config_utils.py -> "Tuned kernel entries"
All five are deleted. One module means one import line per caller and
one place where the nested-layout probe lives.

resolve_config_dir() now returns just the directory string. The second element of the old tuple was the legacy arch-prefix, which is always empty now that every config family has moved to the nested layout, so every call site was unpacking a constant.

@Boss2002n
Boss2002n requested review from a team and a lite review from Copilot August 26, 2026 11:32
@github-actions github-actions Bot changed the title [Triton] Consolidate and reorganize ops/triton utils [Triton/Gluon] Consolidate and reorganize ops/triton utils Aug 26, 2026

This comment was marked as outdated.

Copilot AI review requested due to automatic review settings August 26, 2026 11:43
@Boss2002n
Boss2002n force-pushed the satya/cleanup-triton-utils branch from 4afdaf0 to 34a91c8 Compare August 26, 2026 11:43

This comment was marked as outdated.

@brunomazzottiamd brunomazzottiamd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Address pending discussions from other PRs:

Why merging all these files into a single file?

  • aiter/ops/triton/utils/conv_config_utils.py
  • aiter/ops/triton/utils/core.py
  • aiter/ops/triton/utils/gemm_config_utils.py
  • aiter/ops/triton/utils/mha_kernel_utils.py
  • aiter/ops/triton/utils/mhc_config_utils.py
  • aiter/ops/triton/utils/tuned_config_utils.py

PS: I still need to check aiter/ops/triton/utils/config_utils.py, everything else looks good.

@zufayu
zufayu requested review from a team and brunomazzottiamd August 27, 2026 01:23
Copilot AI review requested due to automatic review settings August 27, 2026 15:27
@Boss2002n
Boss2002n force-pushed the satya/cleanup-triton-utils branch from 34a91c8 to 3604c09 Compare August 27, 2026 15:27
@Boss2002n Boss2002n closed this Aug 27, 2026

This comment was marked as outdated.

@Boss2002n Boss2002n reopened this Aug 27, 2026
Copilot AI review requested due to automatic review settings August 27, 2026 17:50
@Boss2002n
Boss2002n force-pushed the satya/cleanup-triton-utils branch from 3604c09 to d82baef Compare August 27, 2026 17:50

This comment was marked as outdated.

@ROCm ROCm deleted a comment from github-actions Bot Aug 27, 2026
@ROCm ROCm deleted a comment from github-actions Bot Aug 27, 2026
utils/ reorganized for reuse: ONE config_utils.py absorbs core.py and the
gemm/conv/mhc/tuned config_utils modules, laid out in five clearly-banded
sections (shared core, GEMM, conv, MHC, tuned kernel entries) so each op
family stays visibly separate inside the single import surface. The
duplicate utils/mha_kernel_utils.py is dropped in favor of the byte-equal
utils/_triton copy; every importer tree-wide is updated. gmm_common stays
put under utils/ so tests and benchmarks keep importing a public module.

resolve_config_dir() gets the contract the #4947/#5019 reviews asked for,
hardened: an Args/Returns/Raises/Example docstring; every argument
validated against a whitelist with assertions (op, config_name and the
programmer-written arch= override must match strict identifier patterns,
the driver-derived running arch tolerates vendor formats but must stay
path-safe, backend is checked against ("triton", "gluon")) so a bad value
fails closed instead of resolving an escaped or wrong directory; a single
str return value (the unused name_prefix tuple element is gone, no caller
unpacks a tuple); and fully deterministic behavior -- the directory is
built, never probed, and the legacy escape hatches are deleted, so nothing
silently returns a bogus last candidate: a missing required table fails
loudly in load_config_json() naming the exact nested path, and optional
tables pass required=False.

The MOE dispatch loaders now declare their backend per dispatch path
(a8w4's triton path resolves backend="triton", the gluon paths "gluon";
a4w4 is gluon-only), and gfx1250 gains byte-identical triton seeds copied
from gfx950 (GEMM-AFP4WFP4, moe A8W4, HSTU fwd/bwd) so the one resolution
the caller-declared policy changes -- triton GEMM-AFP4WFP4 on gfx1250 no
longer borrowing gluon tables -- stays launchable until gfx1250 is tuned
natively. Gluon configs are never copied across arches. Conv's section
carries the variant-aware walk from #4869 unchanged (its M-bounds renamed
CONV_STANDARD_M_BOUNDS to coexist with GEMM's).
Copilot AI review requested due to automatic review settings August 27, 2026 21:27
@Boss2002n
Boss2002n force-pushed the satya/cleanup-triton-utils branch from d82baef to 97d6c20 Compare August 27, 2026 21:27

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

ruff

⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import os
from enum import Enum
import torch
import triton
from aiter.ops.triton.conv._prepack import (
get_or_make_weight_pack,
get_or_make_weight_pack_3x3,
get_or_make_winograd_filter_f4x3,
prepack_nchw_to_cblocked,
)
from aiter.ops.triton.conv._utils import (
BLOCK_K,
_alloc_output,
_conv_dims,
_is_1x1_conv,
_is_3x3_conv,
_is_winograd_eligible,
_out_hw,
_prep_bias,
_require_winograd_eligible,
)
from aiter.ops.triton.utils.logger import AiterTritonLogger
from aiter.ops.triton.conv._launch import (
_launch_1x1,
_launch_3x3_cblocked,
_launch_3x3_nchw,
_launch_3x3_nhwc,
_launch_general,
_launch_winograd_f4x3,
_launch_winograd_f4x3_cblocked,
)
from aiter.ops.triton.utils.config_utils import (
conv_config_uses_exact_routes,
format_shape_key,
has_conv_config,
has_exact_conv_config,
)


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

from __future__ import annotations
from typing import Literal
import torch
import triton
from aiter.ops.triton._gluon_kernels.gfx1250.fusions.fused_clamp_act_mul import (
_fused_clamp_silu_mul_kernel as _fused_clamp_silu_mul_gluon_kernel,
)
from aiter.ops.triton._triton_kernels.fusions.fused_clamp_act_mul import (
_fused_clamp_silu_mul_kernel,
)
from aiter.ops.triton.utils._triton.arch_info import get_arch
from aiter.ops.triton.utils.logger import AiterTritonLogger
from aiter.ops.triton.utils.config_utils import (
AITER_TRITON_CONFIGS_PATH,
load_config_json,
)


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import torch
import triton
from aiter.ops.triton._triton_kernels.fusions import (
_mhc_fused_kernel,
_mhc_fused_split_kernel,
_mhc_post_kernel,
_mhc_post_pre_reduce_apply_kernel,
_mhc_post_pre_split_kernel,
_mhc_reduce_apply_kernel,
)
from aiter.ops.triton.utils.logger import AiterTritonLogger
from aiter.ops.triton.utils._triton import arch_info
from aiter.ops.triton.utils.config_utils import (
get_mhc_config,
get_mhc_post_config,
)


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import torch
import triton
from aiter.jit.utils.torch_guard import torch_compile_guard
from aiter.ops.triton.utils.common_utils import deserialize_str, serialize_dict
from aiter.ops.triton.utils.logger import AiterTritonLogger
from aiter.ops.triton._triton_kernels.gemm.basic.gemm_a16w16_atomic import (
_gemm_a16_w16_atomic_kernel,
_get_config,
)
from aiter.ops.triton.utils.config_utils import add_default_gemm_config_params


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import torch
import triton
from aiter.ops.triton._triton_kernels.common.splitk_reduce import (
_gemm_splitk_reduce_kernel,
)
from aiter.ops.triton.utils.logger import AiterTritonLogger
from aiter.ops.triton._triton_kernels.gemm.basic.gemm_a16w8_blockscale import (
_gemm_a16w8_blockscale_kernel,
_gemm_a16w8_blockscale_preshuffle_kernel,
_get_config,
)
from aiter.ops.triton.utils.config_utils import compute_splitk_params


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import torch
import triton
from aiter.ops.triton._triton_kernels.common.splitk_reduce import (
_gemm_splitk_reduce_kernel,
)
from aiter.ops.triton.utils._triton.arch_info import get_arch
from aiter.ops.triton.utils.device_info import get_num_xcds
from aiter.ops.triton.utils.logger import AiterTritonLogger
from aiter.ops.triton.utils.types import (
get_scaled_dot_format_string,
torch_to_triton_dtype,
)
from aiter.ops.triton._triton_kernels.gemm.basic.gemm_a8w8 import (
_gemm_a8w8_kernel,
_get_config,
)
from aiter.ops.triton.utils.config_utils import get_gemm_config


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import math
import os
import torch
import triton
from aiter.ops.triton._triton_kernels.common.splitk_reduce import (
_gemm_splitk_reduce_kernel,
)
from aiter.ops.triton.utils._triton.arch_info import get_arch
from aiter.ops.triton.utils.logger import AiterTritonLogger
from packaging.version import Version
from aiter.ops.triton._triton_kernels.gemm.basic.gemm_a8w8_blockscale import (
_gemm_a8w8_blockscale_kernel as triton_gemm_a8w8_blockscale_kernel,
)
from aiter.ops.triton._triton_kernels.gemm.basic.gemm_a8w8_blockscale import (
_gemm_a8w8_blockscale_preshuffle_kernel as triton_gemm_a8w8_blockscale_preshuffle_kernel,
)
from aiter.ops.triton._triton_kernels.gemm.basic.gemm_a8w8_blockscale import (
_get_config,
)
from aiter.ops.triton.utils.config_utils import compute_splitk_params


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import torch
import triton
from aiter.ops.triton._triton_kernels.common.splitk_reduce import (
_batched_gemm_splitk_reduce_kernel,
)
from aiter.ops.triton.utils._triton.arch_info import get_arch
from aiter.ops.triton.utils.logger import AiterTritonLogger
from aiter.ops.triton._triton_kernels.gemm.batched.batched_gemm_bf16 import (
_batched_gemm_bf16_kernel,
_get_config,
)
from aiter.ops.triton.utils.config_utils import get_gemm_config


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import torch
import triton
from aiter.ops.triton.utils.logger import AiterTritonLogger
from aiter.ops.triton._triton_kernels.gemm.fused.fused_gemm_a8w8_blockscale_mul_add import (
_fused_gemm_a8w8_blockscale_mul_add_kernel,
_fused_gemm_a8w8_blockscale_mul_add_reduce_kernel,
_get_config,
)
from aiter.ops.triton.utils.config_utils import compute_splitk_params


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import os
import torch
import triton
from aiter.ops.triton.gemm.basic.gemm_afp4wfp4 import get_splitk
from aiter.ops.triton.utils.logger import AiterTritonLogger
from aiter.utility.triton.triton_metadata_redirect import AOTMetadataContext
from aiter.ops.triton._triton_kernels.gemm.fused.fused_gemm_afp4wfp4_a16w16 import (
_fused_gemm_afp4wfp4_a16w16_kernel,
_fused_gemm_afp4wfp4_a16w16_reduce_kernel,
_fused_gemm_afp4wfp4_preshuffle_a16w16_kernel,
_get_config,
)
from aiter.ops.triton.utils._triton import arch_info
from aiter.ops.triton.utils.config_utils import AITER_TRITON_CONFIGS_PATH


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import os
import torch
import triton
from aiter.ops.triton.utils.logger import AiterTritonLogger
from aiter.utility.triton.triton_metadata_redirect import AOTMetadataContext
from aiter.ops.triton._triton_kernels.gemm.fused.fused_gemm_afp4wfp4_mul_add import (
_fused_gemm_afp4wfp4_mul_add_kernel,
_fused_gemm_afp4wfp4_mul_add_reduce_kernel,
_fused_gemm_afp4wfp4_preshuffle_mul_add_kernel,
_get_config,
)
from aiter.ops.triton.utils._triton import arch_info
from aiter.ops.triton.utils.config_utils import AITER_TRITON_CONFIGS_PATH


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import torch
import triton
from aiter.ops.triton.utils._triton.pid_preprocessing import pid_grid, remap_xcd
from aiter.ops.triton.utils.logger import AiterTritonLogger
from triton.experimental import gluon
from triton.experimental.gluon import language as gl
from aiter.ops.triton.utils._triton import arch_info
from aiter.ops.triton.utils.config_utils import get_gemm_config


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import functools
import itertools
import torch
import triton
from aiter.ops.triton._gluon_kernels.gfx1250.moe.moe_op_gemm_a4w4 import (
_moe_gemm_a4w4_decode,
_moe_gemm_a4w4_prefill,
get_moe_a4w4_layouts_decode,
get_moe_a4w4_layouts_prefill,
)
from aiter.ops.triton._triton_kernels.moe.moe_op_gemm_a4w4 import (
_moe_gemm_a4w4,
_mxfp4_quant_kernel,
)
from aiter.ops.triton.moe.moe_routing.routing import RoutingData
from aiter.ops.triton.moe.reduce import reduce_grouped
from aiter.ops.triton.utils._triton.arch_info import get_arch
from aiter.ops.triton.utils.config_utils import (
load_config_json,
pick_gemm_num_stages,
resolve_config_dir,
)


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import itertools
import torch
import triton
from aiter.ops.triton._gluon_kernels.gfx1250.moe.moe_op_gemm_a8w4 import (
_moe_gemm_a8w4_decode as _moe_gemm_a8w4_decode_gluon,
)
from aiter.ops.triton._gluon_kernels.gfx1250.moe.moe_op_gemm_a8w4 import (
_moe_gemm_a8w4_decode_persistent as _moe_gemm_a8w4_decode_persistent_gluon,
)
from aiter.ops.triton._gluon_kernels.gfx1250.moe.moe_op_gemm_a8w4 import (
_moe_gemm_a8w4_prefill as _moe_gemm_a8w4_prefill_gluon,
)
from aiter.ops.triton._gluon_kernels.gfx1250.moe.moe_op_gemm_a8w4 import (
get_moe_a8w4_layouts,
)
from aiter.ops.triton._triton_kernels.moe.moe_op_gemm_a8w4 import (
_moe_gemm_a8w4 as _moe_gemm_a8w4_triton,
)
from aiter.ops.triton.moe.moe_routing.routing import RoutingData
from aiter.ops.triton.moe.reduce import reduce_grouped
from aiter.ops.triton.utils._triton.arch_info import get_arch
from aiter.ops.triton.utils.device_info import get_num_sms
from aiter.ops.triton.utils.config_utils import (
load_config_json,
pick_gemm_num_stages,
resolve_config_dir,
)


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import itertools
import torch
import triton
from aiter.ops.triton._triton_kernels.moe.moe_op_gemm_a8w8 import (
_moe_gemm_a8w8,
)
from aiter.ops.triton.moe.moe_routing.routing import RoutingData
from aiter.ops.triton.moe.reduce import reduce_grouped
from aiter.ops.triton.utils._triton.arch_info import get_arch
from aiter.ops.triton.utils.config_utils import pick_gemm_num_stages


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import sys
############################################################
# <import>
import torch
from _utils import (
get_input_shape_and_config_list,
run_profile,
)
from aiter.ops.triton.utils.types import get_fp8_dtypes
from aiter.ops.triton.gemm.basic.gemm_a8w8 import gemm_a8w8
from aiter.ops.triton.utils.config_utils import compute_splitk_params
from op_tests.triton_tests.gemm.basic.test_gemm_a8w8 import (
generate_gemm_a8w8_inputs,
)


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import sys
############################################################
# <import>
import torch
from _utils import (
get_input_shape_and_config_list,
run_profile,
)
from aiter.ops.triton.gemm.basic.gemm_afp8wfp8 import gemm_afp8wfp8_preshuffle
from aiter.ops.triton.utils.types import get_fp8_dtypes
from aiter.ops.triton.utils.config_utils import compute_splitk_params
from op_tests.triton_tests.gemm.basic.test_gemm_afp8wfp8 import (
generate_inputs,
)


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import copy
import functools
import glob
import itertools
import json
import os
import re
import triton
from aiter.ops.triton.utils.logger import AiterTritonLogger
from aiter.ops.triton.utils._triton import arch_info


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

from __future__ import annotations
import argparse
import enum
import logging
import sys
from itertools import product
from typing import Any, ClassVar
import torch
import triton
from aiter.test_common import checkAllclose
from op_tests.op_benchmarks.triton.utils.benchmark_utils import (
get_caller_name_no_ext,
print_vgpr,
)
from op_tests.triton_tests.utils.mhc_ref import (
generate_mhc_inputs,
mhc_e2e_ref,
)
from aiter.ops.triton.fusions.mhc import mhc, mhc_post
from aiter.ops.triton.utils.config_utils import hip_post_dispatch_block


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import aiter.jit.utils.chip_info as _aiter_chip_info
import aiter as _aiter


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import argparse
import csv
import inspect
import tempfile
from itertools import chain
from pathlib import Path
import torch
import triton.profiler as proton
from aiter.ops.triton.moe.moe_op_gemm_a8w8_blockscale import (
moe_gemm_a8w8_blockscale,
)
from aiter.ops.triton.moe.moe_routing.routing import routing
from aiter.ops.triton.utils._triton.arch_info import get_arch
from aiter.ops.triton.gemm.basic.gemm_a16w16 import gemm_a16w16
from aiter.ops.triton.utils.config_utils import (
compute_splitk_params,
get_gemm_config,
)


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import random
import traceback
from collections import namedtuple
from dataclasses import dataclass
import torch
import torch.nn.functional as F
from aiter.ops.triton.conv._utils import (
_is_1x1_conv,
_is_3x3_conv,
_out_hw,
)
from aiter.ops.triton.conv.conv2d import (
_select_3x3_method,
conv2d_nchw,
conv2d_nchw_3x3_direct,
conv2d_nchw_cblocked,
conv2d_nhwc,
conv2d_winograd_f4x3,
conv2d_winograd_f4x3_cblocked,
)
from aiter.ops.triton.utils.config_utils import has_conv_config


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import pytest
import torch
from aiter.ops.triton.utils._triton.arch_info import get_arch
import aiter.ops.triton.conv.conv2d as conv2d_module
from aiter.ops.triton.utils import config_utils
from ._helpers import (
ALL_SUPPORTED_ARCHS,
ORDERED_METHODS,
TestSuite,
run_activations,
run_cross_method,
run_edge_cases,
run_no_bias,
run_random_fuzzing,
)


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import pytest
import torch
from aiter.test_common import checkAllclose
from op_tests.triton_tests.utils.mhc_ref import (
generate_mhc_inputs,
generate_mhc_post_inputs,
get_test_shapes,
is_doubly_stochastic,
mhc_e2e_ref,
mhc_post_torch,
mhc_torch,
)
from aiter.ops.triton.fusions.mhc import mhc, mhc_post, mhc_post_pre
from aiter.ops.triton.utils.config_utils import (
hip_post_dispatch_block as _hip_post_dispatch_block,
)


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

from op_tests.triton_tests.utils.mhc_ref import (
generate_mhc_post_inputs,
mhc_post_torch,
)
from aiter.ops.triton.fusions.mhc import mhc_post


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

from op_tests.triton_tests.utils.mhc_ref import (
generate_mhc_post_inputs,
mhc_post_torch,
)
from aiter.ops.triton.fusions.mhc import mhc_post


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import functools
import importlib
import sys
import pytest
import torch
import torch.nn.functional as F
from aiter.ops.shuffle import shuffle_weight
from aiter.ops.triton.utils.types import get_fp8_dtypes, str_to_torch_dtype
from aiter.ops.triton.gemm.basic.gemm_a8w8 import gemm_a8w8 as triton_gemm_a8w8
from aiter.ops.triton.gemm.basic.gemm_a8w8 import gemm_a8w8_preshuffle
from aiter.ops.triton.utils._triton import arch_info
from aiter.ops.triton.utils.config_utils import (
compute_splitk_params,
get_gemm_config,
)


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import copy
import pytest
import torch
from aiter.ops.shuffle import shuffle_weight
from aiter.ops.triton.gemm.basic.gemm_afp8wfp8 import (
gemm_afp8wfp8,
gemm_afp8wfp8_preshuffle,
)
from aiter.test_common import checkAllclose
from aiter.ops.triton.utils._triton import arch_info
from aiter.ops.triton.utils.config_utils import get_gemm_config


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

from aiter.ops.triton._gluon_kernels.gfx1250.gemm.basic.gemm_mxfp8 import (
cga_bases,
)
from triton._C.libtriton.gluon_ir import make_cga_layout

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 76 out of 76 changed files in this pull request and generated 1 comment.

Suppressed comments (2)

aiter/ops/triton/init.py:145

  • The backward-compatibility map for old flat module names no longer includes the legacy core entry (it previously redirected aiter.ops.triton.core to the utils core module). Any external callers still importing aiter.ops.triton.core will now fail, even though the rest of this file is explicitly meant to preserve those old paths.
    # Utils modules (utils/)
    "common_utils": "utils.common_utils",
    "config_utils": "utils.config_utils",
    "device_info": "utils.device_info",
    "gmm_common": "utils.gmm_common",

aiter/ops/triton/utils/config_utils.py:9

  • This PR deletes utils/core.py, utils/gemm_config_utils.py, utils/conv_config_utils.py, utils/mhc_config_utils.py, and utils/tuned_config_utils.py, but aiter/ops/triton/README.md and .github/instructions/aiter-ops-triton.instructions.md still reference those paths and behaviors (e.g. utils/gemm_config_utils.py::get_gemm_config(..., backend=None, ...), utils/core.py::load_config_json, and the MOE nested-layout resolver status). These docs should be updated in the same PR to avoid directing new callers to removed modules.

Comment on lines +603 to +605
def _mhc_config_dir(dev: str, config_name: str) -> str:
"""``dev``'s nested config directory for the ``config_name`` family."""
return resolve_config_dir("mhc", config_name, backend="triton", arch=dev)
Copilot AI review requested due to automatic review settings August 27, 2026 21:41
Comment on lines 60 to 63
import aiter.jit.utils.chip_info as _aiter_chip_info

import aiter as _aiter
except ImportError: # pragma: no cover

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

Suggested change
import aiter.jit.utils.chip_info as _aiter_chip_info
import aiter as _aiter
except ImportError: # pragma: no cover
import aiter as _aiter
import aiter.jit.utils.chip_info as _aiter_chip_info
except ImportError: # pragma: no cover

Comment on lines 751 to +757
from op_tests.triton_tests.utils.mhc_ref import (
generate_mhc_post_inputs,
mhc_post_torch,
)

from aiter.ops.triton.fusions.mhc import mhc_post

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

Suggested change
from op_tests.triton_tests.utils.mhc_ref import (
generate_mhc_post_inputs,
mhc_post_torch,
)
from aiter.ops.triton.fusions.mhc import mhc_post
from aiter.ops.triton.fusions.mhc import mhc_post
from op_tests.triton_tests.utils.mhc_ref import (
generate_mhc_post_inputs,
mhc_post_torch,
)

Comment on lines 782 to +788
from op_tests.triton_tests.utils.mhc_ref import (
generate_mhc_post_inputs,
mhc_post_torch,
)

from aiter.ops.triton.fusions.mhc import mhc_post

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

Suggested change
from op_tests.triton_tests.utils.mhc_ref import (
generate_mhc_post_inputs,
mhc_post_torch,
)
from aiter.ops.triton.fusions.mhc import mhc_post
from aiter.ops.triton.fusions.mhc import mhc_post
from op_tests.triton_tests.utils.mhc_ref import (
generate_mhc_post_inputs,
mhc_post_torch,
)

Comment on lines 281 to 285
from aiter.ops.triton._gluon_kernels.gfx1250.gemm.basic.gemm_mxfp8 import (
cga_bases,
)
from triton._C.libtriton.gluon_ir import make_cga_layout

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

Suggested change
from aiter.ops.triton._gluon_kernels.gfx1250.gemm.basic.gemm_mxfp8 import (
cga_bases,
)
from triton._C.libtriton.gluon_ir import make_cga_layout
from triton._C.libtriton.gluon_ir import make_cga_layout
from aiter.ops.triton._gluon_kernels.gfx1250.gemm.basic.gemm_mxfp8 import (
cga_bases,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

from __future__ import annotations
import argparse
import enum
import logging
import sys
from itertools import product
from typing import Any, ClassVar
import torch
import triton
from aiter.test_common import checkAllclose
from op_tests.op_benchmarks.triton.utils.benchmark_utils import (
get_caller_name_no_ext,
print_vgpr,
)
from op_tests.triton_tests.utils.mhc_ref import (
generate_mhc_inputs,
mhc_e2e_ref,
)
from aiter.ops.triton.fusions.mhc import mhc, mhc_post
from aiter.ops.triton.utils.config_utils import hip_post_dispatch_block

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import argparse
import csv
import inspect
import tempfile
from itertools import chain
from pathlib import Path
import torch
import triton.profiler as proton
from aiter.ops.triton.moe.moe_op_gemm_a8w8_blockscale import (
moe_gemm_a8w8_blockscale,
)
from aiter.ops.triton.moe.moe_routing.routing import routing
from aiter.ops.triton.utils._triton.arch_info import get_arch
from aiter.ops.triton.gemm.basic.gemm_a16w16 import gemm_a16w16
from aiter.ops.triton.utils.config_utils import (
compute_splitk_params,
get_gemm_config,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import random
import traceback
from collections import namedtuple
from dataclasses import dataclass
import torch
import torch.nn.functional as F
from aiter.ops.triton.conv._utils import (
_is_1x1_conv,
_is_3x3_conv,
_out_hw,
)
from aiter.ops.triton.conv.conv2d import (
_select_3x3_method,
conv2d_nchw,
conv2d_nchw_3x3_direct,
conv2d_nchw_cblocked,
conv2d_nhwc,
conv2d_winograd_f4x3,
conv2d_winograd_f4x3_cblocked,
)
from aiter.ops.triton.utils.config_utils import has_conv_config

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import pytest
import torch
from aiter.ops.triton.utils._triton.arch_info import get_arch
import aiter.ops.triton.conv.conv2d as conv2d_module
from aiter.ops.triton.utils import config_utils
from ._helpers import (
ALL_SUPPORTED_ARCHS,
ORDERED_METHODS,
TestSuite,
run_activations,
run_cross_method,
run_edge_cases,
run_no_bias,
run_random_fuzzing,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import pytest
import torch
from aiter.test_common import checkAllclose
from op_tests.triton_tests.utils.mhc_ref import (
generate_mhc_inputs,
generate_mhc_post_inputs,
get_test_shapes,
is_doubly_stochastic,
mhc_e2e_ref,
mhc_post_torch,
mhc_torch,
)
from aiter.ops.triton.fusions.mhc import mhc, mhc_post, mhc_post_pre
from aiter.ops.triton.utils.config_utils import (
hip_post_dispatch_block as _hip_post_dispatch_block,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import functools
import importlib
import sys
import pytest
import torch
import torch.nn.functional as F
from aiter.ops.shuffle import shuffle_weight
from aiter.ops.triton.utils.types import get_fp8_dtypes, str_to_torch_dtype
from aiter.ops.triton.gemm.basic.gemm_a8w8 import gemm_a8w8 as triton_gemm_a8w8
from aiter.ops.triton.gemm.basic.gemm_a8w8 import gemm_a8w8_preshuffle
from aiter.ops.triton.utils._triton import arch_info
from aiter.ops.triton.utils.config_utils import (
compute_splitk_params,
get_gemm_config,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import copy
import pytest
import torch
from aiter.ops.shuffle import shuffle_weight
from aiter.ops.triton.gemm.basic.gemm_afp8wfp8 import (
gemm_afp8wfp8,
gemm_afp8wfp8_preshuffle,
)
from aiter.test_common import checkAllclose
from aiter.ops.triton.utils._triton import arch_info
from aiter.ops.triton.utils.config_utils import get_gemm_config

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 76 out of 76 changed files in this pull request and generated 1 comment.

Suppressed comments (2)

aiter/ops/triton/utils/config_utils.py:714

  • MHC config selection treats "M_LEQ_" buckets as lower bounds (picks the largest threshold <= M), but the shipped MHC DEFAULT.json uses M_LEQ_* as upper bounds. For example, gfx942 mhc_fused_sinkhorn has M_LEQ_32 and M_LEQ_64; with M=48 this code incorrectly selects M_LEQ_32 instead of M_LEQ_64, changing which kernel tile is used.
    aiter/ops/triton/utils/config_utils.py:9
  • This refactor deletes utils/core.py and consolidates config loading into utils/config_utils.py, but the repo documentation still references the old paths (e.g. .github/instructions/aiter-ops-triton.instructions.md recommends aiter.ops.triton.utils.core.load_config_json). Please update the contributor docs (and aiter/ops/triton/README.md if it mentions the old modules) so new code follows the new import path.

Comment on lines 142 to +143
"common_utils": "utils.common_utils",
"core": "utils.core",
"config_utils": "utils.config_utils",
@brunomazzottiamd

Copy link
Copy Markdown
Contributor

Deprecated in favor of #5061.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants