Skip to content
Merged
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
51 changes: 46 additions & 5 deletions tensorrt_llm/_torch/custom_ops/cute_dsl_custom_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def __init__(self, alpha: float, output_dtype: torch.dtype):
f"SM version {get_sm_version()} is not supported for {self.__class__.__name__}, it only supports SM 100"
)

# rewrite the hash function because the value of self.alpha doesn't affect the tactic.
def unique_id(self):
return (self.output_dtype, )

Expand Down Expand Up @@ -531,6 +530,17 @@ def __init__(self,
f"SM version {get_sm_version()} is not supported for {self.__class__.__name__}, it only supports SM 100"
)

def unique_id(self):
return (
self.num_experts,
self.top_k,
self.num_local_experts,
self.local_expert_offset,
self.tile_size,
self.output_dtype,
self.scaling_vector_size,
)

def get_valid_tactics(
self,
inputs: List[torch.Tensor],
Expand Down Expand Up @@ -571,7 +581,7 @@ def get_valid_tactics(
return valid_tactics

def get_tuning_config(self) -> TuningConfig:
key = hash(self)
key = self.unique_id()
if key not in self.__class__.tuning_config_cache:
helper = GroupedGemmInputsHelper(self.num_experts, self.top_k,
self.num_local_experts,
Expand Down Expand Up @@ -807,6 +817,17 @@ def __init__(self,
f"SM version {get_sm_version()} is not supported for {self.__class__.__name__}, it only supports SM 100"
)

def unique_id(self):
return (
self.num_experts,
self.top_k,
self.num_local_experts,
self.local_expert_offset,
self.tile_size,
self.output_dtype,
self.scaling_vector_size,
)

def get_valid_tactics(
self,
inputs: List[torch.Tensor],
Expand Down Expand Up @@ -847,7 +868,7 @@ def get_valid_tactics(
return valid_tactics

def get_tuning_config(self) -> TuningConfig:
key = hash(self)
key = self.unique_id()
if key not in self.__class__.tuning_config_cache:
helper = GroupedGemmInputsHelper(self.num_experts, self.top_k,
self.num_local_experts,
Expand Down Expand Up @@ -1124,6 +1145,16 @@ def __init__(self,
f"SM version {get_sm_version()} is not supported for {self.__class__.__name__}, it only supports SM 100"
)

def unique_id(self):
return (
self.num_experts,
self.top_k,
self.num_local_experts,
self.local_expert_offset,
self.tile_size,
self.scaling_vector_size,
)

def get_valid_tactics(
self,
inputs: List[torch.Tensor],
Expand Down Expand Up @@ -1164,7 +1195,7 @@ def get_valid_tactics(
return valid_tactics

def get_tuning_config(self) -> TuningConfig:
key = hash(self)
key = self.unique_id()
if key not in self.__class__.tuning_config_cache:
helper = GroupedGemmInputsHelper(self.num_experts, self.top_k,
self.num_local_experts,
Expand Down Expand Up @@ -1443,6 +1474,16 @@ def __init__(self,
self.output_dtype = output_dtype
self.scaling_vector_size = scaling_vector_size

def unique_id(self):
return (
self.num_experts,
self.top_k,
self.num_local_experts,
self.local_expert_offset,
self.output_dtype,
self.scaling_vector_size,
)

def get_valid_tactics(
self,
inputs: List[torch.Tensor],
Expand All @@ -1452,7 +1493,7 @@ def get_valid_tactics(
return [128]

def get_tuning_config(self) -> TuningConfig:
key = hash(self)
key = self.unique_id()
if key not in self.__class__.tuning_config_cache:
helper = FusedMoEInputsHelper(self.num_experts, self.top_k,
self.num_local_experts,
Expand Down
Loading