project_name string | class_name string | class_modifiers string | class_implements int64 | class_extends int64 | function_name string | function_body string | cyclomatic_complexity int64 | NLOC int64 | num_parameter int64 | num_token int64 | num_variable int64 | start_line int64 | end_line int64 | function_index int64 | function_params string | function_variable string | function_return_type string | function_body_line_type string | function_num_functions int64 | function_num_lines int64 | outgoing_function_count int64 | outgoing_function_names string | incoming_function_count int64 | incoming_function_names string | lexical_representation string |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pytorch_ao | public | public | 0 | 0 | add_choices.postprocessor | def postprocessor(output):return output | 1 | 2 | 1 | 7 | 0 | 1,589 | 1,590 | 1,589 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (add_choices.postprocessor) defined within the public class called public.The function start at line 1589 and ends at 1590. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | add_choices | def add_choices(choices,input_nodes,layout,scale,q_scale,q_zp,k_scale,k_zp,v_scale,v_zp,a_scale,a_zp,o_scale,o_zp,):def preprocessor(input_nodes, layout):return input_nodes, layoutdef postprocessor(output):return outputtemplate = DataProcessorTemplateWrapper(CppInt8SdpaTemplate,preprocessor,postprocessor,input_nodes=in... | 1 | 38 | 14 | 107 | 0 | 1,570 | 1,611 | 1,570 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (add_choices) defined within the public class called public.The function start at line 1570 and ends at 1611. It contains 38 lines of code and it has a cyclomatic complexity of 1. It takes 14 parameters, represented as [1570.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | reshape_attn_mask_to_4d | def reshape_attn_mask_to_4d(self,kernel,attn_mask: ir.Buffer,batchSize,num_head,qSize,kvSize,):# Support mask shapes:# 2d: ({Q_seq_len, 1}x {KV_seq_len, 1})# 4d: ({Batch, 1} x {Num_heads, 1} x {Q_seq_len, 1}x {KV_seq_len, 1})# Guaranteed in check_attn_mask_shapeattn_mask_size_0 = 1attn_mask_size_1 = 1layout = attn_mask... | 4 | 30 | 7 | 121 | 0 | 1,613 | 1,646 | 1,613 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (reshape_attn_mask_to_4d) defined within the public class called public.The function start at line 1613 and ends at 1646. It contains 30 lines of code and it has a cyclomatic complexity of 4. It takes 7 parameters, represented as [1613.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_options | def get_options(self,query: ir.Buffer,key: ir.Buffer,value: ir.Buffer,qSize,kvSize,headSize,batchSize,num_head,num_threads,):q_split_size = 32if qSize >= 768:q_split_size = 256elif qSize >= 192:q_split_size = 128qSplitSize = min(qSize, q_split_size)l2_cache_size = torch._C._cpu._L2_cache_size()attn_size = qSplitSize * ... | 7 | 35 | 10 | 154 | 0 | 1,648 | 1,685 | 1,648 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_options) defined within the public class called public.The function start at line 1648 and ends at 1685. It contains 35 lines of code and it has a cyclomatic complexity of 7. It takes 10 parameters, represented as [1648.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | render | def render(# type: ignore[override,return]self,kernel,template_buffer_node: Optional[ir.CppTemplateBuffer] = None,epilogue_nodes: Optional[List[ir.IRNode]] = None,**kwargs,) -> str:if epilogue_nodes is not None and epilogue_nodes != []:raise NotImplementedError("Unsupported for `epilogue_nodes` in CppInt8SdpaTemplate."... | 6 | 71 | 5 | 417 | 0 | 1,687 | 1,767 | 1,687 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (render) defined within the public class called public.The function start at line 1687 and ends at 1767. It contains 71 lines of code and it has a cyclomatic complexity of 6. It takes 5 parameters, represented as [1687.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | codegen_useful_function | def codegen_useful_function(self, kernel_name: str):return self._template_from_string(USEFUL_FUNCTIONS).render(dict(kernel_name=kernel_name)) | 1 | 4 | 2 | 26 | 0 | 1,769 | 1,772 | 1,769 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (codegen_useful_function) defined within the public class called public.The function start at line 1769 and ends at 1772. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1769.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | codegen_allocate_buffer | def codegen_allocate_buffer(self, buffer_name: str, buffer_dtype, buffer_size):return self._template_from_string(ALLOCATE_BUFFER).render(dict(buffer_name=buffer_name,buffer_dtype=buffer_dtype,buffer_size=buffer_size,)) | 1 | 8 | 4 | 39 | 0 | 1,774 | 1,781 | 1,774 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (codegen_allocate_buffer) defined within the public class called public.The function start at line 1774 and ends at 1781. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [1774.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | expand | def expand(node, sizes: List[Any]):node = wrap_with_tensorbox(node)sizes = parse_expr_with_index_symbols(sizes)return L.expand(node, sizes).data | 1 | 4 | 2 | 35 | 2 | 10 | 13 | 10 | null | ['sizes', 'node'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (expand) defined within the public class called public.The function start at line 10 and ends at 13. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [10.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __call__ | def __call__(self, graph: torch.fx.Graph):_concat_linear_dq8w4_cpu(graph) | 1 | 2 | 2 | 17 | 0 | 14 | 15 | 14 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__call__) defined within the public class called public.The function start at line 14 and ends at 15. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [14.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | uuid | def uuid(self):return get_hash_for_files((__file__,)) | 1 | 2 | 1 | 13 | 0 | 17 | 18 | 17 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (uuid) defined within the public class called public.The function start at line 17 and ends at 18. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _is_valid_concat_linear_da8w4_fusion.check_in_feature_of_wgt | def check_in_feature_of_wgt(wgt):return (wgt.meta.get("val").size(1) * wgt.meta.get("val").size(2) == in_feature_size)# type: ignore[union-attr] | 1 | 4 | 1 | 37 | 0 | 40 | 43 | 40 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_is_valid_concat_linear_da8w4_fusion.check_in_feature_of_wgt) defined within the public class called public.The function start at line 40 and ends at 43. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _is_valid_concat_linear_da8w4_fusion.check_block_k_of_wgt | def check_block_k_of_wgt(wgt):return wgt.meta.get("val").size(2) == block_k | 1 | 2 | 1 | 21 | 0 | 45 | 46 | 45 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_is_valid_concat_linear_da8w4_fusion.check_block_k_of_wgt) defined within the public class called public.The function start at line 45 and ends at 46. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _is_valid_concat_linear_da8w4_fusion.check_bias | def check_bias(b):return (b is not None) if with_bias else (b is None) | 2 | 2 | 1 | 20 | 0 | 48 | 49 | 48 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_is_valid_concat_linear_da8w4_fusion.check_bias) defined within the public class called public.The function start at line 48 and ends at 49. It contains 2 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _is_valid_concat_linear_da8w4_fusion | def _is_valid_concat_linear_da8w4_fusion(computation_nodes):if "CPU" not in torch._C._dispatch_dump("torchao::da8w4_linear_cpu"):# cpp kernels not builtreturn False# OP schema:# da8w4_linear_cpu(Tensor input, Tensor input_scales, Tensor input_qzeros, Tensor weight, Tensor weight_scales, Tensor weight_qzeros, Tensor com... | 15 | 32 | 1 | 276 | 9 | 22 | 65 | 22 | null | ['act_scales', 'with_bias', 'output_dtype', 'computation_op', 'act', 'in_feature_size', 'act_zp', 'block_k', 'wgt'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_is_valid_concat_linear_da8w4_fusion) defined within the public class called public.The function start at line 22 and ends at 65. It contains 32 lines of code and it has a cyclomatic complexity of 15. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _concat_linear_dq8w4_cpu | def _concat_linear_dq8w4_cpu(graph: torch.fx.Graph):"""Concat Linear optimization pass for DA8W4 on CPUThis pass fuses the original pattern:def ...return (da8w4_linear_cpu(x, ..., w1, ...), da8w4_linear_cpu(x, ..., w2, ...), ...)into a single operation:def ...concat_res = da8w4_linear_cpu(x, ..., concat_w, ...)return s... | 20 | 129 | 1 | 833 | 35 | 68 | 216 | 68 | null | ['concat_wgt_qzeros', 'concat_w_node', 'out_feature_size_list', 'concat_w_node_name', 'concat_wgt_scales_node', 'wgt_qzeros', 'bias', 'act', 'users', 'gm', 'concat_wz_node_name', 'act_scales', 'concat_wgt_scales', 'with_bias', 'concat_comp_node_name', 'concat_compensation_node', 'output_dtype', 'computation_op', 'node_... | None | null | 0 | 0 | 0 | null | 0 | null | The function (_concat_linear_dq8w4_cpu) defined within the public class called public.The function start at line 68 and ends at 216. It contains 129 lines of code and it has a cyclomatic complexity of 20. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | register_da8w4_concat_linear_cpu_pass | def register_da8w4_concat_linear_cpu_pass():from torch._inductor import config as inductor_configda8w4_concat_linear_cpu_pass = DA8W4ConcatLinearCPUPass()inductor_config.post_grad_custom_post_pass = da8w4_concat_linear_cpu_pass | 1 | 4 | 0 | 22 | 1 | 222 | 226 | 222 | null | ['da8w4_concat_linear_cpu_pass'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (register_da8w4_concat_linear_cpu_pass) defined within the public class called public.The function start at line 222 and ends at 226. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _is_valid_qsdpa_pattern.fn | def fn(match):assert all(k in match.kwargs for k in ("query", "key", "value"))query = match.kwargs["query"].meta["val"]key = match.kwargs["key"].meta["val"]value = match.kwargs["value"].meta["val"]return (query.dtype in quantize_dtypesand key.dtype in quantize_dtypesand value.dtype in quantize_dtypesand query.device.ty... | 7 | 13 | 1 | 107 | 0 | 35 | 47 | 35 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_is_valid_qsdpa_pattern.fn) defined within the public class called public.The function start at line 35 and ends at 47. It contains 13 lines of code and it has a cyclomatic complexity of 7. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _is_valid_qsdpa_pattern | def _is_valid_qsdpa_pattern():def fn(match):assert all(k in match.kwargs for k in ("query", "key", "value"))query = match.kwargs["query"].meta["val"]key = match.kwargs["key"].meta["val"]value = match.kwargs["value"].meta["val"]return (query.dtype in quantize_dtypesand key.dtype in quantize_dtypesand value.dtype in quan... | 1 | 3 | 0 | 8 | 3 | 34 | 49 | 34 | null | ['value', 'key', 'query'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_is_valid_qsdpa_pattern) defined within the public class called public.The function start at line 34 and ends at 49. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _register_qsdpa_pattern.qsdpa | def qsdpa(match: Match, *args, **kwargs):query = kwargs["query"]key = kwargs["key"]value = kwargs["value"]scale = 1.0 / kwargs["inv_scale"] if "inv_scale" in kwargs else Noneif scale is None:scale = kwargs["scale"] if "scale" in kwargs else Noneattn_mask = kwargs["attn_mask"] if "attn_mask" in kwargs else Noneq_zp = 0k... | 6 | 59 | 3 | 427 | 0 | 56 | 116 | 56 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_qsdpa_pattern.qsdpa) defined within the public class called public.The function start at line 56 and ends at 116. It contains 59 lines of code and it has a cyclomatic complexity of 6. It takes 3 parameters, represented as [56.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _register_qsdpa_pattern | def _register_qsdpa_pattern(pattern, custom_pass_dict):@register_lowering_pattern(pattern, extra_check=_is_valid_qsdpa_pattern(), pass_dict=custom_pass_dict)def qsdpa(match: Match, *args, **kwargs):query = kwargs["query"]key = kwargs["key"]value = kwargs["value"]scale = 1.0 / kwargs["inv_scale"] if "inv_scale" in kwarg... | 1 | 6 | 2 | 26 | 20 | 52 | 118 | 52 | null | ['k_scale', 'q_zp', 'query', 'v_scale', 'trans_key', 'a_zp', 'a_scale', 'scale', 'k_zp', 'o_scale', 'trans_query', 'key', 'trans_value', 'trans_output', 'attn_mask', 'q_scale', 'output', 'o_zp', 'value', 'v_zp'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_qsdpa_pattern) defined within the public class called public.The function start at line 52 and ends at 118. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [52.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _generate_dequant_pattern | def _generate_dequant_pattern(input_pattern, qtype, is_reduced_type, scale: str, zp: str = None):assert qtype is torch.uint8, "QSDPA expects type to be uint8"assert zp is not None, "Zero point must be provided for uint8 dequantization"return CallFunction(torch.ops.quantized_decomposed.dequantize_per_tensor.default,inpu... | 1 | 14 | 5 | 72 | 0 | 121 | 134 | 121 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_generate_dequant_pattern) defined within the public class called public.The function start at line 121 and ends at 134. It contains 14 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [121.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _generate_quant_pattern | def _generate_quant_pattern(input_pattern, qtype, scale: str, zp: str = None):assert qtype is torch.uint8, "QSDPA expects type to be uint8"assert zp is not None, "Zero point must be provided for uint8 quantization"return CallFunction(torch.ops.quantized_decomposed.quantize_per_tensor.default,input_pattern,KeywordArg(sc... | 1 | 12 | 4 | 70 | 0 | 137 | 148 | 137 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_generate_quant_pattern) defined within the public class called public.The function start at line 137 and ends at 148. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [137.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _get_qsdpa_qkv_pattern | def _get_qsdpa_qkv_pattern(qtype,is_batch_size_1: bool,is_reduced_type: bool,has_convert: bool,input_name: str,):assert input_name in ["query", "key", "value"]qsdpa_qkv_pattern_before_dequant = CallFunction(aten.permute.default,KeywordArg(input_name),Arg(),)if input_name == "key":# do transposeqsdpa_qkv_pattern_before_... | 5 | 53 | 5 | 201 | 2 | 151 | 205 | 151 | null | ['qsdpa_qkv_pattern_before_dequant', 'qsdpa_qkv_basic_pattern'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_get_qsdpa_qkv_pattern) defined within the public class called public.The function start at line 151 and ends at 205. It contains 53 lines of code and it has a cyclomatic complexity of 5. It takes 5 parameters, represented as [151.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _get_qsdpa_score_pattern | def _get_qsdpa_score_pattern(qtype,has_mask: bool,is_batch_size_1: bool,is_reduced_type: bool,has_convert: bool,is_inv_scale: bool,):qsdpa_q_pattern = _get_qsdpa_qkv_pattern(qtype, is_batch_size_1, is_reduced_type, has_convert, "query")qsdpa_k_pattern = _get_qsdpa_qkv_pattern(qtype, is_batch_size_1, is_reduced_type, ha... | 5 | 58 | 6 | 211 | 3 | 208 | 265 | 208 | null | ['qsdpa_q_pattern', 'qsdpa_k_pattern', 'qsdpa_score_basic_pattern'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_get_qsdpa_score_pattern) defined within the public class called public.The function start at line 208 and ends at 265. It contains 58 lines of code and it has a cyclomatic complexity of 5. It takes 6 parameters, represented as [208.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _get_qsdpa_exp_pattern | def _get_qsdpa_exp_pattern(qtype,has_mask: bool,is_batch_size_1: bool,is_reduced_type: bool,has_convert: bool,is_inv_scale: bool,):qsdpa_score_pattern = _get_qsdpa_score_pattern(qtype, has_mask, is_batch_size_1, is_reduced_type, has_convert, is_inv_scale)qsdpa_exp_basic_pattern = CallFunction(aten.sub.Tensor,qsdpa_scor... | 3 | 47 | 6 | 161 | 2 | 268 | 314 | 268 | null | ['qsdpa_exp_basic_pattern', 'qsdpa_score_pattern'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_get_qsdpa_exp_pattern) defined within the public class called public.The function start at line 268 and ends at 314. It contains 47 lines of code and it has a cyclomatic complexity of 3. It takes 6 parameters, represented as [268.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _get_qsdpa_attn_pattern | def _get_qsdpa_attn_pattern(qtype,has_mask: bool,is_batch_size_1: bool,is_reduced_type: bool,has_convert: bool,is_inv_scale: bool,):qsdpa_exp_pattern = _get_qsdpa_exp_pattern(qtype, has_mask, is_batch_size_1, is_reduced_type, has_convert, is_inv_scale)qsdpa_div_pattern = CallFunction(aten.div.Tensor,qsdpa_exp_pattern,C... | 8 | 72 | 6 | 258 | 3 | 317 | 388 | 317 | null | ['qsdpa_exp_pattern', 'qsdpa_div_pattern', 'qsdpa_softmax_pattern'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_get_qsdpa_attn_pattern) defined within the public class called public.The function start at line 317 and ends at 388. It contains 72 lines of code and it has a cyclomatic complexity of 8. It takes 6 parameters, represented as [317.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _get_qsdpa_final_pattern | def _get_qsdpa_final_pattern(qtype,has_mask: bool,is_batch_size_1: bool,is_reduced_type: bool,has_convert: bool,is_inv_scale: bool,):qsdpa_v_pattern = _get_qsdpa_qkv_pattern(qtype, is_batch_size_1, is_reduced_type, has_convert, "value")qsdpa_attn_pattern = _get_qsdpa_attn_pattern(qtype, has_mask, is_batch_size_1, is_re... | 2 | 36 | 6 | 132 | 2 | 398 | 433 | 398 | null | ['qsdpa_attn_pattern', 'qsdpa_v_pattern'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_get_qsdpa_final_pattern) defined within the public class called public.The function start at line 398 and ends at 433. It contains 36 lines of code and it has a cyclomatic complexity of 2. It takes 6 parameters, represented as [398.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _register_qsdpa_lowerings | def _register_qsdpa_lowerings(custom_pass_dict):for (qtype,has_mask,is_batch_size_1,is_reduced_type,has_convert,is_inv_scale,) in itertools.product(quantize_dtypes,[True, False],[True, False],[True, False],[True, False],[True, False],):_register_qsdpa_pattern(_get_qsdpa_final_pattern(qtype=qtype,has_mask=has_mask,is_ba... | 2 | 27 | 1 | 92 | 0 | 436 | 462 | 436 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_register_qsdpa_lowerings) defined within the public class called public.The function start at line 436 and ends at 462. It contains 27 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self) -> None:super().__init__() | 1 | 2 | 1 | 14 | 0 | 472 | 473 | 472 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 472 and ends at 473. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __call__ | def __call__(self, g: torch.fx.graph.Graph):self.apply(g) | 1 | 2 | 2 | 21 | 0 | 475 | 476 | 475 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__call__) defined within the public class called public.The function start at line 475 and ends at 476. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [475.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | uuid | def uuid(self) -> bytes:return get_hash_for_files((__file__,)) | 1 | 2 | 1 | 15 | 0 | 478 | 479 | 478 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (uuid) defined within the public class called public.The function start at line 478 and ends at 479. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _qsdpa_init | def _qsdpa_init():if torch_version_at_least("2.7.0"):_register_qsdpa_lowerings(config.post_grad_custom_pre_pass)else:pass | 2 | 5 | 0 | 19 | 0 | 485 | 489 | 485 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_qsdpa_init) defined within the public class called public.The function start at line 485 and ends at 489. It contains 5 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | llama4_moe_filter_fn | def llama4_moe_filter_fn(module, fqn):return isinstance(module, Llama4TextMoe) | 1 | 2 | 2 | 14 | 0 | 25 | 26 | 25 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (llama4_moe_filter_fn) defined within the public class called public.The function start at line 25 and ends at 26. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [25.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | convert_fn | def convert_fn(module):# get datahidden_dim = module.hidden_dimexpert_dim = module.experts.expert_dimnum_experts = module.num_expertstop_k = module.top_kact_fn = module.experts.act_fnshared_expert = module.shared_expertreturn_scores = Truenew_mod = MOEFeedForwardAOQuantizable(hidden_dim,expert_dim,num_experts,top_k,act... | 1 | 26 | 1 | 167 | 11 | 29 | 57 | 29 | null | ['expert_dim', 'act_fn', 'top_k', 'num_experts', 'hidden_dim', 'router', 'return_scores', 'new_mod', 'up_proj', 'w2', 'shared_expert'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (convert_fn) defined within the public class called public.The function start at line 29 and ends at 57. It contains 26 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self,hidden_dim,expert_dim,num_experts,top_k,act_fn=F.silu,shared_expert=None,return_scores=False,empty_init=True,) -> None:super().__init__()self.router = nn.Linear(hidden_dim, num_experts, bias=False)self.experts = ConditionalFeedForwardAOQuantizable(num_experts, hidden_dim, expert_dim, act_fn, empty_ini... | 1 | 20 | 9 | 93 | 0 | 9 | 28 | 9 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 9 and ends at 28. It contains 20 lines of code and it has a cyclomatic complexity of 1. It takes 9 parameters, represented as [9.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(self, x: Tensor) -> Tensor:batch_size = x.shape[0]x = x.view(-1, self.hidden_dim)# x: [T, D]scores = self.router(x)# [T, E]scores = F.softmax(scores, dim=-1)scores, expert_indices = torch.topk(scores, self.top_k, dim=-1)# [T, A], [T, A]scores /= scores.sum(dim=-1, keepdim=True).to(x.dtype)# [T, A]out = self... | 3 | 16 | 2 | 161 | 0 | 30 | 47 | 30 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 30 and ends at 47. It contains 16 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [30.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self, num_experts, hidden_dim, expert_dim, act_fn, empty_init=True):super().__init__()if empty_init:self.w1 = nn.Parameter(torch.empty(num_experts, expert_dim, hidden_dim))# E, I, Dself.w2 = nn.Parameter(torch.empty(num_experts, hidden_dim, expert_dim))# E, D, Iself.w3 = nn.Parameter(torch.empty(num_expert... | 2 | 26 | 6 | 163 | 0 | 51 | 76 | 51 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 51 and ends at 76. It contains 26 lines of code and it has a cyclomatic complexity of 2. It takes 6 parameters, represented as [51.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward.group_tokens_by_expert | def group_tokens_by_expert(ordered_token_indices, cum_tokens_per_expert, expert_list):token_indices_per_expert = [ordered_token_indices[cum_tokens_per_expert[expert] : cum_tokens_per_expert[expert + 1]].to(torch.int64)for expert in expert_list]# [T'(e1)], [T'(e2)] ...return token_indices_per_expert | 2 | 12 | 3 | 40 | 0 | 139 | 150 | 139 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward.group_tokens_by_expert) defined within the public class called public.The function start at line 139 and ends at 150. It contains 12 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [139.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(self,x: Tensor,# T, Dexpert_indices: Tensor,# T, Aexpert_weights: Tensor,# T, Atop_k: int,) -> Tensor:num_tokens, _hidden_dim = x.shapenum_token_activations = num_tokens * top_kif x.shape[0] == 1 and not isinstance(self.w1, FakeExtraDimTensor):# only 1 token (can be done without graph breaks when compiled)o... | 8 | 85 | 5 | 535 | 0 | 78 | 191 | 78 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 78 and ends at 191. It contains 85 lines of code and it has a cyclomatic complexity of 8. It takes 5 parameters, represented as [78.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __new__ | def __new__(cls,tensors: Union[Tuple[torch.Tensor], List[torch.Tensor]],tensor_tail: Optional["FakeExtraDimTensor"] = None,):assert len(tensors) > 0 or tensor_tail is not Nonenum_tensors = len(tensors)if tensor_tail is not None:num_tensors += tensor_tail.num_tensorstest_tensor = tensor_tail.head_tensorelse:test_tensor ... | 4 | 36 | 3 | 195 | 0 | 38 | 74 | 38 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__new__) defined within the public class called public.The function start at line 38 and ends at 74. It contains 36 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [38.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __repr__ | def __repr__(self,):return f"{self.__class__.__name__}(shape={self.shape}, containing {self.num_tensors}: {self.head_tensor})" | 1 | 4 | 1 | 9 | 0 | 76 | 79 | 76 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__repr__) defined within the public class called public.The function start at line 76 and ends at 79. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self,tensors: Union[Tuple[torch.Tensor], List[torch.Tensor]],tensor_tail: Optional["FakeExtraDimTensor"] = None,):tensors = list(tensors)assert len(tensors) > 0 or tensor_tail is not None# count num_tensors and make tensor_listself.num_tensors = len(tensors)if tensor_tail is not None:self.num_tensors += te... | 7 | 25 | 3 | 170 | 0 | 81 | 117 | 81 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 81 and ends at 117. It contains 25 lines of code and it has a cyclomatic complexity of 7. It takes 3 parameters, represented as [81.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _apply_fn_to_data | def _apply_fn_to_data(self, fn):self.head_tensor = fn(self.head_tensor)if self.tensor_tail is not None:self.tensor_tail = self.tensor_tail._apply_fn_to_data(fn)return self.__class__([self.head_tensor], self.tensor_tail) | 2 | 5 | 2 | 52 | 0 | 119 | 123 | 119 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_apply_fn_to_data) defined within the public class called public.The function start at line 119 and ends at 123. It contains 5 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [119.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __tensor_flatten__ | def __tensor_flatten__(self):if self.tensor_tail is None:return ["head_tensor",], [self.num_tensors]else:return ["head_tensor","tensor_tail",], [self.num_tensors] | 2 | 10 | 1 | 38 | 0 | 125 | 134 | 125 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__tensor_flatten__) defined within the public class called public.The function start at line 125 and ends at 134. It contains 10 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __tensor_unflatten__ | def __tensor_unflatten__(cls,tensor_data_dict,tensor_attributes,outer_size,outer_stride,):head_tensor = tensor_data_dict["head_tensor"]tensor_tail = tensor_data_dict.get("tensor_tail", None)return cls([head_tensor], tensor_tail) | 1 | 10 | 5 | 39 | 0 | 137 | 146 | 137 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__tensor_unflatten__) defined within the public class called public.The function start at line 137 and ends at 146. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [137.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __torch_function__ | def __torch_function__(cls, func, types, args, kwargs=None):kwargs = {} if kwargs is None else kwargsif func is torch.nn.functional.linear:x, w, bias = (args[0],args[1],args[2] if len(args) > 2 else None,)assert w.num_tensors == 1, ("FakeExtraDimTensor used in a linear op when it had multiple tensors")return func(x, w.... | 5 | 17 | 5 | 119 | 0 | 149 | 165 | 149 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__torch_function__) defined within the public class called public.The function start at line 149 and ends at 165. It contains 17 lines of code and it has a cyclomatic complexity of 5. It takes 5 parameters, represented as [149.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __torch_dispatch__ | def __torch_dispatch__(cls, func, types, args, kwargs):kwargs = {} if kwargs is None else kwargsif func == aten.slice.Tensor:self, dim, start, end, step = fill_defaults(args, 5, [0, None, None, 1])if dim == 0:return return_and_correct_aliasing(func, args, kwargs, cls(self.tensor_list[start:end:step]))elif func == aten.... | 12 | 38 | 5 | 267 | 0 | 168 | 209 | 168 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__torch_dispatch__) defined within the public class called public.The function start at line 168 and ends at 209. It contains 38 lines of code and it has a cyclomatic complexity of 12. It takes 5 parameters, represented as [168.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _moe_quant_tensor._moe_quant_tensor_base | def _moe_quant_tensor_base(weight, config):base_config_handler = _QUANTIZE_CONFIG_HANDLER[type(config.base_config)]dummy_mod = DummyModule(weight)quant_mod = base_config_handler(dummy_mod, config.base_config)return quant_mod.weight | 1 | 5 | 2 | 38 | 0 | 237 | 241 | 237 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_moe_quant_tensor._moe_quant_tensor_base) defined within the public class called public.The function start at line 237 and ends at 241. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [237.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _moe_quant_tensor._moe_quant_tensor_fake_extra_dim_tensor | def _moe_quant_tensor_fake_extra_dim_tensor(weight, config):base_config_handler = _QUANTIZE_CONFIG_HANDLER[type(config.base_config)]# break 3D tensortensors = [weight[i] for i in range(weight.shape[0])]# put tensors into modules since the handlers target modules not tensorsdummy_modules = [DummyModule(tensor) for tenso... | 4 | 9 | 2 | 87 | 0 | 243 | 255 | 243 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_moe_quant_tensor._moe_quant_tensor_fake_extra_dim_tensor) defined within the public class called public.The function start at line 243 and ends at 255. It contains 9 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [243.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _moe_quant_tensor | def _moe_quant_tensor(weight, config):def _moe_quant_tensor_base(weight, config):base_config_handler = _QUANTIZE_CONFIG_HANDLER[type(config.base_config)]dummy_mod = DummyModule(weight)quant_mod = base_config_handler(dummy_mod, config.base_config)return quant_mod.weightdef _moe_quant_tensor_fake_extra_dim_tensor(weight,... | 5 | 17 | 2 | 81 | 9 | 236 | 271 | 236 | null | ['dummy_mod', 'tensors', 'dummy_modules', 'quant_weight', 'quant_mods', '_moe_quant_tensor_has_printed_error', 'quant_mod', 'use_fake', 'base_config_handler'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_moe_quant_tensor) defined within the public class called public.The function start at line 236 and ends at 271. It contains 17 lines of code and it has a cyclomatic complexity of 5. It takes 2 parameters, represented as [236.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | moe_quant_fn | def moe_quant_fn(module, config: MoEQuantConfig):import warningswarnings.simplefilter("ignore", lineno=84)warnings.simplefilter("ignore", lineno=105)for weight_attr in ["w1", "w2", "w3"]:param = getattr(module, weight_attr)assert param.dim() == 3, (f"when applying moe_quant to {module} expected 3D tensor for {weight_at... | 2 | 18 | 2 | 113 | 2 | 275 | 294 | 275 | null | ['new_param', 'param'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (moe_quant_fn) defined within the public class called public.The function start at line 275 and ends at 294. It contains 18 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [275.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | moe_filter | def moe_filter(module, fqn):return "MOEFeedForwardAOQuantizable" in str(type(module)) | 1 | 2 | 2 | 17 | 0 | 297 | 298 | 297 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (moe_filter) defined within the public class called public.The function start at line 297 and ends at 298. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [297.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | cond_ffn_filter | def cond_ffn_filter(module, fqn):return "ConditionalFeedForwardAOQuantizable" in str(type(module)) | 1 | 2 | 2 | 17 | 0 | 301 | 302 | 301 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (cond_ffn_filter) defined within the public class called public.The function start at line 301 and ends at 302. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [301.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self, scaling_type: MoEScalingType = MoEScalingType.FP8_ROWWISE):super().__init__()self.scaling_type = scaling_type | 1 | 3 | 2 | 25 | 0 | 44 | 46 | 44 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 44 and ends at 46. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [44.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _moe_training_transform | def _moe_training_transform(module: nn.Module,config: MoETrainingConfig,) -> nn.Module:"""Swaps `torch.nn.Parameter` data tensor with a ScaledGroupedMMTensor.Args:module: Module to modify.config: MoETrainingConfig which defines how to perform the MoE training transform.Returns: nn.Module: The modified module with swapp... | 1 | 6 | 2 | 31 | 1 | 50 | 65 | 50 | null | ['out'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_moe_training_transform) defined within the public class called public.The function start at line 50 and ends at 65. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [50.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _swap_params.post_order_traversal | def post_order_traversal(module: nn.Module,cur_fqn: Optional[str] = None,parent_module: Optional[nn.Module] = None,):if cur_fqn is None:cur_fqn = ""for child_module_name, child_module in module.named_children():if cur_fqn == "":new_fqn = child_module_nameelse:new_fqn = f"{cur_fqn}.{child_module_name}"post_order_travers... | 8 | 24 | 3 | 147 | 0 | 104 | 130 | 104 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_swap_params.post_order_traversal) defined within the public class called public.The function start at line 104 and ends at 130. It contains 24 lines of code and it has a cyclomatic complexity of 8. It takes 3 parameters, represented as [104.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _swap_params | def _swap_params(module: nn.Module,*,module_filter_fn: Optional[Callable[[nn.Module, str], bool]] = None,config: Optional[MoETrainingConfig] = None,) -> nn.Module:"""Recurses through the nn.Module, recursively swapping the data tensor ofeach nn.Parameter with a ScaledGroupedMMTensor. Only applies if the modulepassed th... | 6 | 22 | 4 | 149 | 5 | 68 | 133 | 68 | null | ['cur_fqn', 'new_fqn', 'root_module', 'new_param', 'new_data'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_swap_params) defined within the public class called public.The function start at line 68 and ends at 133. It contains 22 lines of code and it has a cyclomatic complexity of 6. It takes 4 parameters, represented as [68.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _scaled_grouped_mm | def _scaled_grouped_mm(A: torch.Tensor,B_t: torch.Tensor,offs: Optional[torch.Tensor] = None,out_dtype: Optional[torch.dtype] = torch.bfloat16,scaling_type: MoEScalingType = MoEScalingType.FP8_ROWWISE,) -> torch.Tensor:"""This function performs dynamic float8 quantization with row-wise scalingon the input tensors A and... | 3 | 25 | 5 | 108 | 1 | 41 | 78 | 41 | null | ['block_size'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_scaled_grouped_mm) defined within the public class called public.The function start at line 41 and ends at 78. It contains 25 lines of code and it has a cyclomatic complexity of 3. It takes 5 parameters, represented as [41.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(ctx,A: torch.Tensor,B_t: torch.Tensor,offs: Optional[torch.Tensor] = None,out_dtype: Optional[torch.dtype] = torch.bfloat16,) -> torch.Tensor:# torchao _scaled_grouped_mm only supports A=2D|3D and B=3D.assert A.ndim == 2 or A.ndim == 3, "A must be 2D or 3D"assert B_t.ndim == 3, "B must be 3D"assert A.size(-... | 6 | 66 | 5 | 385 | 0 | 85 | 178 | 85 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 85 and ends at 178. It contains 66 lines of code and it has a cyclomatic complexity of 6. It takes 5 parameters, represented as [85.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | backward | def backward(ctx, grad_output: torch.Tensor):A, B_t, offs = ctx.saved_tensorsout_dtype = ctx.out_dtype# Convert grad_output to float8, row-major for left operand of grouped GEMM# needed for grad_A: grad_output @ B## grad_output shape: (Mg, N)# grad_output_scale shape: (Mg, 1)grad_output_scales = tensor_to_scale(grad_ou... | 2 | 70 | 2 | 321 | 0 | 181 | 282 | 181 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (backward) defined within the public class called public.The function start at line 181 and ends at 282. It contains 70 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [181.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(ctx,A: torch.Tensor,B_t: torch.Tensor,offs: Optional[torch.Tensor] = None,block_size: int = 32,out_dtype: Optional[torch.dtype] = torch.bfloat16,emulated: bool = False,) -> torch.Tensor:# torchao _scaled_grouped_mm only supports A=2D and B=3D.assert A.ndim == 2, "A must be 2D"assert B_t.ndim == 3, "B must b... | 1 | 43 | 7 | 221 | 0 | 289 | 344 | 289 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 289 and ends at 344. It contains 43 lines of code and it has a cyclomatic complexity of 1. It takes 7 parameters, represented as [289.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | backward | def backward(ctx, grad_out: torch.Tensor):A, B_t, offs, blocked_scales_group_offsets_2d3d = ctx.saved_tensorsblock_size = ctx.block_sizeout_dtype = ctx.out_dtype# grad_out_data shape: (M, N)# grad_out_scale shape: (M, N//block_size)grad_out_scale, grad_out_data = to_mx(grad_out, elem_dtype=torch.float8_e4m3fn, block_si... | 2 | 72 | 2 | 323 | 0 | 347 | 442 | 347 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (backward) defined within the public class called public.The function start at line 347 and ends at 442. It contains 72 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [347.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _to_mxfp8_dim1_3d | def _to_mxfp8_dim1_3d(B: torch.Tensor,block_size: int = 32,scaling_mode: ScaleCalculationMode = ScaleCalculationMode.FLOOR,) -> tuple[torch.Tensor, torch.Tensor]:"""Convert a 3D tensor to MXFP8 format with (block_size, 1) scaling granularity."""E, N, K = B.shapeB_reshaped = B.reshape(E * N, K)B_t_mx = _to_mxfp8_dim1_ke... | 1 | 28 | 3 | 191 | 4 | 445 | 477 | 445 | null | ['B_t_mx', 'B_data', 'B_scales', 'B_reshaped'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_to_mxfp8_dim1_3d) defined within the public class called public.The function start at line 445 and ends at 477. It contains 28 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [445.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _emulated_mxfp8_scaled_grouped_mm_2d_3d | def _emulated_mxfp8_scaled_grouped_mm_2d_3d(A_data: torch.Tensor,A_scale: torch.Tensor,B_data: torch.Tensor,B_scale: torch.Tensor,offs: Optional[torch.Tensor] = None,out_dtype: Optional[torch.dtype] = torch.bfloat16,block_size: int = 32,) -> torch.Tensor:assert A_data.ndim == 2, f"A must be 2D, got {A_data.ndim}"assert... | 1 | 42 | 7 | 342 | 9 | 480 | 550 | 480 | null | ['out', 'A_data', 'B', 'A_scale', 'A', 'B_t', 'B_data', 'B_scale', 'A_orig_shape'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_emulated_mxfp8_scaled_grouped_mm_2d_3d) defined within the public class called public.The function start at line 480 and ends at 550. It contains 42 lines of code and it has a cyclomatic complexity of 1. It takes 7 parameters, represented as [480.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _emulated_mxfp8_scaled_grouped_mm_2d_2d | def _emulated_mxfp8_scaled_grouped_mm_2d_2d(A_data: torch.Tensor,# (M, K)A_scale: torch.Tensor,# (M, K//block_size)B_data: torch.Tensor,# (K, N)B_scale: torch.Tensor,# (K//block_size, N)offs: torch.Tensor,out_dtype: Optional[torch.dtype] = torch.bfloat16,block_size: int = 32,) -> torch.Tensor:assert A_data.ndim == 2, "... | 3 | 56 | 7 | 428 | 12 | 553 | 647 | 553 | null | ['out', 'scales_start_idx', 'group_start_idx', 'A_group_shape', 'B', 'scales', 'B_group_shape', 'group_size', 'A_group', 'A', 'B_group', 'scale_group_size'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_emulated_mxfp8_scaled_grouped_mm_2d_2d) defined within the public class called public.The function start at line 553 and ends at 647. It contains 56 lines of code and it has a cyclomatic complexity of 3. It takes 7 parameters, represented as [553.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | round_up | def round_up(x, y):return ((x + y - 1) // y) * y | 1 | 2 | 2 | 17 | 0 | 650 | 651 | 650 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (round_up) defined within the public class called public.The function start at line 650 and ends at 651. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [650.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __new__ | def __new__(cls,tensor: torch.Tensor,scaling_type: MoEScalingType,):self = torch.Tensor._make_wrapper_subclass(cls,tensor.size(),strides=tensor.stride(),storage_offset=tensor.storage_offset(),memory_format=suggest_memory_format(tensor),dtype=tensor.dtype,layout=tensor.layout,device=tensor.device,pin_memory=tensor.is_pi... | 1 | 19 | 3 | 95 | 0 | 50 | 68 | 50 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__new__) defined within the public class called public.The function start at line 50 and ends at 68. It contains 19 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [50.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self,tensor: torch.Tensor,scaling_type: MoEScalingType,):self._data = tensorself.scaling_type = scaling_type | 1 | 7 | 3 | 26 | 0 | 70 | 76 | 70 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 70 and ends at 76. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [70.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __torch_function__ | def __torch_function__(cls, func, types, args, kwargs={}):# override the grouped mm op to use the differentiable _scaled_grouped_mmif func.__name__ == cls.grouped_mm_func_name:# Use torchao scaled grouped mm with dynamic quant for# "2d x 3d with offsets" case (used for routed experts).# Otherwise, fall back to regular ... | 6 | 24 | 5 | 149 | 0 | 79 | 113 | 79 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__torch_function__) defined within the public class called public.The function start at line 79 and ends at 113. It contains 24 lines of code and it has a cyclomatic complexity of 6. It takes 5 parameters, represented as [79.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __torch_dispatch__.unwrap | def unwrap(t):nonlocal scaling_typeif scaling_type is None:scaling_type = t.scaling_typeelse:assert t.scaling_type == scaling_typereturn t._data | 2 | 7 | 1 | 29 | 0 | 120 | 126 | 120 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__torch_dispatch__.unwrap) defined within the public class called public.The function start at line 120 and ends at 126. It contains 7 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __torch_dispatch__ | def __torch_dispatch__(cls, func, types, args, kwargs={}):# unwrap args/kwargs and extract scaling_typescaling_type = Nonedef unwrap(t):nonlocal scaling_typeif scaling_type is None:scaling_type = t.scaling_typeelse:assert t.scaling_type == scaling_typereturn t._dataargs_unwrapped, kwargs_unwrapped = pytree.tree_map_onl... | 4 | 19 | 5 | 115 | 0 | 116 | 151 | 116 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__torch_dispatch__) defined within the public class called public.The function start at line 116 and ends at 151. It contains 19 lines of code and it has a cyclomatic complexity of 4. It takes 5 parameters, represented as [116.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __repr__ | def __repr__(self):return f"ScaledGroupedMMTensor(data={self._data}, scaling_type={self.scaling_type})" | 1 | 2 | 1 | 8 | 0 | 153 | 154 | 153 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__repr__) defined within the public class called public.The function start at line 153 and ends at 154. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __tensor_flatten__ | def __tensor_flatten__(self):metadata = {"scaling_type": self.scaling_type}return ["_data"], metadata | 1 | 3 | 1 | 20 | 0 | 156 | 158 | 156 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__tensor_flatten__) defined within the public class called public.The function start at line 156 and ends at 158. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __tensor_unflatten__ | def __tensor_unflatten__(inner_tensors, flatten_spec, outer_size, outer_stride):return ScaledGroupedMMTensor(inner_tensors["_data"],flatten_spec["scaling_type"],) | 1 | 5 | 4 | 25 | 0 | 161 | 165 | 161 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__tensor_unflatten__) defined within the public class called public.The function start at line 161 and ends at 165. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [161.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | fsdp_pre_all_gather | def fsdp_pre_all_gather(self,mesh: DeviceMesh,outer_size: torch.Size,outer_stride: tuple[int, ...],module: nn.Module,mp_policy: MixedPrecisionPolicy,):# cast to mixed precision dtype prior to all-gatherall_gather_inputs = (self._data.to(mp_policy.param_dtype),)all_gather_metadata = ()return all_gather_inputs, all_gathe... | 1 | 11 | 6 | 58 | 0 | 168 | 179 | 168 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (fsdp_pre_all_gather) defined within the public class called public.The function start at line 168 and ends at 179. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [168.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | fsdp_post_all_gather | def fsdp_post_all_gather(self,all_gather_outputs: Tuple[torch.Tensor, ...],metadata: Any,param_dtype: torch.dtype,*,out: Optional[torch.Tensor] = None,):(data,) = all_gather_outputs# For training step 1+, out=unsharded param.if out is not None:if isinstance(out, ScaledGroupedMMTensor):out_data = out._dataout.scaling_ty... | 6 | 34 | 5 | 180 | 0 | 181 | 225 | 181 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (fsdp_post_all_gather) defined within the public class called public.The function start at line 181 and ends at 225. It contains 34 lines of code and it has a cyclomatic complexity of 6. It takes 5 parameters, represented as [181.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | torch_to_float8_per_group_colwise | def torch_to_float8_per_group_colwise(A_col_major: torch.Tensor,offs: torch.Tensor,target_dtype: torch.dtype = torch.float8_e4m3fn,round_scales_to_power_of_2: bool = False,) -> Tuple[torch.Tensor, torch.Tensor]:"""This function converts the 2D input tensor A to a jagged float8 tensor,with scales computed along *logical... | 2 | 34 | 4 | 211 | 9 | 12 | 78 | 12 | null | ['next_scale_idx', 'subtensor_scales', 'float8_subtensor', 'A_scales', 'tensor_scaled', 'subtensor', 'A_fp8_col_major', 'start_idx', 'num_groups'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (torch_to_float8_per_group_colwise) defined within the public class called public.The function start at line 12 and ends at 78. It contains 34 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [12.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | torch_to_float8_per_group_rowwise | def torch_to_float8_per_group_rowwise(x: torch.Tensor,offs: torch.Tensor,target_dtype: torch.dtype,round_scales_to_power_of_2: bool = False,) -> Tuple[torch.Tensor, torch.Tensor]:"""This function converts the 2D input tensor to a jagged float8 tensor,with scales computed along *logical rows* for each group individually... | 2 | 32 | 4 | 207 | 9 | 81 | 145 | 81 | null | ['x_fp8', 'next_scale_idx', 'subtensor_scales', 'x_scales', 'float8_subtensor', 'tensor_scaled', 'subtensor', 'start_idx', 'num_groups'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (torch_to_float8_per_group_rowwise) defined within the public class called public.The function start at line 81 and ends at 145. It contains 32 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [81.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | torch_to_3d_rowwise_float8_transpose_rhs | def torch_to_3d_rowwise_float8_transpose_rhs(input_hp_t: torch.Tensor,# (E, K, N)target_dtype: torch.dtype = torch.float8_e4m3fn,round_scales_to_power_of_2: bool = False,) -> Tuple[torch.Tensor, torch.Tensor]:"""This function converts the 3D input tensor to a float8 tensor, with scales computed along logical columnson ... | 1 | 18 | 3 | 121 | 3 | 148 | 181 | 148 | null | ['tensor_scaled', 'scales', 'float8_tensor'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (torch_to_3d_rowwise_float8_transpose_rhs) defined within the public class called public.The function start at line 148 and ends at 181. It contains 18 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [148.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _to_mxfp8_per_group_rowwise | def _to_mxfp8_per_group_rowwise(x: torch.Tensor,offs: torch.Tensor,block_size: int = 32,) -> Tuple[torch.Tensor, torch.Tensor]:"""This is a reference implementation used for testing correctness, it is not performant.This function converts the 2D input tensor a mxpf8 tensor along dim 0 with per-token-group scaling,where... | 3 | 24 | 3 | 178 | 4 | 185 | 230 | 185 | null | ['start_idx', 'x_mx', 'x_scales', 'subtensor'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_to_mxfp8_per_group_rowwise) defined within the public class called public.The function start at line 185 and ends at 230. It contains 24 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [185.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _to_mxfp8_per_group_colwise | def _to_mxfp8_per_group_colwise(A_col_major: torch.Tensor,# (K, N)offs: torch.Tensor,block_size: int = 32,) -> Tuple[torch.Tensor, torch.Tensor]:"""This is a reference implementation used for testing correctness, it is not performant.This function converts the 2D input tensor a mxpf8 tensor along dim 1 with per-token-g... | 3 | 25 | 3 | 212 | 4 | 233 | 279 | 233 | null | ['start_idx', 'A_mx', 'A_scales', 'subtensor'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_to_mxfp8_per_group_colwise) defined within the public class called public.The function start at line 233 and ends at 279. It contains 25 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [233.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _is_column_major | def _is_column_major(x: torch.Tensor) -> bool:"""This function checks if the input tensor is column-major.Args:x (torch.Tensor): The input tensor to be checked.Returns:A boolean indicating whether the input tensor is column-major."""assert x.ndim == 2 or x.ndim == 3, "input tensor must be 2D or 3D"return x.stride(-2) =... | 2 | 3 | 1 | 36 | 0 | 282 | 293 | 282 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_is_column_major) defined within the public class called public.The function start at line 282 and ends at 293. It contains 3 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _is_row_major | def _is_row_major(x: torch.Tensor) -> bool:"""This function checks if the input tensor is row-major.Args:x (torch.Tensor): The input tensor to be checked.Returns:A boolean indicating whether the input tensor is row-major."""assert x.ndim == 2 or x.ndim == 3, "input tensor must be 2D or 3D"return x.stride(-1) == 1 | 2 | 3 | 1 | 36 | 0 | 296 | 307 | 296 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_is_row_major) defined within the public class called public.The function start at line 296 and ends at 307. It contains 3 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | generate_jagged_offs | def generate_jagged_offs(E, M, multiple_of=16, dtype=torch.int32, device="cuda"):"""Utility function for tests and benchmarks.Generates a tensor of length E, containing random values divisible by 16,from 0 to M, in sorted order, and where the final value in the tensor is always M.Args:E (int): The length of the tensor.... | 4 | 10 | 5 | 129 | 2 | 310 | 342 | 310 | null | ['possible_values', 'selected_values'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (generate_jagged_offs) defined within the public class called public.The function start at line 310 and ends at 342. It contains 10 lines of code and it has a cyclomatic complexity of 4. It takes 5 parameters, represented as [310.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | moe_module_filter_fn | def moe_module_filter_fn(mod: nn.Module, cur_fqn: str) -> bool:for target_fqn in target_fqns:if target_fqn in cur_fqn:return Truereturn False | 3 | 5 | 2 | 29 | 0 | 36 | 40 | 36 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (moe_module_filter_fn) defined within the public class called public.The function start at line 36 and ends at 40. It contains 5 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [36.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | triton_fp8_rowwise_3d_transpose_rhs | def triton_fp8_rowwise_3d_transpose_rhs(hp_tensor: torch.Tensor,# (E, K, N)output_dtype: torch.dtype = torch.float8_e4m3fn,round_scales_to_power_of_2: bool = False,) -> Tuple[torch.Tensor, torch.Tensor]:assert hp_tensor.ndim == 3, "input tensor must be 3D"tl_input_dtype = FP8_DTYPE_MAP[hp_tensor.dtype]tl_output_dtype =... | 1 | 60 | 3 | 346 | 7 | 47 | 119 | 47 | null | ['scales_buffer', 'tl_output_dtype', 'output_buffer', 'grid', 'tl_input_dtype', 'fp8_dtype_max', 'fp8_dtype_min'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_fp8_rowwise_3d_transpose_rhs) defined within the public class called public.The function start at line 47 and ends at 119. It contains 60 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [47.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _fake_triton_fp8_rowwise_3d_transpose_rhs | def _fake_triton_fp8_rowwise_3d_transpose_rhs(hp_tensor: torch.Tensor,# (E, K, N)output_dtype: torch.dtype = torch.float8_e4m3fn,round_scales_to_power_of_2: bool = False,) -> Tuple[torch.Tensor, torch.Tensor]:assert hp_tensor.ndim == 3, "input tensor must be 3D"e, k, n = hp_tensor.shapeoutput_buffer = torch.empty((e, n... | 1 | 12 | 3 | 127 | 2 | 123 | 135 | 123 | null | ['scales_buffer', 'output_buffer'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_fake_triton_fp8_rowwise_3d_transpose_rhs) defined within the public class called public.The function start at line 123 and ends at 135. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [123.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _triton_fp8_rowwise_3d_transpose_scales_rhs_kernel | def _triton_fp8_rowwise_3d_transpose_scales_rhs_kernel(input_ptr,stride_input_dim0: tl.int64,stride_input_dim1,stride_input_dim2,scales_ptr,stride_scales_dim0: int,stride_scales_dim1,E: int,N: int,K: int,fp8_dtype_min: tl.constexpr,fp8_dtype_max: tl.constexpr,input_dtype: tl.constexpr,round_scales_to_power_of_2: tl.con... | 2 | 42 | 17 | 325 | 12 | 140 | 201 | 140 | null | ['scales_offs', 'k_block_idx', 'input_mask', 'scales', 'input_data', 'scales_mask', 'k_offs', 'input_offs', 'amaxes', 'n_block_idx', 'n_offs', 'expert_idx'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_triton_fp8_rowwise_3d_transpose_scales_rhs_kernel) defined within the public class called public.The function start at line 140 and ends at 201. It contains 42 lines of code and it has a cyclomatic complexity of 2. It takes 17 parameters, represented as [140.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _triton_fp8_rowwise_3d_transpose_cast_rhs_kernel | def _triton_fp8_rowwise_3d_transpose_cast_rhs_kernel(input_ptr,stride_input_dim0: tl.int64,stride_input_dim1,stride_input_dim2,output_ptr,stride_output_dim0: tl.int64,stride_output_dim1,stride_output_dim2,scales_ptr,stride_scales_dim0: int,stride_scales_dim1,E: int,N: int,K: int,fp8_dtype_min: tl.constexpr,fp8_dtype_ma... | 1 | 50 | 20 | 354 | 14 | 206 | 266 | 206 | null | ['scales_offs', 'k_block_idx', 'input_mask', 'scales', 'output_mask', 'input_data', 'scales_mask', 'output_offs', 'output_data', 'k_offs', 'input_offs', 'n_block_idx', 'n_offs', 'expert_idx'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_triton_fp8_rowwise_3d_transpose_cast_rhs_kernel) defined within the public class called public.The function start at line 206 and ends at 266. It contains 50 lines of code and it has a cyclomatic complexity of 1. It takes 20 parameters, represented as [206.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _triton_fp8_rowwise_3d_transpose_rhs_fused_reduction_kernel | def _triton_fp8_rowwise_3d_transpose_rhs_fused_reduction_kernel(input_ptr,stride_input_dim0: tl.int64,stride_input_dim1,stride_input_dim2,output_ptr,stride_output_dim0: tl.int64,stride_output_dim1,stride_output_dim2,scales_ptr,stride_scales_dim0: int,stride_scales_dim1,E: int,N: int,K: int,fp8_dtype_min: tl.constexpr,f... | 4 | 69 | 22 | 537 | 19 | 290 | 389 | 290 | null | ['scales_offs', 'clamped_maxes', 'block_row_maxes', 'n_offs', 'expert_idx', 'scales', 'input_data', 'row_maxes', 'output_mask', 'output_data', 'k_mask', 'scaled_data', 'k_block_idx', 'input_mask', 'output_offs', 'k_offs', 'input_offs', 'input_data_transposed', 'n_mask'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_triton_fp8_rowwise_3d_transpose_rhs_fused_reduction_kernel) defined within the public class called public.The function start at line 290 and ends at 389. It contains 69 lines of code and it has a cyclomatic complexity of 4. It takes 22 parameters, represented as [290.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | triton_fp8_rowwise_3d_transpose_rhs_fused_reduction | def triton_fp8_rowwise_3d_transpose_rhs_fused_reduction(hp_tensor: torch.Tensor,# (E, K, N)output_dtype: torch.dtype = torch.float8_e4m3fn,round_scales_to_power_of_2: bool = False,) -> Tuple[torch.Tensor, torch.Tensor]:"""Equivalent fused Triton kernel to triton_fp8_rowwise_3d_transpose_rhs that usesreduction to calcul... | 1 | 39 | 3 | 274 | 7 | 395 | 453 | 395 | null | ['scales_buffer', 'tl_output_dtype', 'output_buffer', 'grid', 'tl_input_dtype', 'fp8_dtype_max', 'fp8_dtype_min'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_fp8_rowwise_3d_transpose_rhs_fused_reduction) defined within the public class called public.The function start at line 395 and ends at 453. It contains 39 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [395.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _fake_triton_fp8_rowwise_3d_transpose_rhs_fused_reduction | def _fake_triton_fp8_rowwise_3d_transpose_rhs_fused_reduction(hp_tensor: torch.Tensor,# (E, K, N)output_dtype: torch.dtype = torch.float8_e4m3fn,round_scales_to_power_of_2: bool = False,) -> Tuple[torch.Tensor, torch.Tensor]:assert hp_tensor.ndim == 3, "input tensor must be 3D"e, k, n = hp_tensor.shapeoutput_buffer = t... | 1 | 12 | 3 | 127 | 2 | 457 | 469 | 457 | null | ['scales_buffer', 'output_buffer'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_fake_triton_fp8_rowwise_3d_transpose_rhs_fused_reduction) defined within the public class called public.The function start at line 457 and ends at 469. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [457.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | triton_fp8_per_group_rowwise_scales | def triton_fp8_per_group_rowwise_scales(hp_tensor: torch.Tensor,offsets: torch.Tensor,output_dtype: torch.dtype = torch.float8_e4m3fn,round_scales_to_power_of_2: bool = False,) -> Tuple[torch.Tensor, torch.Tensor]:"""Converts a high precision tensor to a float8 tensor in row-major memory layout,using 'jagged' rowwise s... | 1 | 42 | 4 | 244 | 9 | 54 | 117 | 54 | null | ['scales_buffer', 'tl_output_dtype', 'n_groups', 'output_buffer', 'num_elements', 'grid', 'tl_input_dtype', 'fp8_dtype_max', 'fp8_dtype_min'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_fp8_per_group_rowwise_scales) defined within the public class called public.The function start at line 54 and ends at 117. It contains 42 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [54.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _fake_triton_fp8_per_group_rowwise_scales_kernel | def _fake_triton_fp8_per_group_rowwise_scales_kernel(hp_tensor: torch.Tensor,offsets: torch.Tensor,output_dtype: torch.dtype = torch.float8_e4m3fn,round_scales_to_power_of_2: bool = False,) -> Tuple[torch.Tensor, torch.Tensor]:assert hp_tensor.ndim == 2, "input tensor must be 2D"m, k = hp_tensor.shapen_groups = offsets... | 1 | 15 | 4 | 121 | 3 | 121 | 135 | 121 | null | ['scales', 'output', 'n_groups'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_fake_triton_fp8_per_group_rowwise_scales_kernel) defined within the public class called public.The function start at line 121 and ends at 135. It contains 15 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [121.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _triton_fp8_per_group_rowwise_scales_kernel | def _triton_fp8_per_group_rowwise_scales_kernel(input_ptr,offsets_ptr,out_ptr,scales_ptr,M: int,K: int,stride_input_row: int,stride_input_col: int,stride_output_row: int,stride_output_col: int,num_elements: int,fp8_dtype_min: tl.constexpr,fp8_dtype_max: tl.constexpr,input_dtype: tl.constexpr,output_dtype: tl.constexpr,... | 4 | 74 | 19 | 546 | 16 | 146 | 233 | 146 | null | ['block_row_id', 'scales_offs', 'group_col_end_idx', 'block_col_offs', 'fp8_data', 'scales', 'block_row_offs', 'group_col_start_idx', 'block_mask', 'scaled_data', 'scales_mask', 'out_offs', 'offset_idx', 'amax_buffer', 'data', 'block_offs'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_triton_fp8_per_group_rowwise_scales_kernel) defined within the public class called public.The function start at line 146 and ends at 233. It contains 74 lines of code and it has a cyclomatic complexity of 4. It takes 19 parameters, represented as [146.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | triton_fp8_per_group_colwise_scales | def triton_fp8_per_group_colwise_scales(hp_tensor: torch.Tensor,offsets: torch.Tensor,output_dtype: torch.dtype = torch.float8_e4m3fn,round_scales_to_power_of_2: bool = False,) -> Tuple[torch.Tensor, torch.Tensor]:"""Converts a high precision tensor to a float8 tensor in row-major memory layout,using 'jagged' column-wi... | 1 | 44 | 4 | 255 | 9 | 239 | 305 | 239 | null | ['scales_buffer', 'tl_output_dtype', 'n_groups', 'output_buffer', 'num_elements', 'grid', 'tl_input_dtype', 'fp8_dtype_max', 'fp8_dtype_min'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_fp8_per_group_colwise_scales) defined within the public class called public.The function start at line 239 and ends at 305. It contains 44 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [239.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _fake_triton_fp8_per_group_colwise_scales | def _fake_triton_fp8_per_group_colwise_scales(hp_tensor: torch.Tensor,offsets: torch.Tensor,output_dtype: torch.dtype = torch.float8_e4m3fn,round_scales_to_power_of_2: bool = False,) -> Tuple[torch.Tensor, torch.Tensor]:assert hp_tensor.ndim == 2, "input tensor must be 2D"k, n = hp_tensor.shapen_groups = offsets.numel(... | 1 | 16 | 4 | 126 | 3 | 309 | 325 | 309 | null | ['output_buffer', 'n_groups', 'scales_buffer'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_fake_triton_fp8_per_group_colwise_scales) defined within the public class called public.The function start at line 309 and ends at 325. It contains 16 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [309.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _triton_fp8_per_group_colwise_scales_kernel | def _triton_fp8_per_group_colwise_scales_kernel(input_ptr,offsets_ptr,out_ptr,scales_ptr,K: int,N: int,stride_input_row: int,stride_input_col: int,stride_output_row: int,stride_output_col: int,num_elements: int,fp8_dtype_min: tl.constexpr,fp8_dtype_max: tl.constexpr,input_dtype: tl.constexpr,output_dtype: tl.constexpr,... | 4 | 74 | 19 | 546 | 16 | 334 | 422 | 334 | null | ['scales_offs', 'block_col_offs', 'fp8_data', 'scales', 'block_col_id', 'block_row_offs', 'block_mask', 'scaled_data', 'scales_mask', 'out_offs', 'offset_idx', 'group_row_start_idx', 'amax_buffer', 'group_row_end_idx', 'data', 'block_offs'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_triton_fp8_per_group_colwise_scales_kernel) defined within the public class called public.The function start at line 334 and ends at 422. It contains 74 lines of code and it has a cyclomatic complexity of 4. It takes 19 parameters, represented as [334.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | sync_threads | def sync_threads():tl.inline_asm_elementwise("bar.sync 0;", "=r", [], dtype=tl.int32, is_pure=False, pack=1) | 1 | 4 | 0 | 29 | 0 | 11 | 14 | 11 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (sync_threads) defined within the public class called public.The function start at line 11 and ends at 14. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | send_signal | def send_signal(addrs, sem: tl.constexpr):if sem == "relaxed":tl.inline_asm_elementwise("""{.reg .u32 %tmp32_<1>;.reg .pred%p<1>;send_signal:atom.global.relaxed.sys.cas.b32 %tmp32_0, [$1], 0, 1;setp.eq.u32 %p0, %tmp32_0, 0;@!%p0 bra send_signal;}""","=r, l",[addrs],dtype=tl.int32,is_pure=False,pack=1,)elif sem == "acq_... | 3 | 41 | 2 | 83 | 0 | 18 | 58 | 18 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (send_signal) defined within the public class called public.The function start at line 18 and ends at 58. It contains 41 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [18.0] and does not return any value.. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.