Signed-off-by: Shanshan Shen <87969357+shen-shanshan@users.noreply.github.com>
This commit is contained in:
+5
-27
@@ -175,26 +175,18 @@ def is_aiter_found_and_supported_on_rdna4() -> bool:
|
||||
|
||||
@functools.cache
|
||||
def _load_gemm_tuned_configs(
|
||||
csv_path: str,
|
||||
filters: tuple[tuple[str, object], ...],
|
||||
key_cols: tuple[str, ...] = ("N", "K", "M"),
|
||||
) -> set[tuple[int, ...]]:
|
||||
q_dtype_w: torch.dtype, csv_path: str
|
||||
) -> set[tuple[int, int, int]]:
|
||||
try:
|
||||
df = pd.read_csv(csv_path).drop_duplicates()
|
||||
for col, val in filters:
|
||||
if col not in df.columns:
|
||||
continue
|
||||
if isinstance(val, int):
|
||||
df = df[df[col].astype(int) == val]
|
||||
else:
|
||||
df = df[df[col].astype(str) == str(val)]
|
||||
return set(zip(*(df[c].astype(int) for c in key_cols)))
|
||||
df = df[df["q_dtype_w"] == str(q_dtype_w)]
|
||||
return set(zip(df["N"].astype(int), df["K"].astype(int), df["M"].astype(int)))
|
||||
except Exception:
|
||||
return set()
|
||||
|
||||
|
||||
def _check_kernel_tuned(N: int, K: int, q_dtype_w: torch.dtype, csv_path: str) -> bool:
|
||||
configs = _load_gemm_tuned_configs(csv_path, (("q_dtype_w", q_dtype_w),))
|
||||
configs = _load_gemm_tuned_configs(q_dtype_w, csv_path)
|
||||
l_m = (
|
||||
[1, 2, 4]
|
||||
+ list(range(8, 513, 8))
|
||||
@@ -3329,20 +3321,6 @@ class rocm_aiter_ops:
|
||||
csv_path = aiter_gemm_a8w8_ops.AITER_CONFIGS.AITER_CONFIG_GEMM_A8W8_FILE
|
||||
return _check_kernel_tuned(N, K, q_dtype_w, csv_path)
|
||||
|
||||
@staticmethod
|
||||
def is_blockscale_bpreshuffle_tuned(n: int, k: int) -> bool:
|
||||
"""Whether (N, K) has a tuned aiter blockscale bpreshuffle config."""
|
||||
if not current_platform.is_rocm():
|
||||
return False
|
||||
import aiter.ops.gemm_op_a8w8 as aiter_gemm_a8w8_ops
|
||||
|
||||
csv_path = aiter_gemm_a8w8_ops.AITER_CONFIGS.AITER_CONFIG_GEMM_A8W8_BLOCKSCALE_BPRESHUFFLE_FILE
|
||||
gfx = aiter_gemm_a8w8_ops.get_gfx()
|
||||
cu_num = aiter_gemm_a8w8_ops.get_cu_num()
|
||||
return (n, k) in _load_gemm_tuned_configs(
|
||||
csv_path, (("gfx", gfx), ("cu_num", cu_num)), key_cols=("N", "K")
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def shuffle_weight(
|
||||
tensor: torch.Tensor, layout: tuple[int, int] = (16, 16)
|
||||
|
||||
Reference in New Issue
Block a user