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 | get_configs_io_bound | def get_configs_io_bound():configs = []for num_stages in [2, 3, 4, 5, 6]:for block_m in [16, 32]:for block_k in [32, 64]:for block_n in [32, 64, 128, 256]:num_warps = 2 if block_n <= 64 else 4configs.append(Config({"BLOCK_M": block_m,"BLOCK_N": block_n,"BLOCK_K": block_k,"SPLIT_K": 1,},num_stages=num_stages,num_warps=n... | 7 | 34 | 0 | 155 | 2 | 41 | 75 | 41 | null | ['configs', 'num_warps'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_configs_io_bound) defined within the public class called public.The function start at line 41 and ends at 75. It contains 34 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 | _kernel | def _kernel(A,B,C,M,N,K,#stride_am,stride_ak,#stride_bk,stride_bn,#stride_cm,stride_cn,#acc_dtype: tl.constexpr,#input_precision: tl.constexpr,#fp8_fast_accum: tl.constexpr,#BLOCK_M: tl.constexpr,BLOCK_N: tl.constexpr,BLOCK_K: tl.constexpr,#GROUP_M: tl.constexpr,SPLIT_K: tl.constexpr,EVEN_K: tl.constexpr,AB_DTYPE: tl.c... | 6 | 70 | 22 | 619 | 23 | 187 | 262 | 187 | null | ['width', 'mask', 'pid_m', 'rm', 'rbn', 'grid_n', 'acc', 'pid_z', 'C', 'B', 'pid', 'a', 'b', 'A', 'pid_n', '_0', 'ram', 'k_remaining', 'rk', 'group_id', 'group_size', 'rn', 'grid_m'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_kernel) defined within the public class called public.The function start at line 187 and ends at 262. It contains 70 lines of code and it has a cyclomatic complexity of 6. It takes 22 parameters, represented as [187.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _call.to_tl_type | def to_tl_type(ty):return getattr(tl, str(ty).split(".")[-1]) | 1 | 2 | 1 | 24 | 0 | 313 | 314 | 313 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_call.to_tl_type) defined within the public class called public.The function start at line 313 and ends at 314. 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(a, b, acc_dtype, input_precision, fp8_fast_accum, output_dtype):device = a.device# handle non-contiguous inputs if necessaryif a.stride(0) > 1 and a.stride(1) > 1:a = a.contiguous()if b.stride(0) > 1 and b.stride(1) > 1:b = b.contiguous()# checks constraintsassert a.shape[1] == b.shape[0], (f"incompatible dim... | 9 | 64 | 6 | 419 | 0 | 271 | 350 | 271 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_call) defined within the public class called public.The function start at line 271 and ends at 350. It contains 64 lines of code and it has a cyclomatic complexity of 9. It takes 6 parameters, represented as [271.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(ctx,a,b,acc_dtype=None,input_precision=None,fp8_fast_accum=True,output_dtype=None,):return _matmul._call(a,b,acc_dtype=acc_dtype,input_precision=input_precision,fp8_fast_accum=fp8_fast_accum,output_dtype=output_dtype,) | 1 | 17 | 7 | 52 | 0 | 353 | 369 | 353 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 353 and ends at 369. It contains 17 lines of code and it has a cyclomatic complexity of 1. It takes 7 parameters, represented as [353.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_clock_rate_in_khz | def get_clock_rate_in_khz():try:return nvsmi(["clocks.max.sm"])[0] * 1e3except FileNotFoundError:import pynvmlpynvml.nvmlInit()handle = pynvml.nvmlDeviceGetHandleByIndex(0)return pynvml.nvmlDeviceGetMaxClockInfo(handle, pynvml.NVML_CLOCK_SM) * 1e3 | 2 | 8 | 0 | 49 | 1 | 31 | 39 | 31 | null | ['handle'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_clock_rate_in_khz) defined within the public class called public.The function start at line 31 and ends at 39. It contains 8 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 | get_tensorcore_tflops | def get_tensorcore_tflops(device, num_ctas, num_warps, dtype):"""return compute throughput in TOPS"""total_warps = num_ctas * min(num_warps, 4)if hasattr(driver, "active"):num_subcores = (driver.active.utils.get_device_properties(device)["multiprocessor_count"]* 4)# on recent GPUselse:num_subcores = (driver.utils.get_d... | 2 | 17 | 4 | 93 | 3 | 42 | 60 | 42 | null | ['tflops', 'num_subcores', 'total_warps'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_tensorcore_tflops) defined within the public class called public.The function start at line 42 and ends at 60. It contains 17 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [42.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_simd_tflops | def get_simd_tflops(device, num_ctas, num_warps, dtype):"""return compute throughput in TOPS"""total_warps = num_ctas * min(num_warps, 4)if hasattr(driver, "active"):num_subcores = (driver.active.utils.get_device_properties(device)["multiprocessor_count"]* 4)# on recent GPUselse:num_subcores = (driver.utils.get_device_... | 2 | 17 | 4 | 93 | 3 | 63 | 81 | 63 | null | ['tflops', 'num_subcores', 'total_warps'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_simd_tflops) defined within the public class called public.The function start at line 63 and ends at 81. It contains 17 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [63.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_tflops | def get_tflops(device, num_ctas, num_warps, dtype):capability = torch.cuda.get_device_capability(device)if capability[0] < 8 and dtype == torch.float32:return get_simd_tflops(device, num_ctas, num_warps, dtype)return get_tensorcore_tflops(device, num_ctas, num_warps, dtype) | 3 | 5 | 4 | 57 | 1 | 84 | 88 | 84 | null | ['capability'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_tflops) defined within the public class called public.The function start at line 84 and ends at 88. It contains 5 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [84.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | estimate_matmul_time | def estimate_matmul_time(# backend, device,num_warps,num_stages,#A,B,C,#M,N,K,#BLOCK_M,BLOCK_N,BLOCK_K,SPLIT_K,#debug=False,**kwargs,#):"""return estimated running time in ms= max(compute, loading) + store"""device = torch.cuda.current_device()dtype = A.dtypedtsize = A.element_size()num_cta_m = cdiv(M, BLOCK_M)num_cta_... | 4 | 68 | 14 | 435 | 29 | 91 | 176 | 91 | null | ['num_cta_n', 'load_b_l2', 'l2_bw', 'load_b_dram', 'load_a_dram', 'active_cta_ratio_bw1', 'num_sm', 'total_dram', 'load_a_l2', 'total_time_ms', 'dtsize', 'device', 'store_bw', 'num_ctas', 'dram_bw', 'tput', 'total_l2', 'total_ops', 'dtype', 'reduce_bw', 'store_c_dram', 'active_cta_ratio', 'active_cta_ratio_bw2', 'store... | None | null | 0 | 0 | 0 | null | 0 | null | The function (estimate_matmul_time) defined within the public class called public.The function start at line 91 and ends at 176. It contains 68 lines of code and it has a cyclomatic complexity of 4. It takes 14 parameters, represented as [91.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | early_config_prune | def early_config_prune(configs, named_args, **kwargs):device = torch.cuda.current_device()capability = torch.cuda.get_device_capability()# BLOCK_M, BLOCK_N, BLOCK_K, SPLIT_K, num_warps, num_stagesdtsize = named_args["A"].element_size()dtype = named_args["A"].dtype# 1. make sure we have enough smempruned_configs = []for... | 13 | 68 | 3 | 442 | 17 | 179 | 261 | 179 | null | ['configs', 'mma_cycles', 'ldgsts_latency', 'configs_map', 'dtsize', 'kw', 'device', 'key', 'mmas', 'pruned_configs', 'nearest', 'capability', 'optimal_num_stages', 'dtype', 'random_config', 'max_shared_memory', 'required_shared_memory'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (early_config_prune) defined within the public class called public.The function start at line 179 and ends at 261. It contains 68 lines of code and it has a cyclomatic complexity of 13. It takes 3 parameters, represented as [179.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self, *args, **kwargs):"""Additional arguments on top of `torch.nn.Linear`'s arguments:* `config`: Float8LinearConfig"""self.config = kwargs.pop("config")self.kernel_algo = kwargs.pop("kernel_algo")self.no_precompute_for_backward = kwargs.pop("no_precompute_for_backward", False)super().__init__(*args, **kw... | 1 | 27 | 3 | 141 | 0 | 39 | 73 | 39 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 39 and ends at 73. It contains 27 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [39.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(self, input: torch.Tensor) -> torch.Tensor:if self.no_precompute_for_backward:output = matmul_with_args_in_hp_no_precompute_for_backward.apply(input,self.weight,self.config,self.linear_mm_config,self.kernel_algo,)else:output = matmul_with_args_in_hp.apply(input,self.weight,self.config,self.linear_mm_config,... | 2 | 18 | 2 | 74 | 0 | 75 | 92 | 75 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 75 and ends at 92. It contains 18 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [75.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | from_float | def from_float(cls,mod,config: Float8LinearConfig,# only default config is supported, non-defaults silently ignoredkernel_algo: KernelAlgorithm = KernelAlgorithm.ATOMIC_MAX,no_precompute_for_backward: bool = False,):"""Create an nn.Linear with fp8 compute from a regular nn.LinearArgs:mod (torch.nn.Linear): nn.Linear to... | 1 | 19 | 5 | 80 | 0 | 95 | 123 | 95 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (from_float) defined within the public class called public.The function start at line 95 and ends at 123. It contains 19 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [95.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(ctx,input_hp: torch.Tensor,weight_hp: torch.Tensor,config: Float8LinearConfig,linear_mm_config: LinearMMConfig,kernel_algo: KernelAlgorithm,):# reshape to be 2D for triton kernelsorig_input_shape = input_hp.shapeinput_hp = input_hp.reshape(-1, input_hp.shape[-1])# output = input @ weight_tinput_fp8_row_majo... | 1 | 32 | 6 | 162 | 0 | 133 | 171 | 133 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 133 and ends at 171. It contains 32 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [133.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | backward | def backward(ctx, grad_output):# grad_output may not be contiguous in cases like:# output.sum().backward() where grad is all 1s, so the (M,N) view of the scalar "1"# results in a non-contiguous tensor with stride (0,0).if not grad_output.is_contiguous():grad_output = grad_output.contiguous()input_fp8_col_major, weight_... | 2 | 28 | 2 | 167 | 0 | 174 | 219 | 174 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (backward) defined within the public class called public.The function start at line 174 and ends at 219. It contains 28 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [174.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(ctx,input_hp: torch.Tensor,weight_hp: torch.Tensor,config: Float8LinearConfig,linear_mm_config: LinearMMConfig,kernel_algo: KernelAlgorithm,):# reshape to be 2D for triton kernelsorig_input_shape = input_hp.shapeinput_hp = input_hp.reshape(-1, input_hp.shape[-1])# output = input @ weight_tinput_fp8_row_majo... | 1 | 32 | 6 | 160 | 0 | 228 | 267 | 228 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 228 and ends at 267. It contains 32 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [228.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | backward | def backward(ctx, grad_output):# grad_output may not be contiguous in cases like:# output.sum().backward() where grad is all 1s, so the (M,N) view of the scalar "1"# results in a non-contiguous tensor with stride (0,0).if not grad_output.is_contiguous():grad_output = grad_output.contiguous()input_hp, weight_hp = ctx.sa... | 2 | 35 | 2 | 196 | 0 | 270 | 322 | 270 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (backward) defined within the public class called public.The function start at line 270 and ends at 322. It contains 35 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [270.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_matmul_with_args_in_hp | def test_matmul_with_args_in_hp(input_shape: tuple[int, int]):assert torch.cuda.is_available()device = "cuda"# high precision inputsinput_bf16 = torch.randn(input_shape, dtype=torch.bfloat16, device=device, requires_grad=True)prod_input_bf16 = input_bf16.clone().detach().to(device).requires_grad_(True)prototype_input_b... | 1 | 57 | 1 | 345 | 12 | 25 | 102 | 25 | null | ['config', 'out_prod', 'emulate', 'weight_bf16', 'device', 'out_prototype', 'input_bf16', 'prod_weight_bf16', 'linear_mm_config', 'prod_input_bf16', 'prototype_weight_bf16', 'prototype_input_bf16'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_matmul_with_args_in_hp) defined within the public class called public.The function start at line 25 and ends at 102. It contains 57 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 | convert_to_float8_nocompile_training | def convert_to_float8_nocompile_training(module: nn.Module,*,config: Float8LinearConfig = None,module_filter_fn: Optional[Callable[[nn.Module, str], bool]] = None,kernel_algo: KernelAlgorithm = KernelAlgorithm.ATOMIC_MAX,no_precompute_for_backward: bool = False,) -> nn.Module:"""Swaps `torch.nn.Linear` in `module` with... | 2 | 21 | 6 | 103 | 2 | 24 | 58 | 24 | null | ['config', 'from_float'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (convert_to_float8_nocompile_training) defined within the public class called public.The function start at line 24 and ends at 58. It contains 21 lines of code and it has a cyclomatic complexity of 2. It takes 6 parameters, represented as [24.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(ctx,tensor: torch.Tensor,float8_dtype: torch.dtype,linear_mm_config: LinearMMConfig,gemm_input_role: GemmInputRole,kernel_algo: KernelAlgorithm = KernelAlgorithm.ATOMIC_MAX,):fp8_row_major, fp8_col_major = hp_to_fp8_row_and_col_major(tensor,float8_dtype,linear_mm_config,gemm_input_role,algo=kernel_algo,)ret... | 1 | 16 | 6 | 57 | 0 | 33 | 48 | 33 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 33 and ends at 48. It contains 16 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [33.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | backward | def backward(ctx, g):return g, None, None, None, None | 1 | 2 | 2 | 17 | 0 | 51 | 52 | 51 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (backward) defined within the public class called public.The function start at line 51 and ends at 52. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [51.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(ctx,tensor: torch.Tensor,float8_dtype: torch.dtype,linear_mm_config: LinearMMConfig,gemm_input_role: GemmInputRole,kernel_algo: KernelAlgorithm = KernelAlgorithm.ATOMIC_MAX,):fp8_row_major = hp_to_fp8_row_major(tensor,float8_dtype,linear_mm_config,gemm_input_role,algo=kernel_algo,)return fp8_row_major | 1 | 16 | 6 | 53 | 0 | 63 | 78 | 63 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 63 and ends at 78. It contains 16 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [63.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | backward | def backward(ctx, g):return g, None, None, None, None | 1 | 2 | 2 | 17 | 0 | 81 | 82 | 51 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (backward) defined within the public class called public.The function start at line 81 and ends at 82. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [51.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(ctx,tensor: torch.Tensor,float8_dtype: torch.dtype,linear_mm_config: LinearMMConfig,gemm_input_role: GemmInputRole,kernel_algo: KernelAlgorithm = KernelAlgorithm.ATOMIC_MAX,):fp8_row_major = hp_to_fp8_row_major(tensor,float8_dtype,linear_mm_config,gemm_input_role,algo=kernel_algo,)return fp8_row_major | 1 | 16 | 6 | 53 | 0 | 93 | 108 | 63 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 93 and ends at 108. It contains 16 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [63.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | backward | def backward(ctx, g):return g, None, None, None, None | 1 | 2 | 2 | 17 | 0 | 111 | 112 | 51 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (backward) defined within the public class called public.The function start at line 111 and ends at 112. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [51.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(ctx,tensor: torch.Tensor,float8_dtype: torch.dtype,linear_mm_config: LinearMMConfig,gemm_input_role: GemmInputRole,kernel_algo: KernelAlgorithm = KernelAlgorithm.ATOMIC_MAX,):fp8_row_major = hp_to_fp8_row_major(tensor,float8_dtype,linear_mm_config,gemm_input_role,algo=kernel_algo,)return fp8_row_major | 1 | 16 | 6 | 53 | 0 | 123 | 138 | 63 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 123 and ends at 138. It contains 16 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [63.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | backward | def backward(ctx, g):return g, None, None, None, None | 1 | 2 | 2 | 17 | 0 | 141 | 142 | 51 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (backward) defined within the public class called public.The function start at line 141 and ends at 142. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [51.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(ctx,tensor: torch.Tensor,float8_dtype: torch.dtype,linear_mm_config: LinearMMConfig,gemm_input_role: GemmInputRole,kernel_algo: KernelAlgorithm = KernelAlgorithm.ATOMIC_MAX,):fp8_row_major = hp_to_fp8_row_major(tensor,float8_dtype,linear_mm_config,gemm_input_role,algo=kernel_algo,)return fp8_row_major | 1 | 16 | 6 | 53 | 0 | 153 | 168 | 63 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 153 and ends at 168. It contains 16 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [63.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | backward | def backward(ctx, g):return g, None, None, None, None | 1 | 2 | 2 | 17 | 0 | 171 | 172 | 51 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (backward) defined within the public class called public.The function start at line 171 and ends at 172. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [51.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(ctx,tensor: torch.Tensor,float8_dtype: torch.dtype,linear_mm_config: LinearMMConfig,gemm_input_role: GemmInputRole,kernel_algo: KernelAlgorithm = KernelAlgorithm.ATOMIC_MAX,):fp8_row_major, fp8_col_major = hp_to_fp8_row_and_col_major(tensor,float8_dtype,linear_mm_config,gemm_input_role,algo=kernel_algo,)ret... | 1 | 16 | 6 | 57 | 0 | 183 | 198 | 33 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 183 and ends at 198. It contains 16 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [33.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | backward | def backward(ctx, g):return g, None, None, None, None | 1 | 2 | 2 | 17 | 0 | 201 | 202 | 51 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (backward) defined within the public class called public.The function start at line 201 and ends at 202. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [51.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self, layer_sizes=[32, 64, 32]):super().__init__()self.layers = nn.Sequential(*[nn.Linear(layer_sizes[i], layer_sizes[i + 1], bias=False)for i in range(len(layer_sizes) - 1)]) | 2 | 8 | 2 | 66 | 0 | 55 | 62 | 55 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 55 and ends at 62. It contains 8 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [55.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(self, x: torch.Tensor) -> torch.Tensor:return self.layers(x) | 1 | 2 | 2 | 22 | 0 | 64 | 65 | 64 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 64 and ends at 65. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [64.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_configs | def get_configs() -> List[ExperimentConfig]:algos = [KernelAlgorithm.ATOMIC_MAX, KernelAlgorithm.REDUCTION]layer_sizes = [[4096, 4096]]input_shapes = [(2**4, 4096), (2**8, 4096), (2**12, 4096), (2**16, 4096)]high_precision_dtypes = [torch.bfloat16]configs = []for algo, layer_size, input_shape, high_precision_dtype in i... | 2 | 18 | 0 | 123 | 5 | 68 | 85 | 68 | null | ['configs', 'layer_sizes', 'input_shapes', 'high_precision_dtypes', 'algos'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_configs) defined within the public class called public.The function start at line 68 and ends at 85. It contains 18 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 | forward_backward | def forward_backward(model, input_tensor):output = model(input_tensor)loss = F.mse_loss(output, torch.zeros_like(output))loss.backward() | 1 | 4 | 2 | 33 | 2 | 88 | 91 | 88 | null | ['output', 'loss'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward_backward) defined within the public class called public.The function start at line 88 and ends at 91. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [88.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | run_experiment | def run_experiment(config: ExperimentConfig) -> ExperimentResult:# eager float8 baselineeager_float8_model = convert_to_float8_training(TestModel(config.layer_sizes).to(device))# compiled float8 baselinecompiled_float8_model = torch.compile(eager_float8_model, fullgraph=True)# float8nocompile triton implementationfloat... | 1 | 37 | 1 | 182 | 10 | 94 | 142 | 94 | null | ['input_compiled', 'float8nocompile_model', 'eager_time', 'compiled_time', 'input_tensor', 'float8nocompile_time', 'compiled_float8_model', 'input_triton', 'input_eager', 'eager_float8_model'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment) defined within the public class called public.The function start at line 94 and ends at 142. It contains 37 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 | print_results | def print_results(experiments: List[Experiment]):headers = ["input_shape","kernel_algo","high_precision_dtype","eager_time","compiled_time","float8nocompile",]rows = []for experiment in experiments:input_shape = (f"({experiment.config.input_shape[0]}, {experiment.config.input_shape[1]})")rows.append([input_shape,str(ex... | 2 | 25 | 1 | 94 | 3 | 145 | 169 | 145 | null | ['rows', 'headers', 'input_shape'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (print_results) defined within the public class called public.The function start at line 145 and ends at 169. It contains 25 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 | benchmark_cuda_function_in_microseconds | def benchmark_cuda_function_in_microseconds(func: Callable, *args, **kwargs) -> float:"""Thin wrapper around do_bench_using_profiling"""no_args = lambda: func(*args, **kwargs)time = do_bench_using_profiling(no_args)return time * 1e3 | 1 | 4 | 3 | 38 | 2 | 172 | 176 | 172 | null | ['no_args', 'time'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (benchmark_cuda_function_in_microseconds) defined within the public class called public.The function start at line 172 and ends at 176. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [172.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | main | def main():torch.random.manual_seed(123)configs = get_configs()results = []for config in tqdm(configs):result = run_experiment(config)results.append(Experiment(config=config, result=result))# Use Tabulate to print resultsprint_results(results) | 2 | 8 | 0 | 54 | 3 | 179 | 188 | 179 | null | ['results', 'configs', 'result'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (main) defined within the public class called public.The function start at line 179 and ends at 188. It contains 8 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 | _to_fp8_row_major | def _to_fp8_row_major(input_ptr,out_ptr,scale_ptr,num_elements: int,fp8_dtype_min: float,fp8_dtype_max: float,input_dtype: tl.constexpr,output_dtype: tl.constexpr,BLOCK_SIZE: tl.constexpr,EPS: tl.constexpr,):block_id = tl.program_id(axis=0)# load scaling factorscale = tl.load(scale_ptr).to(tl.float32)# load block of in... | 1 | 21 | 10 | 152 | 7 | 67 | 93 | 67 | null | ['fp8_vals', 'vals', 'scale', 'mask', 'block_id', 'block_start', 'block_offs'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_to_fp8_row_major) defined within the public class called public.The function start at line 67 and ends at 93. It contains 21 lines of code and it has a cyclomatic complexity of 1. It takes 10 parameters, represented as [67.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _to_fp8_row_major_t | def _to_fp8_row_major_t(input_ptr,out_ptr,scale_ptr,num_elements: int,fp8_dtype_min: float,fp8_dtype_max: float,input_num_rows: int,input_num_cols: int,output_num_rows: int,output_num_cols: int,input_stride_row: int,input_stride_col: int,output_stride_row: int,output_stride_col: int,input_dtype: tl.constexpr,output_dty... | 1 | 46 | 19 | 307 | 13 | 101 | 154 | 101 | null | ['block_row_id', 'block_col_start', 'block_col_offs', 'fp8_vals', 'vals', 'input_mask', 'block_col_id', 'block_row_start', 'block_row_offs', 'scale', 'out_mask', 'out_offs', 'input_offs'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_to_fp8_row_major_t) defined within the public class called public.The function start at line 101 and ends at 154. It contains 46 lines of code and it has a cyclomatic complexity of 1. It takes 19 parameters, represented as [101.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _to_fp8_col_major | def _to_fp8_col_major(input_ptr,out_ptr,scale_ptr,num_elements: int,fp8_dtype_min: float,fp8_dtype_max: float,num_rows: int,num_cols: int,out_stride_row: int,out_stride_col: int,input_dtype: tl.constexpr,output_dtype: tl.constexpr,BLOCK_SIZE_ROWS: tl.constexpr,BLOCK_SIZE_COLS: tl.constexpr,EPS: tl.constexpr,):block_row... | 1 | 31 | 15 | 253 | 12 | 162 | 198 | 162 | null | ['block_row_id', 'block_col_start', 'block_col_offs', 'fp8_vals', 'vals', 'block_col_id', 'block_row_start', 'block_row_offs', 'scale', 'mask', 'out_offs', 'block_offs'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_to_fp8_col_major) defined within the public class called public.The function start at line 162 and ends at 198. It contains 31 lines of code and it has a cyclomatic complexity of 1. It takes 15 parameters, represented as [162.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | to_fp8_col_major_t | def to_fp8_col_major_t(input_ptr,out_ptr,scale_ptr,num_elements: int,fp8_dtype_min: float,fp8_dtype_max: float,input_num_rows: int,input_num_cols: int,output_num_rows: int,output_num_cols: int,input_stride_row: int,input_stride_col: int,output_stride_row: int,output_stride_col: int,input_dtype: tl.constexpr,output_dtyp... | 1 | 47 | 19 | 310 | 13 | 206 | 260 | 206 | null | ['block_row_id', 'block_col_start', 'block_col_offs', 'fp8_vals', 'vals', 'input_mask', 'block_col_id', 'block_row_start', 'block_row_offs', 'scale', 'out_mask', 'out_offs', 'input_offs'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (to_fp8_col_major_t) defined within the public class called public.The function start at line 206 and ends at 260. It contains 47 lines of code and it has a cyclomatic complexity of 1. It takes 19 parameters, represented as [206.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _to_fp8_row_and_col_major | def _to_fp8_row_and_col_major(input_ptr,row_major_out_ptr,col_major_out_ptr,scale_ptr,num_elements: int,fp8_dtype_min: float,fp8_dtype_max: float,num_rows: int,num_cols: int,input_dtype: tl.constexpr,output_dtype: tl.constexpr,BLOCK_SIZE_ROWS: tl.constexpr,BLOCK_SIZE_COLS: tl.constexpr,EPS: tl.constexpr,):block_row_id ... | 1 | 32 | 14 | 278 | 13 | 268 | 309 | 268 | null | ['block_row_id', 'block_col_start', 'block_col_offs', 'fp8_vals', 'vals', 'row_major_offs', 'block_col_id', 'block_row_start', 'block_row_offs', 'scale', 'mask', 'col_major_offs', 'block_offs'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_to_fp8_row_and_col_major) defined within the public class called public.The function start at line 268 and ends at 309. It contains 32 lines of code and it has a cyclomatic complexity of 1. It takes 14 parameters, represented as [268.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _to_fp8_row_major_t_and_non_t | def _to_fp8_row_major_t_and_non_t(input_ptr,row_major_out_ptr,row_major_t_out_ptr,scale_ptr,num_elements: int,fp8_dtype_min: float,fp8_dtype_max: float,input_num_rows: int,input_num_cols: int,input_stride_row: int,input_stride_col: int,row_major_out_stride_row: int,row_major_out_stride_col: int,row_major_t_out_stride_r... | 1 | 54 | 20 | 351 | 15 | 317 | 385 | 317 | null | ['block_row_id', 'row_major_t_num_rows', 'block_col_start', 'block_col_offs', 'fp8_vals', 'vals', 'row_major_offs', 'block_col_id', 'block_row_start', 'block_row_offs', 'scale', 'mask', 'row_major_t_num_cols', 'input_offs', 'row_major_t_offs'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_to_fp8_row_major_t_and_non_t) defined within the public class called public.The function start at line 317 and ends at 385. It contains 54 lines of code and it has a cyclomatic complexity of 1. It takes 20 parameters, represented as [317.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _to_fp8_col_major_t_and_non_t | def _to_fp8_col_major_t_and_non_t(input_ptr,col_major_out_ptr,col_major_t_out_ptr,scale_ptr,num_elements: int,fp8_dtype_min: float,fp8_dtype_max: float,input_num_rows: int,input_num_cols: int,input_stride_row: int,input_stride_col: int,col_major_out_stride_row: int,col_major_out_stride_col: int,col_major_t_out_stride_r... | 1 | 51 | 20 | 347 | 15 | 390 | 456 | 390 | null | ['block_row_id', 'block_col_start', 'block_col_offs', 'fp8_vals', 'vals', 'col_major_t_num_cols', 'block_col_id', 'block_row_start', 'block_row_offs', 'scale', 'out_mask', 'mask', 'out_offs', 'input_offs', 'col_major_t_num_rows'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_to_fp8_col_major_t_and_non_t) defined within the public class called public.The function start at line 390 and ends at 456. It contains 51 lines of code and it has a cyclomatic complexity of 1. It takes 20 parameters, represented as [390.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _amax_atomic | def _amax_atomic(input_ptr,amax_ptr,num_elements,input_dtype: tl.constexpr,BLOCK_SIZE: tl.constexpr,EPS: tl.constexpr,):# compute local amax for each blockblock_id = tl.program_id(axis=0)block_start = block_id * BLOCK_SIZEblock_offs = block_start + tl.arange(0, BLOCK_SIZE)block_mask = block_offs < num_elementsvals = tl... | 1 | 15 | 6 | 100 | 6 | 461 | 476 | 461 | null | ['vals', 'block_mask', 'block_id', 'block_start', 'block_amax', 'block_offs'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_amax_atomic) defined within the public class called public.The function start at line 461 and ends at 476. It contains 15 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [461.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _scale_atomic | def _scale_atomic(amax_ptr,scale_out_ptr,fp8_dtype_max,EPS: tl.constexpr,):# load previously computed global amaxglobal_amax = tl.load(amax_ptr).to(tl.float64)# compute scale, must be fp32scale = (fp8_dtype_max / tl.clamp(global_amax, min=EPS, max=float("inf"))).to(tl.float32)# store scale for use in Float8TrainingTens... | 1 | 12 | 4 | 81 | 3 | 480 | 496 | 480 | null | ['global_amax', 'scale_off', 'scale'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_scale_atomic) defined within the public class called public.The function start at line 480 and ends at 496. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [480.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _amax_reduction | def _amax_reduction(input_ptr,block_amaxes_ptr,num_elements,input_dtype: tl.constexpr,BLOCK_SIZE: tl.constexpr,EPS: tl.constexpr,):# compute local amax for each blockblock_id = tl.program_id(axis=0)block_start = block_id * BLOCK_SIZEblock_offs = block_start + tl.arange(0, BLOCK_SIZE)block_mask = block_offs < num_elemen... | 1 | 15 | 6 | 102 | 6 | 500 | 515 | 500 | null | ['vals', 'block_mask', 'block_id', 'block_start', 'block_amax', 'block_offs'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_amax_reduction) defined within the public class called public.The function start at line 500 and ends at 515. It contains 15 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [500.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _scale_reduction | def _scale_reduction(block_amaxes_ptr,scale_out_ptr,num_elements,fp8_dtype_max,BLOCK_SIZE: tl.constexpr,EPS: tl.constexpr,):# calculate global amax across all blocksglobal_amax = tl.zeros([1], dtype=tl.float64)num_blocks = tl.cdiv(num_elements, BLOCK_SIZE)for i in range(num_blocks):block_max = tl.load(block_amaxes_ptr ... | 2 | 18 | 6 | 128 | 5 | 519 | 539 | 519 | null | ['num_blocks', 'global_amax', 'scale', 'block_max', 'scale_off'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_scale_reduction) defined within the public class called public.The function start at line 519 and ends at 539. It contains 18 lines of code and it has a cyclomatic complexity of 2. It takes 6 parameters, represented as [519.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | hp_to_fp8_row_major | def hp_to_fp8_row_major(hp_tensor: torch.Tensor,fp8_dtype: torch.dtype,linear_mm_config: LinearMMConfig,gemm_input_role: GemmInputRole = GemmInputRole.INPUT,algo: KernelAlgorithm = KernelAlgorithm.ATOMIC_MAX,) -> Float8TrainingTensor:assert hp_tensor.is_contiguous(), "input tensor must be contiguous"num_elements = hp_t... | 1 | 42 | 5 | 188 | 9 | 542 | 591 | 542 | null | ['tl_output_dtype', 'fp8_tensor_row_major', 'output_buffer', 'scale', 'num_elements', 'grid', 'tl_input_dtype', 'fp8_dtype_max', 'fp8_dtype_min'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (hp_to_fp8_row_major) defined within the public class called public.The function start at line 542 and ends at 591. It contains 42 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [542.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | hp_to_fp8_row_major_t | def hp_to_fp8_row_major_t(hp_tensor: torch.Tensor,fp8_dtype: torch.dtype,linear_mm_config: LinearMMConfig,gemm_input_role: GemmInputRole = GemmInputRole.INPUT,algo: KernelAlgorithm = KernelAlgorithm.ATOMIC_MAX,) -> Float8TrainingTensor:assert hp_tensor.is_contiguous(), "input tensor must be contiguous"num_elements = hp... | 1 | 55 | 5 | 258 | 9 | 594 | 656 | 594 | null | ['tl_output_dtype', 'output_buffer', 'scale', 'num_elements', 'grid', 'fp8_tensor_row_major_t', 'tl_input_dtype', 'fp8_dtype_max', 'fp8_dtype_min'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (hp_to_fp8_row_major_t) defined within the public class called public.The function start at line 594 and ends at 656. It contains 55 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [594.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | hp_to_fp8_col_major | def hp_to_fp8_col_major(hp_tensor: torch.Tensor,fp8_dtype: torch.dtype,linear_mm_config: LinearMMConfig,gemm_input_role: GemmInputRole = GemmInputRole.INPUT,algo: KernelAlgorithm = KernelAlgorithm.ATOMIC_MAX,) -> Float8TrainingTensor:assert hp_tensor.is_contiguous(), "input tensor must be contiguous"num_elements = hp_t... | 1 | 52 | 5 | 250 | 10 | 659 | 720 | 659 | null | ['fp8_tensor_col_major', 'tl_output_dtype', 'output_buffer', 'scale', 'num_elements', 'grid', 'tl_input_dtype', 'fp8_dtype_max', 'col_major_strides', 'fp8_dtype_min'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (hp_to_fp8_col_major) defined within the public class called public.The function start at line 659 and ends at 720. It contains 52 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [659.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | hp_to_fp8_col_major_t | def hp_to_fp8_col_major_t(hp_tensor: torch.Tensor,fp8_dtype: torch.dtype,linear_mm_config: LinearMMConfig,gemm_input_role: GemmInputRole = GemmInputRole.INPUT,algo: KernelAlgorithm = KernelAlgorithm.ATOMIC_MAX,) -> Float8TrainingTensor:assert hp_tensor.is_contiguous(), "input tensor must be contiguous"num_elements = hp... | 1 | 42 | 5 | 192 | 9 | 723 | 772 | 723 | null | ['fp8_tensor_col_major_t', 'tl_output_dtype', 'output_buffer', 'scale', 'num_elements', 'grid', 'tl_input_dtype', 'fp8_dtype_max', 'fp8_dtype_min'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (hp_to_fp8_col_major_t) defined within the public class called public.The function start at line 723 and ends at 772. It contains 42 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [723.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | hp_to_fp8_row_and_col_major | def hp_to_fp8_row_and_col_major(hp_tensor: torch.Tensor,fp8_dtype: torch.dtype,linear_mm_config: LinearMMConfig,gemm_input_role: GemmInputRole = GemmInputRole.INPUT,algo: KernelAlgorithm = KernelAlgorithm.ATOMIC_MAX,) -> Float8TrainingTensor:assert hp_tensor.is_contiguous(), "input tensor must be contiguous"tl_input_dt... | 1 | 64 | 5 | 284 | 13 | 775 | 852 | 775 | null | ['fp8_output_col_major', 'fp8_tensor_col_major', 'tl_output_dtype', 'fp8_tensor_row_major', 'fp8_output_row_major', 'scale', 'orig_shape', 'num_elements', 'grid', 'tl_input_dtype', 'fp8_dtype_max', 'col_major_strides', 'fp8_dtype_min'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (hp_to_fp8_row_and_col_major) defined within the public class called public.The function start at line 775 and ends at 852. It contains 64 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [775.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | hp_to_fp8_row_major_t_and_non_t | def hp_to_fp8_row_major_t_and_non_t(hp_tensor: torch.Tensor,fp8_dtype: torch.dtype,linear_mm_config: LinearMMConfig,gemm_input_role: GemmInputRole = GemmInputRole.INPUT,algo: KernelAlgorithm = KernelAlgorithm.ATOMIC_MAX,) -> Float8TrainingTensor:assert hp_tensor.is_contiguous(), "input tensor must be contiguous"tl_inpu... | 1 | 68 | 5 | 318 | 11 | 855 | 934 | 855 | null | ['tl_output_dtype', 'fp8_tensor_row_major', 'fp8_output_row_major', 'scale', 'num_elements', 'fp8_output_row_major_t', 'grid', 'fp8_tensor_row_major_t', 'tl_input_dtype', 'fp8_dtype_max', 'fp8_dtype_min'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (hp_to_fp8_row_major_t_and_non_t) defined within the public class called public.The function start at line 855 and ends at 934. It contains 68 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [855.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | hp_to_fp8_col_major_t_and_non_t | def hp_to_fp8_col_major_t_and_non_t(hp_tensor: torch.Tensor,fp8_dtype: torch.dtype,linear_mm_config: LinearMMConfig,gemm_input_role: GemmInputRole = GemmInputRole.INPUT,algo: KernelAlgorithm = KernelAlgorithm.ATOMIC_MAX,) -> Float8TrainingTensor:assert hp_tensor.is_contiguous(), "input tensor must be contiguous"tl_inpu... | 1 | 71 | 5 | 332 | 12 | 937 | 1,021 | 937 | null | ['fp8_output_col_major', 'fp8_tensor_col_major', 'fp8_tensor_col_major_t', 'tl_output_dtype', 'fp8_output_col_major_t', 'scale', 'num_elements', 'grid', 'tl_input_dtype', 'fp8_dtype_max', 'col_major_strides', 'fp8_dtype_min'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (hp_to_fp8_col_major_t_and_non_t) defined within the public class called public.The function start at line 937 and ends at 1021. It contains 71 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [937.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _hp_tensor_to_scale | def _hp_tensor_to_scale(hp_tensor: torch.Tensor,tl_input_dtype: tl.core.dtype,fp8_dtype_max: float,algo: KernelAlgorithm,) -> torch.Tensor:num_elements = hp_tensor.numel()scale_out = torch.empty((), dtype=torch.float32, device=hp_tensor.device)grid = lambda meta: (triton.cdiv(num_elements, meta["BLOCK_SIZE"]),)# comput... | 3 | 52 | 4 | 272 | 9 | 1,024 | 1,086 | 1,024 | null | ['amax_buffer_size', 'global_amax', 'scale_out', 'max_block_size', 'block_size', 'block_amaxes', 'num_elements', 'grid', 'num_warps'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_hp_tensor_to_scale) defined within the public class called public.The function start at line 1024 and ends at 1086. It contains 52 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [1024.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_fp8_hp_to_fp8_row_major | def test_fp8_hp_to_fp8_row_major(input_shape: tuple[int, int], algo: KernelAlgorithm):assert torch.cuda.is_available()device = "cuda"input_bf16 = torch.randn(input_shape, dtype=torch.bfloat16, device=device)x_bf16 = input_bf16.clone().detach().to(device)y_bf16 = input_bf16.clone().detach().to(device)# production implem... | 1 | 33 | 2 | 235 | 6 | 32 | 82 | 32 | null | ['x_bf16', 'device', 'input_bf16', 'y_bf16', 'y_fp8_row_major', 'x_fp8_row_major'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_fp8_hp_to_fp8_row_major) defined within the public class called public.The function start at line 32 and ends at 82. It contains 33 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [32.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_fp8_hp_to_fp8_row_major_t | def test_fp8_hp_to_fp8_row_major_t(input_shape: tuple[int, int], algo: KernelAlgorithm):assert torch.cuda.is_available()device = "cuda"input_bf16 = torch.tensor([[1, 2, 3], [4, 5, 6]], dtype=torch.bfloat16, device=device)x_bf16 = input_bf16.clone().detach().to(device)y_bf16 = input_bf16.clone().detach().to(device)# pro... | 1 | 36 | 2 | 262 | 7 | 93 | 146 | 93 | null | ['x_fp8_row_major_t', 'y_fp8_row_major_t', 'x_bf16', 'device', 'input_bf16', 'y_bf16', 'x_fp8_row_major'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_fp8_hp_to_fp8_row_major_t) defined within the public class called public.The function start at line 93 and ends at 146. It contains 36 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [93.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_fp8_hp_to_fp8_col_major | def test_fp8_hp_to_fp8_col_major(input_shape: tuple[int, int], algo: KernelAlgorithm):assert torch.cuda.is_available()device = "cuda"input_bf16 = torch.randn(input_shape, dtype=torch.bfloat16, device=device)x_bf16 = input_bf16.clone().detach().to(device)y_bf16 = input_bf16.clone().detach().to(device)# production implem... | 1 | 34 | 2 | 252 | 7 | 157 | 208 | 157 | null | ['y_fp8_col_major', 'x_bf16', 'device', 'input_bf16', 'y_bf16', 'x_fp8_col_major', 'x_fp8_row_major'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_fp8_hp_to_fp8_col_major) defined within the public class called public.The function start at line 157 and ends at 208. It contains 34 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [157.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_fp8_hp_to_fp8_col_major_t | def test_fp8_hp_to_fp8_col_major_t(input_shape: tuple[int, int], algo: KernelAlgorithm):assert torch.cuda.is_available()device = "cuda"input_bf16 = torch.randn(input_shape, dtype=torch.bfloat16, device=device)x_bf16 = input_bf16.clone().detach().to(device)y_bf16 = input_bf16.clone().detach().to(device)# production impl... | 1 | 34 | 2 | 248 | 7 | 219 | 270 | 219 | null | ['x_bf16', 'device', 'input_bf16', 'y_bf16', 'x_fp8_row_major', 'x_fp8_col_major_t', 'y_fp8_col_major_t'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_fp8_hp_to_fp8_col_major_t) defined within the public class called public.The function start at line 219 and ends at 270. It contains 34 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [219.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_fp8_hp_to_fp8_row_and_col_major | def test_fp8_hp_to_fp8_row_and_col_major(input_shape: tuple[int, int], algo: KernelAlgorithm):assert torch.cuda.is_available()device = "cuda"input_bf16 = torch.randn(input_shape, dtype=torch.bfloat16, device=device)x_bf16 = input_bf16.clone().detach().to(device)y_bf16 = input_bf16.clone().detach().to(device)# productio... | 1 | 46 | 2 | 349 | 6 | 281 | 344 | 281 | null | ['x_bf16', 'device', 'input_bf16', 'y_bf16', 'x_fp8_col_major', 'x_fp8_row_major'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_fp8_hp_to_fp8_row_and_col_major) defined within the public class called public.The function start at line 281 and ends at 344. It contains 46 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [281.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_fp8_hp_to_fp8_row_major_t_and_non_t | def test_fp8_hp_to_fp8_row_major_t_and_non_t(input_shape: tuple[int, int], algo: KernelAlgorithm):assert torch.cuda.is_available()device = "cuda"input_bf16 = torch.randn(input_shape, dtype=torch.bfloat16, device=device)x_bf16 = input_bf16.clone().detach().to(device)y_bf16 = input_bf16.clone().detach().to(device)# produ... | 1 | 46 | 2 | 343 | 6 | 355 | 418 | 355 | null | ['x_fp8_row_major_t', 'x_bf16', 'device', 'input_bf16', 'y_bf16', 'x_fp8_row_major'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_fp8_hp_to_fp8_row_major_t_and_non_t) defined within the public class called public.The function start at line 355 and ends at 418. It contains 46 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [355.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | test_fp8_hp_to_fp8_col_major_t_and_non_t | def test_fp8_hp_to_fp8_col_major_t_and_non_t(input_shape: tuple[int, int], algo: KernelAlgorithm):assert torch.cuda.is_available()device = "cuda"input_bf16 = torch.randn(input_shape, dtype=torch.bfloat16, device=device)x_bf16 = input_bf16.clone().detach().to(device)y_bf16 = input_bf16.clone().detach().to(device)# produ... | 1 | 47 | 2 | 358 | 7 | 429 | 493 | 429 | null | ['x_bf16', 'device', 'input_bf16', 'y_bf16', 'x_fp8_col_major', 'x_fp8_row_major', 'x_fp8_col_major_t'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_fp8_hp_to_fp8_col_major_t_and_non_t) defined within the public class called public.The function start at line 429 and ends at 493. It contains 47 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [429.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self):super().__init__()self.layers = nn.Sequential(nn.Linear(2048, 4096, bias=False),nn.Linear(4096, 16, bias=False),) | 1 | 6 | 1 | 47 | 0 | 28 | 33 | 28 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 28 and ends at 33. It contains 6 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 | forward | def forward(self, x: torch.Tensor) -> torch.Tensor:return self.layers(x) | 1 | 2 | 2 | 22 | 0 | 35 | 36 | 35 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 35 and ends at 36. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [35.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | setup_distributed | def setup_distributed():rank = int(os.environ["RANK"])world_size = int(os.environ["WORLD_SIZE"])dist.init_process_group("nccl", rank=rank, world_size=world_size)torch.cuda.set_device(rank) | 1 | 5 | 0 | 48 | 2 | 39 | 43 | 39 | null | ['world_size', 'rank'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (setup_distributed) defined within the public class called public.The function start at line 39 and ends at 43. It contains 5 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 | model1 | def model1():torch.manual_seed(0)return TestModel() | 1 | 3 | 0 | 14 | 0 | 47 | 49 | 47 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (model1) defined within the public class called public.The function start at line 47 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 | model2 | def model2():torch.manual_seed(0)return TestModel() | 1 | 3 | 0 | 14 | 0 | 53 | 55 | 53 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (model2) defined within the public class called public.The function start at line 53 and ends at 55. 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 | test_model_weights_and_gradients | def test_model_weights_and_gradients(model1, model2):assert torch.cuda.is_available()device = torch.device("cuda")setup_distributed()model1 = model1.to(torch.bfloat16).to(device)model2 = model2.to(torch.bfloat16).to(device)# compare production float8 linear conversion with no-compile versionconvert_to_float8_training(m... | 2 | 27 | 2 | 259 | 11 | 58 | 98 | 58 | null | ['model2', 'output2', 'output1', 'input_copy1', 'device', 'input_copy2', 'loss_fn', 'loss1', 'input_tensor', 'loss2', 'model1'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_model_weights_and_gradients) defined within the public class called public.The function start at line 58 and ends at 98. It contains 27 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [58.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self):super().__init__()self.layers = nn.Sequential(nn.Linear(32, 64, bias=False),nn.Linear(64, 32, bias=False),) | 1 | 6 | 1 | 47 | 0 | 17 | 22 | 17 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 17 and ends at 22. It contains 6 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 | forward | def forward(self, x: torch.Tensor) -> torch.Tensor:return self.layers(x) | 1 | 2 | 2 | 22 | 0 | 24 | 25 | 24 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 24 and ends at 25. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [24.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | model1 | def model1():torch.manual_seed(0)return TestModel() | 1 | 3 | 0 | 14 | 0 | 29 | 31 | 29 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (model1) defined within the public class called public.The function start at line 29 and ends at 31. 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 | model2 | def model2():torch.manual_seed(0)return TestModel() | 1 | 3 | 0 | 14 | 0 | 35 | 37 | 35 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (model2) defined within the public class called public.The function start at line 35 and ends at 37. 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 | test_model_weights_and_gradients | def test_model_weights_and_gradients(model1, model2, input_shape: tuple[int, int], no_precompute_for_backward: bool):assert torch.cuda.is_available()device = torch.device("cuda")model1 = model1.to(torch.bfloat16).to(device)model2 = model2.to(torch.bfloat16).to(device)# compare production float8 linear conversion with n... | 2 | 27 | 4 | 267 | 11 | 44 | 80 | 44 | null | ['model2', 'output2', 'output1', 'input_copy1', 'device', 'input_copy2', 'loss_fn', 'loss1', 'input_tensor', 'loss2', 'model1'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_model_weights_and_gradients) defined within the public class called public.The function start at line 44 and ends at 80. It contains 27 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [44.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __init__ | def __init__(self,linear_layer: nn.Module | None,quant_config: dict,del_orig: bool = True,compute_dtype: torch.dtype = torch.bfloat16,device: str = "cuda",initialize: bool = True,inner_k_tiles=8,padding=True,):super().__init__()self.ready = Falseself.in_gpu = Falseself.bias = Noneself.device = deviceself.compute_dtype ... | 2 | 31 | 9 | 199 | 0 | 24 | 59 | 24 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 24 and ends at 59. It contains 31 lines of code and it has a cyclomatic complexity of 2. It takes 9 parameters, represented as [24.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | initialize_with_hqq_quants | def initialize_with_hqq_quants(self, W_q, meta, bias=None):self.padding = (False# Force padding off, a bit tricky to post-pad with grouping)self.set_shape(meta["shape"])self.process_hqq_quants(W_q, meta)self.bias = biasself.ready = Trueself.in_gpu = Truetorch.cuda.empty_cache()return self | 1 | 11 | 4 | 61 | 0 | 62 | 74 | 62 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (initialize_with_hqq_quants) defined within the public class called public.The function start at line 62 and ends at 74. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [62.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | initialize | def initialize(self):if self.linear_layer is not None:W = self.linear_layer.weight.dataself.set_shape(W.shape)if self.in_features_diff > 0:W = F.pad(W, pad=(0, self.in_features_diff), value=0)W_q, meta = self.quantize(W, **self.quant_config)self.process_hqq_quants(W_q, meta)del W_q, metaself.bias = (Noneif (self.linear... | 5 | 22 | 1 | 152 | 0 | 76 | 103 | 76 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (initialize) defined within the public class called public.The function start at line 76 and ends at 103. It contains 22 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | quantize | def quantize(self,W: Tensor,weight_quant_params: dict,scale_quant_params=dict | None,zero_quant_params=dict | None,offload_meta=False,):W_q, meta = Quantizer.quantize(W,**weight_quant_params,device=self.device,compute_dtype=self.compute_dtype,bitpack=False,)# ToDO: meta quantizationreturn W_q, meta | 1 | 16 | 6 | 64 | 0 | 107 | 125 | 107 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (quantize) defined within the public class called public.The function start at line 107 and ends at 125. It contains 16 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [107.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | reshape_meta_axis1 | def reshape_meta_axis1(self, meta_tensor, new_group_size, shape):meta_tensor = meta_tensor.repeat([1, shape[1]]).reshape(shape)meta_tensor = torch.mean(meta_tensor.reshape([-1, new_group_size]), axis=1, keepdim=True)return meta_tensor | 1 | 6 | 4 | 59 | 0 | 129 | 134 | 129 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (reshape_meta_axis1) defined within the public class called public.The function start at line 129 and ends at 134. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [129.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | find_multiple | def find_multiple(self, n: int, k: int) -> int:if n % k == 0:return nreturn n + k - (n % k) | 2 | 4 | 3 | 34 | 0 | 136 | 139 | 136 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (find_multiple) defined within the public class called public.The function start at line 136 and ends at 139. It contains 4 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [136.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | set_shape | def set_shape(self, shape):self.shape = shapeself.in_features = shape[1]self.out_features = shape[0]self.origin_in_features = self.in_featuresif self.padding:self.in_features = self.find_multiple(self.in_features, 1024)self.in_features_diff = self.in_features - self.origin_in_features | 2 | 8 | 2 | 65 | 0 | 141 | 150 | 141 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (set_shape) defined within the public class called public.The function start at line 141 and ends at 150. It contains 8 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [141.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | process_hqq_quants | def process_hqq_quants(self, W_q, meta):scales = meta["scale"]zeros = meta["zero"]shape = meta["shape"]if meta["packing"] is not None:W_q = Quantizer.unpack[meta["packing"]](W_q)if self.groupsize is None:self.groupsize = 128W_q = W_q.reshape([-1, self.groupsize])scales = self.reshape_meta_axis1(scales, self.groupsize, ... | 4 | 25 | 3 | 208 | 0 | 153 | 181 | 153 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (process_hqq_quants) defined within the public class called public.The function start at line 153 and ends at 181. It contains 25 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [153.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | hqq_quants_to_torch_quants | def hqq_quants_to_torch_quants(self, W_q: Tensor, scales: Tensor, zeros: Tensor, shape, nbits=4):W_q = W_q.to(dtype=self.compute_dtype, device=self.device)scales = scales.to(dtype=self.compute_dtype, device=self.device)zeros = zeros.to(dtype=self.compute_dtype, device=self.device)max_int = 2**nbits - 1min_int = 0dump =... | 2 | 26 | 6 | 250 | 0 | 184 | 221 | 184 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (hqq_quants_to_torch_quants) defined within the public class called public.The function start at line 184 and ends at 221. It contains 26 lines of code and it has a cyclomatic complexity of 2. It takes 6 parameters, represented as [184.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | pack_scales_and_zeros | def pack_scales_and_zeros(self, scales, zeros):assert scales.shape == zeros.shapeassert scales.dtype == torch.bfloat16assert zeros.dtype == torch.bfloat16return (torch.cat([scales.reshape(scales.size(0), scales.size(1), 1),zeros.reshape(zeros.size(0), zeros.size(1), 1),],2,).transpose(0, 1).contiguous()) | 1 | 15 | 3 | 99 | 0 | 223 | 237 | 223 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (pack_scales_and_zeros) defined within the public class called public.The function start at line 223 and ends at 237. It contains 15 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [223.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | matmul | def matmul(self, x):origin_x_size = x.size()x = x.reshape(-1, origin_x_size[-1])if check_cpu_version(x.device):c = torch.ops.aten._weight_int4pack_mm_for_cpu(x, self.weight_int4pack, self.groupsize, self.scales_and_zeros)else:c = torch.ops.aten._weight_int4pack_mm(x, self.weight_int4pack, self.groupsize, self.scales_an... | 2 | 14 | 2 | 112 | 0 | 242 | 255 | 242 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (matmul) defined within the public class called public.The function start at line 242 and ends at 255. It contains 14 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [242.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | dequantize | def dequantize(self):return self.matmul(torch.eye(self.in_features, dtype=self.compute_dtype, device=self.device))[: self.origin_in_features].t() | 1 | 4 | 1 | 41 | 0 | 258 | 261 | 258 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (dequantize) defined within the public class called public.The function start at line 258 and ends at 261. 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 | forward | def forward(self, x: torch.Tensor) -> torch.Tensor:x = x.to(self.compute_dtype)if self.in_features_diff > 0:x = F.pad(x, pad=(0, self.in_features_diff))out = self.matmul(x)if self.bias is not None:out += self.biasreturn out | 3 | 8 | 2 | 73 | 0 | 264 | 274 | 264 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 264 and ends at 274. It contains 8 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [264.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_configs_io_bound | def get_configs_io_bound():configs = []for num_stages in [2, 3, 4, 5, 6]:for block_m in [16, 32]:for block_k in [32, 64]:for block_n in [32, 64, 128, 256]:num_warps = 2 if block_n <= 64 else 4configs.append(Config({"BLOCK_M": block_m,"BLOCK_N": block_n,"BLOCK_K": block_k,"SPLIT_K": 1,},num_stages=num_stages,num_warps=n... | 7 | 34 | 0 | 155 | 2 | 14 | 48 | 14 | null | ['configs', 'num_warps'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_configs_io_bound) defined within the public class called public.The function start at line 14 and ends at 48. It contains 34 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 | get_configs_compute_bound | def get_configs_compute_bound():configs = [# basic configs for compute-bound matmulsConfig({"BLOCK_M": 128, "BLOCK_N": 256, "BLOCK_K": 32, "SPLIT_K": 1},num_stages=3,num_warps=8,),Config({"BLOCK_M": 256, "BLOCK_N": 128, "BLOCK_K": 32, "SPLIT_K": 1},num_stages=3,num_warps=8,),Config({"BLOCK_M": 256, "BLOCK_N": 64, "BLOC... | 1 | 94 | 0 | 550 | 1 | 51 | 146 | 51 | null | ['configs'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_configs_compute_bound) defined within the public class called public.The function start at line 51 and ends at 146. It contains 94 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_to_zero | def init_to_zero(name):return lambda nargs: nargs[name].zero_() | 1 | 2 | 1 | 17 | 0 | 149 | 150 | 149 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (init_to_zero) defined within the public class called public.The function start at line 149 and ends at 150. 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 | _mixed_mm_kernel | def _mixed_mm_kernel(# OperandsA,B,scales_ptr,zeros_ptr,C,# Matrix dims.M,N,K,# a, b, c, scales / zeros stridesstride_am,stride_ak,#stride_bk,stride_bn,#stride_cm,stride_cn,stride_scale_k,stride_scale_n,# Meta-paramsIS_BFLOAT16: tl.constexpr,QGROUP_SIZE: tl.constexpr,BLOCK_M: tl.constexpr,BLOCK_N: tl.constexpr,BLOCK_K:... | 18 | 148 | 29 | 1,112 | 35 | 168 | 392 | 168 | null | ['qb', 'width', 'mask', 'pid_m', 'rm', 'offsets_scale_n', 'scale_offset_k', 'rbn', 'grid_n', 'acc', 'scales', 'pid_z', 'C', 'rbk', 'qb_lo', 'rak', 'B', 'pid', 'qb_hi', 'a', 'k_remaining_b', 'offs_cn', '_4_i8', 'A', 'pid_n', '_0', 'k_remaining_a', 'ram', 'zeros', 'group_id', 'group_size', 'dq_b', 'rn', 'offs_cm', 'grid_... | None | null | 0 | 0 | 0 | null | 0 | null | The function (_mixed_mm_kernel) defined within the public class called public.The function start at line 168 and ends at 392. It contains 148 lines of code and it has a cyclomatic complexity of 18. It takes 29 parameters, represented as [168.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | pack_2xint4 | def pack_2xint4(t):"""The packing format is such that consecutive rows are packed into a lower / upper bitsE.g.,Original, unpacked B (dtype i8):[[0, 1, 2, 3][4, 5, 6, 7][8, 9, 10, 11][12, 13, 14, 15]]Packed B:[[0|4, 1|5, 2|6, 3|7][8|12, 9|13, 10|14, 11|15]](Note each entry in `Packed B` is shown lsb->msb)"""assert t.dt... | 2 | 4 | 1 | 54 | 1 | 18 | 38 | 18 | null | ['t'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (pack_2xint4) defined within the public class called public.The function start at line 18 and ends at 38. It contains 4 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 | triton_mixed_mm | def triton_mixed_mm(a,b,scales,zeros,group_size,transposed=False,acc_dtype=None,input_precision="ieee",fp8_fast_accum=False,kernel_type="compute_bound",# For debugging onlyBLOCK_M=None,BLOCK_N=None,BLOCK_K=None,):"""Run fused int4 / fp16 dequant GEMMArgs:a (torch.Tensor): M x K if not transposed, M x N if transposedb (... | 14 | 106 | 13 | 590 | 8 | 41 | 179 | 41 | null | ['device', 'kernel', 'a', 'c', 'b', 'grid', 'N', 'acc_dtype'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_mixed_mm) defined within the public class called public.The function start at line 41 and ends at 179. It contains 106 lines of code and it has a cyclomatic complexity of 14. It takes 13 parameters, represented as [41.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | register_qsdpa.qsdpa | def qsdpa(query: TensorBox,key: TensorBox,value: TensorBox,attn_mask: Optional[TensorBox],dropout: float,is_causal: bool,scale: Optional[float] = None,q_scale: Optional[float] = 1.0,q_zp: Optional[int] = 0,k_scale: Optional[float] = 1.0,k_zp: Optional[int] = 0,v_scale: Optional[float] = 1.0,v_zp: Optional[int] = 0,a_sc... | 9 | 100 | 17 | 466 | 0 | 35 | 144 | 35 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (register_qsdpa.qsdpa) defined within the public class called public.The function start at line 35 and ends at 144. It contains 100 lines of code and it has a cyclomatic complexity of 9. It takes 17 parameters, represented as [35.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | register_qsdpa | def register_qsdpa():@register_lowering(torch.ops.torchao.qscaled_dot_product.default, type_promotion_kind=None)def qsdpa(query: TensorBox,key: TensorBox,value: TensorBox,attn_mask: Optional[TensorBox],dropout: float,is_causal: bool,scale: Optional[float] = None,q_scale: Optional[float] = 1.0,q_zp: Optional[int] = 0,k_... | 1 | 5 | 0 | 23 | 6 | 31 | 144 | 31 | null | ['input_nodes', 'inputs_for_autotuning', 'layout', 'fill_order', 'out_strides', 'out_size'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (register_qsdpa) defined within the public class called public.The function start at line 31 and ends at 144. It contains 5 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,input_nodes,layout: ir.Layout,scale,q_scale,q_zp,k_scale,k_zp,v_scale,v_zp,a_scale,a_zp,o_scale,o_zp,) -> None:assert layout.dtype in [torch.uint8]CppTemplate.__init__(self, "int8_sdpa", input_nodes, layout, parallel_num_threads())self.scale = scaleself.q_scale = q_scaleself.q_zp = q_zpself.k_scale = ... | 1 | 31 | 14 | 119 | 0 | 1,537 | 1,567 | 1,537 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 1537 and ends at 1567. It contains 31 lines of code and it has a cyclomatic complexity of 1. It takes 14 parameters, represented as [1537.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | add_choices.preprocessor | def preprocessor(input_nodes, layout):return input_nodes, layout | 1 | 2 | 2 | 11 | 0 | 1,586 | 1,587 | 1,586 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (add_choices.preprocessor) defined within the public class called public.The function start at line 1586 and ends at 1587. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1586.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.