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 | test_string_to_config | def test_string_to_config(self):# Test baselineconfig = string_to_config("baseline", None)self.assertIsNone(config)# Test int8woconfig = string_to_config("int8wo", None)self.assertIsNotNone(config)# Test invalid configconfig = string_to_config("not_a_real_config", None)self.assertIsNone(config) | 1 | 7 | 1 | 47 | 0 | 88 | 99 | 88 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_string_to_config) defined within the public class called public.The function start at line 88 and ends at 99. It contains 7 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_string_to_config_sparsity | def test_string_to_config_sparsity(self):"""Test sparsity config generation"""# Test semi-sparse configconfig = string_to_config(None, "semi-sparse")self.assertIsInstance(config, SemiSparseWeightConfig)# Test block sparse configconfig = string_to_config(None, "block")self.assertIsInstance(config, BlockSparseWeightConfi... | 1 | 11 | 1 | 70 | 0 | 101 | 119 | 101 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_string_to_config_sparsity) defined within the public class called public.The function start at line 101 and ends at 119. It contains 11 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_block_sparsity_with_baseline_quantization | def test_block_sparsity_with_baseline_quantization(self):"""Test that block sparsity with baseline quantization returns BlockSparseWeightConfig"""config = string_to_config("baseline", "block")self.assertIsInstance(config, BlockSparseWeightConfig) | 1 | 3 | 1 | 22 | 0 | 121 | 124 | 121 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_block_sparsity_with_baseline_quantization) defined within the public class called public.The function start at line 121 and ends at 124. 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_block_sparsity_with_non_baseline_quantization | def test_block_sparsity_with_non_baseline_quantization(self):"""Test that block sparsity with non-baseline quantization still returns BlockSparseWeightConfig"""# Block sparsity should take precedence over any quantization methodconfig = string_to_config("int8wo", "block")self.assertIsInstance(config, BlockSparseWeightC... | 1 | 7 | 1 | 54 | 0 | 126 | 136 | 126 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_block_sparsity_with_non_baseline_quantization) defined within the public class called public.The function start at line 126 and ends at 136. It contains 7 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_invalid_sparsity | def test_invalid_sparsity(self):"""Test invalid sparsity config generation"""from benchmarks.microbenchmarks.benchmark_runner import (get_quantization_sparsity_recipes,)with self.assertRaises(ValueError):get_quantization_sparsity_recipes(["baseline"], ["invalid_sparsity"]) | 1 | 6 | 1 | 35 | 0 | 138 | 145 | 138 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_invalid_sparsity) defined within the public class called public.The function start at line 138 and ends at 145. 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 | test_toy_linear_model | def test_toy_linear_model(self):model = ToyLinearModel(k=64, n=32, dtype=torch.float32)x = torch.randn(16, 64)out = model(x)self.assertEqual(out.shape, (16, 32))self.assertEqual(out.dtype, torch.float32) | 1 | 6 | 1 | 65 | 0 | 147 | 152 | 147 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_toy_linear_model) defined within the public class called public.The function start at line 147 and ends at 152. 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 | test_ln_linear_sigmoid | def test_ln_linear_sigmoid(self):model = LNLinearActivationModel(fc_dim1=64, fc_dim2=32, dtype=torch.float32)x = torch.randn(16, 64)out = model(x)self.assertEqual(out.shape, (16, 32))self.assertEqual(out.dtype, torch.float32)self.assertTrue(torch.all((out >= 0) & (out <= 1)))# Check sigmoid output range | 1 | 9 | 1 | 86 | 0 | 154 | 162 | 154 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_ln_linear_sigmoid) defined within the public class called public.The function start at line 154 and ends at 162. It contains 9 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_create_model_and_input_data | def test_create_model_and_input_data(self):m, k, n = 16, 64, 32model, input_data = create_model_and_input_data(model_type="linear",m=m,k=k,n=n,high_precision_dtype=torch.float32,device="cpu",)self.assertIsInstance(model, ToyLinearModel)self.assertEqual(input_data.shape, (m, k))model, input_data = create_model_and_input... | 1 | 22 | 1 | 126 | 0 | 164 | 186 | 164 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_create_model_and_input_data) defined within the public class called public.The function start at line 164 and ends at 186. It contains 22 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_generate_results_csv | def test_generate_results_csv(self):results = [BenchmarkResult(BenchmarkConfig(quantization="int8wo",sparsity=None,params={},shape_name="custom",shape=[1024, 1024, 1024],output_dir="test_output",benchmark_mode="inference",),),BenchmarkResult(BenchmarkConfig(quantization="int4wo",sparsity=None,params={},shape_name="cust... | 1 | 29 | 1 | 137 | 0 | 188 | 219 | 188 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_generate_results_csv) defined within the public class called public.The function start at line 188 and ends at 219. It contains 29 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_clean_caches | def test_clean_caches(self):# Just test that it runs without errorclean_caches() | 1 | 2 | 1 | 8 | 0 | 221 | 223 | 221 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_clean_caches) defined within the public class called public.The function start at line 221 and ends at 223. 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 | scale_dim0_reference | def scale_dim0_reference(x_hp, block_size) -> Tuple[torch.Tensor, torch.Tensor]:assert x_hp.is_contiguous()x_hp_d0_block = x_hp.reshape(-1, block_size)x_hp_d0_block_abs = x_hp_d0_block.abs()amax_dim0 = torch.amax(x_hp_d0_block_abs, dim=1).unsqueeze(1)x_hp_d0_block_normalized = x_hp_d0_block / amax_dim0x_hp_d0_normalize... | 1 | 8 | 2 | 78 | 5 | 26 | 33 | 26 | null | ['x_hp_d0_block', 'x_hp_d0_block_abs', 'amax_dim0', 'x_hp_d0_normalized', 'x_hp_d0_block_normalized'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (scale_dim0_reference) defined within the public class called public.The function start at line 26 and ends at 33. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [26.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | scale_dim1_reference | def scale_dim1_reference(x_hp, block_size) -> Tuple[torch.Tensor, torch.Tensor]:assert x_hp.is_contiguous()x_hp_d1 = x_hp.t().contiguous()x_hp_d1_block = x_hp_d1.reshape(-1, block_size)x_hp_d1_block_abs = x_hp_d1_block.abs()amax_dim1 = torch.amax(x_hp_d1_block_abs, dim=1).unsqueeze(1)x_hp_d1_block_normalized = x_hp_d1_... | 1 | 9 | 2 | 89 | 6 | 36 | 44 | 36 | null | ['x_hp_d1_block_abs', 'x_hp_d1_block', 'x_hp_d1', 'x_hp_d1_block_normalized', 'amax_dim1', 'x_hp_d1_normalized'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (scale_dim1_reference) defined within the public class called public.The function start at line 36 and ends at 44. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [36.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | scale_dim0_dim1_reference | def scale_dim0_dim1_reference(x_hp: torch.Tensor, block_size) -> Tuple[torch.Tensor, torch.Tensor]:# normalize across dim0x_hp_d0_normalized, amax_dim0 = scale_dim0_reference(x_hp, block_size)# normalize across dim1x_hp_d1_normalized, amax_dim1 = scale_dim1_reference(x_hp, block_size)return x_hp_d0_normalized, x_hp_d1_... | 1 | 6 | 2 | 54 | 0 | 47 | 54 | 47 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (scale_dim0_dim1_reference) defined within the public class called public.The function start at line 47 and ends at 54. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [47.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | to_mx_dim0_reference | def to_mx_dim0_reference(x_hp,block_size,scaling_mode=ScaleCalculationMode.FLOOR,target_dtype=torch.float8_e4m3fn,):scale_d0, data_d0 = to_mx(x_hp, target_dtype, block_size, scaling_mode=scaling_mode)return data_d0, scale_d0 | 1 | 8 | 4 | 40 | 0 | 57 | 64 | 57 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (to_mx_dim0_reference) defined within the public class called public.The function start at line 57 and ends at 64. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [57.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | to_mx_dim1_reference | def to_mx_dim1_reference(x_hp,block_size,scaling_mode=ScaleCalculationMode.FLOOR,target_dtype=torch.float8_e4m3fn,):x_hp = x_hp.t().contiguous()scale_d1, data_d1 = to_mx(x_hp, target_dtype, block_size, scaling_mode=scaling_mode)return data_d1.t(), scale_d1 | 1 | 9 | 4 | 55 | 1 | 67 | 75 | 67 | null | ['x_hp'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (to_mx_dim1_reference) defined within the public class called public.The function start at line 67 and ends at 75. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [67.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | benchmark_cuda_function_in_microseconds | def benchmark_cuda_function_in_microseconds(f, *args):return do_bench(lambda: f(*args), return_mode="median") * 1e3 | 1 | 2 | 2 | 25 | 0 | 78 | 79 | 78 | null | [] | 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 78 and ends at 79. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [78.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | run | def run(M: int = 16384,K: int = 16384,BLOCK_SIZE: int = 32,mode: str = "dim0",):print(f"M {M} K {K} BLOCK_SIZE {BLOCK_SIZE}")print(f"GPU: {torch.cuda.get_device_name(0)}")print(f"torch version: {torch.__version__}")print(f"triton version: {triton.__version__}")print(f"mode: {mode}")assert mode in ("dim0","dim1","dim0_d... | 26 | 210 | 4 | 1,483 | 12 | 82 | 334 | 82 | null | ['scale_dim0_dim1_reference_c', 'bytes_r', 'bytes_rw', 'time_us', '__', 'bps', 'to_mx_dim0_reference_c', 'bytes_w', 'x', 'scale_dim0_reference_c', 'to_mx_dim1_reference_c', 'scale_dim1_reference_c'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run) defined within the public class called public.The function start at line 82 and ends at 334. It contains 210 lines of code and it has a cyclomatic complexity of 26. It takes 4 parameters, represented as [82.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_configs | def get_configs() -> List[ExperimentConfig]:mnk_list = [# Llama4 shapes(16640, 5120, 8192),(16640, 8192, 5120),]out_dtypes = [torch.bfloat16]configs = []for mnk, out_dtype in itertools.product(mnk_list, out_dtypes):m, n, k = mnkconfigs.append(ExperimentConfig(out_dtype=out_dtype,m=m,n=n,k=k,))return configs | 2 | 18 | 0 | 87 | 3 | 55 | 73 | 55 | null | ['configs', 'mnk_list', 'out_dtypes'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_configs) defined within the public class called public.The function start at line 55 and ends at 73. 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 | run_experiment.warmup | def warmup(func, *args, **kwargs):for _ in range(10):func(*args, **kwargs) | 2 | 3 | 3 | 27 | 0 | 86 | 88 | 86 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment.warmup) defined within the public class called public.The function start at line 86 and ends at 88. It contains 3 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [86.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | run_experiment | def run_experiment(config: ExperimentConfig) -> ExperimentResult:# Simulate `grad_input = grad_output @ weight`M, N, K = config.m, config.n, config.kA = torch.randn(M, K, dtype=config.out_dtype, device="cuda")B = torch.randn(N, K, dtype=config.out_dtype, device="cuda")A_q, A_s = triton_fp8_blockwise_act_quant_lhs(A, dt... | 1 | 49 | 1 | 273 | 6 | 76 | 140 | 76 | null | ['B', 'fp8_scaled_mm_us', 'A_s', 'fp8_triton_us', 'bf16_mm_us', 'A'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment) defined within the public class called public.The function start at line 76 and ends at 140. It contains 49 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 = ["M","N","K","out_dtype","bf16_mm_us","fp8_triton_us","fp8_scaled_mm_us","bf16 tflops/sec","triton tflops/sec","scaled_mm tflops/sec",]rows = []for experiment in experiments:m, n, k = experiment.config.m, experiment.config.n, experiment.config.kflops = 2 * m * ... | 2 | 37 | 1 | 180 | 6 | 143 | 179 | 143 | null | ['rows', 'triton_tflops_per_sec', 'flops', 'headers', 'bf16_mm_tflops_per_sec', 'scaled_mm_tflops_per_sec'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (print_results) defined within the public class called public.The function start at line 143 and ends at 179. It contains 37 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(f, *args, **kwargs):return do_bench(lambda: f(*args, **kwargs), return_mode="median") * 1e3 | 1 | 2 | 3 | 31 | 0 | 182 | 183 | 182 | null | [] | 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 182 and ends at 183. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [182.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 | 186 | 195 | 186 | 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 186 and ends at 195. 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_configs | def get_configs() -> List[ExperimentConfig]:mnk_list = [# Llama4 shapes(16640, 5120, 8192),(16640, 8192, 5120),]out_dtypes = [torch.bfloat16]configs = []for mnk, out_dtype in itertools.product(mnk_list, out_dtypes):m, n, k = mnkconfigs.append(ExperimentConfig(out_dtype=out_dtype,m=m,n=n,k=k,))return configs | 2 | 18 | 0 | 87 | 3 | 55 | 73 | 55 | null | ['configs', 'mnk_list', 'out_dtypes'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_configs) defined within the public class called public.The function start at line 55 and ends at 73. 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 | run_experiment.warmup | def warmup(func, *args, **kwargs):for _ in range(10):func(*args, **kwargs) | 2 | 3 | 3 | 27 | 0 | 86 | 88 | 86 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment.warmup) defined within the public class called public.The function start at line 86 and ends at 88. It contains 3 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [86.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | run_experiment | def run_experiment(config: ExperimentConfig) -> ExperimentResult:# Simulate `grad_weight = grad_output_t @ input`M, N, K = config.m, config.n, config.kA = torch.randn(M, N, dtype=config.out_dtype, device="cuda")B = torch.randn(M, K, dtype=config.out_dtype, device="cuda")A_t_q, A_t_s = triton_fp8_blockwise_act_quant_tra... | 1 | 48 | 1 | 258 | 5 | 76 | 137 | 76 | null | ['B', 'fp8_scaled_mm_us', 'fp8_triton_us', 'bf16_mm_us', 'A'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment) defined within the public class called public.The function start at line 76 and ends at 137. It contains 48 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 = ["M","N","K","out_dtype","bf16_mm_us","fp8_triton_us","fp8_scaled_mm_us","bf16 tflops/sec","triton tflops/sec","scaled_mm tflops/sec",]rows = []for experiment in experiments:m, n, k = experiment.config.m, experiment.config.n, experiment.config.kflops = 2 * m * ... | 2 | 37 | 1 | 180 | 6 | 140 | 176 | 140 | null | ['rows', 'triton_tflops_per_sec', 'flops', 'headers', 'bf16_mm_tflops_per_sec', 'scaled_mm_tflops_per_sec'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (print_results) defined within the public class called public.The function start at line 140 and ends at 176. It contains 37 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(f, *args, **kwargs):return do_bench(lambda: f(*args, **kwargs), return_mode="median") * 1e3 | 1 | 2 | 3 | 31 | 0 | 179 | 180 | 179 | null | [] | 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 179 and ends at 180. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [179.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 | 183 | 192 | 183 | 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 183 and ends at 192. 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_configs | def get_configs() -> List[ExperimentConfig]:mnk_list = [# Llama4 shapes(16640, 5120, 8192),(16640, 8192, 5120),]out_dtypes = [torch.bfloat16]configs = []for mnk, out_dtype in itertools.product(mnk_list, out_dtypes):m, n, k = mnkconfigs.append(ExperimentConfig(out_dtype=out_dtype,m=m,n=n,k=k,))return configs | 2 | 18 | 0 | 87 | 3 | 53 | 71 | 53 | null | ['configs', 'mnk_list', 'out_dtypes'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_configs) defined within the public class called public.The function start at line 53 and ends at 71. 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 | run_experiment.warmup | def warmup(func, *args, **kwargs):for _ in range(3):func(*args, **kwargs) | 2 | 3 | 3 | 27 | 0 | 87 | 89 | 87 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment.warmup) defined within the public class called public.The function start at line 87 and ends at 89. It contains 3 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [87.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | run_experiment | def run_experiment(config: ExperimentConfig, profile=False, use_compile=False) -> ExperimentResult:M, N, K = config.m, config.n, config.kinputs = torch.randn(M, K, dtype=config.out_dtype, device="cuda")bf16_linear = torch.nn.Linear(K, N, dtype=config.out_dtype, device="cuda")fp8_triton_linear = Float8BlockwiseLinear(K,... | 4 | 62 | 3 | 276 | 8 | 74 | 145 | 74 | null | ['fp8_scaled_mm_linear', 'fp8_triton_linear_us', 'fp8_triton_linear', 'bf16_linear_us', 'bf16_linear', 'labels', 'fp8_scaled_mm_linear_us', 'inputs'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment) defined within the public class called public.The function start at line 74 and ends at 145. It contains 62 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [74.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | print_results | def print_results(experiments: List[Experiment]):headers = ["M","N","K","out_dtype","bf16_mm_linear_us","fp8_triton_linear_us","fp8_scaled_mm_linear_us",]rows = []for experiment in experiments:m, n, k = experiment.config.m, experiment.config.n, experiment.config.krows.append([m,n,k,experiment.config.out_dtype,experimen... | 2 | 25 | 1 | 108 | 2 | 148 | 172 | 148 | null | ['rows', 'headers'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (print_results) defined within the public class called public.The function start at line 148 and ends at 172. 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(f, *args, **kwargs):return do_bench(lambda: f(*args, **kwargs), return_mode="median") * 1e3 | 1 | 2 | 3 | 31 | 0 | 175 | 176 | 175 | null | [] | 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 175 and ends at 176. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [175.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | main | def main(args: argparse.Namespace):torch.random.manual_seed(123)configs = get_configs()results = []for config in tqdm(configs):result = run_experiment(config, profile=args.profile, use_compile=args.compile)results.append(Experiment(config=config, result=result))# Use Tabulate to print resultsprint_results(results) | 2 | 8 | 1 | 71 | 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 | get_configs | def get_configs() -> List[ExperimentConfig]:# Llama4 shapesM = [16640]K = [2048, 5120, 8192]N = [2048, 5120, 8192]E = [1, 2, 4, 8]configs = []for e, m, n, k in itertools.product(E,M,N,K,):configs.append(ExperimentConfig(e=e,m=m,n=n,k=k,))return configs | 2 | 21 | 0 | 96 | 5 | 51 | 72 | 51 | null | ['configs', 'E', 'N', 'M', 'K'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_configs) defined within the public class called public.The function start at line 51 and ends at 72. It contains 21 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 | run_experiment | def run_experiment(config: ExperimentConfig, args: argparse.Namespace) -> ExperimentResult:e, m, n, k = config.e, config.m, config.n, config.k# define test inputsA = torch.randn((m, k),dtype=torch.bfloat16,device=device,)B_t = torch.randn((e, n, k),dtype=torch.bfloat16,device=device,requires_grad=True,).transpose(-2, -... | 3 | 45 | 2 | 257 | 9 | 75 | 130 | 75 | null | ['alignment_size', 'n_groups', 'fp8_rowwise_us', 'B_t', 'offs', 'mxfp8_us', 'bf16_us', 'Mg', 'A'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment) defined within the public class called public.The function start at line 75 and ends at 130. It contains 45 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [75.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | print_results | def print_results(experiments: List[Experiment]):headers = ["E","M","N","K","bf16_time_us","fp8_rowwise_time_us","mxfp8_time_us","bf16_tflops","fp8_rowwise_tflops","mxfp8_tflops","fp8_rowwise_speedup","mxfp8_speedup",]rows = []for experiment in experiments:# calculate tflopse, m, n, k = (experiment.config.e,experiment.... | 2 | 44 | 1 | 230 | 6 | 133 | 177 | 133 | null | ['rows', 'bf16_tflops', 'fp8_rowwise_tflops', 'flops', 'headers', 'mxfp8_tflops'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (print_results) defined within the public class called public.The function start at line 133 and ends at 177. It contains 44 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 | bench_fp8_rowwise_grouped_mm | def bench_fp8_rowwise_grouped_mm(A, B_t, offs) -> float:# Convert A to float8, row-major for left operand of grouped GEMM.A_scales = tensor_to_scale(A,torch.float8_e4m3fn,scaling_granularity=ScalingGranularity.AXISWISE,axiswise_dim=-1,round_scales_to_power_of_2=True,)A_scaled = A.to(torch.float32) * A_scalesA_fp8_row_m... | 1 | 30 | 3 | 156 | 7 | 181 | 215 | 181 | null | ['A_scaled', 'A_fp8_row_major', 'B_t_fp8_col_major', 'B_t_scales', 'A_scales', 'B_t_scaled', 'fp8_us'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (bench_fp8_rowwise_grouped_mm) defined within the public class called public.The function start at line 181 and ends at 215. It contains 30 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [181.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | bench_mxfp8_grouped_mm | def bench_mxfp8_grouped_mm(A, B_t, offs, block_size=32) -> float:# A_mx shape: (M, K)# A_scale shape: (M, K//block_size)A_scales, A_fp8 = to_mx(A, elem_dtype=torch.float8_e4m3fn, block_size=block_size)# B_mx shape: (E, N, K)# B_scale shape: (E, N, K//block_size)B_scales, B_fp8 = to_mx(B_t.transpose(-2, -1),elem_dtype=t... | 1 | 24 | 4 | 156 | 4 | 218 | 254 | 218 | null | ['group_sizes', 'zero', 'mxfp8_us', 'B_scales_blocked'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (bench_mxfp8_grouped_mm) defined within the public class called public.The function start at line 218 and ends at 254. It contains 24 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [218.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | main | def main(args: argparse.Namespace):torch.random.manual_seed(123)configs = get_configs()results = []for config in tqdm(configs):result = run_experiment(config, args)results.append(Experiment(config=config, result=result))# Use Tabulate to print resultsprint_results(results) | 2 | 8 | 1 | 61 | 3 | 257 | 266 | 257 | 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 257 and ends at 266. 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 | bench_moe_training_fsdp.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 | 96 | 100 | 96 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (bench_moe_training_fsdp.moe_module_filter_fn) defined within the public class called public.The function start at line 96 and ends at 100. It contains 5 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [96.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | bench_moe_training_fsdp.warmup | def warmup(model, input):for _ in range(3):out = model(input)loss = F.mse_loss(out, torch.ones_like(out))loss.backward()torch.cuda.synchronize() | 2 | 6 | 2 | 48 | 0 | 117 | 122 | 117 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (bench_moe_training_fsdp.warmup) defined within the public class called public.The function start at line 117 and ends at 122. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [117.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | bench_moe_training_fsdp | def bench_moe_training_fsdp(recipe_name: str, enable_profile: bool, use_compile: bool):assert torch.cuda.is_available()assert recipe_name in ["fp8_rowwise", "mxfp8"]recipe = MoEScalingType[recipe_name.upper()]if recipe == MoEScalingType.FP8_ROWWISE and torch.cuda.get_device_capability() != (9,0,):logging.warning(f"Skip... | 9 | 72 | 3 | 419 | 16 | 45 | 152 | 45 | null | ['alignment_size', 'config', 'ref_x', 'out', 'scaled_us', 'target_fqns', 'device', 'init_std', 'model', 'ref_model', 'x', 'loss', 'bf16_us', 'labels', 'model_args', 'recipe'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (bench_moe_training_fsdp) defined within the public class called public.The function start at line 45 and ends at 152. It contains 72 lines of code and it has a cyclomatic complexity of 9. It takes 3 parameters, represented as [45.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 | 155 | 159 | 155 | 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 155 and ends at 159. 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 | get_configs | def get_configs() -> List[ExperimentConfig]:MNKG_list = [# Llama4 16e with various experts per device (i.e., different EP degrees)(16384, 8192, 5120, 1),(16384, 8192, 5120, 2),(16384, 8192, 5120, 4),(16384, 8192, 5120, 8),(128000, 8192, 5120, 1),(128000, 8192, 5120, 2),(128000, 8192, 5120, 4),(128000, 8192, 5120, 8),# ... | 2 | 43 | 0 | 316 | 4 | 58 | 103 | 58 | null | ['high_precision_dtypes', 'recipes', 'configs', 'MNKG_list'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_configs) defined within the public class called public.The function start at line 58 and ends at 103. It contains 43 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 | run_experiment | def run_experiment(config: ExperimentConfig, args: argparse.Namespace) -> ExperimentResult:total_M, N, K, G = config.MNKG# define test inputsA = torch.randn((total_M, K),dtype=config.high_precision_dtype,device=device,requires_grad=True,)B_t = torch.randn((G, N, K),dtype=config.high_precision_dtype,device=device,requir... | 4 | 88 | 2 | 403 | 9 | 106 | 209 | 106 | null | ['bf16_fwd_bwd_us', 'token_group_alignment_size', 'scaled_fwd_us', 'bf16_fwd_us', 'B_t', 'offs', 'scaled_fwd_bwd_us', 'labels', 'A'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment) defined within the public class called public.The function start at line 106 and ends at 209. It contains 88 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [106.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | print_results | def print_results(experiments: List[Experiment]):headers = ["M,N,K,G","recipe","bf16_fwd_bwd_us","scaled_fwd_bwd_us","scaled_fwd_bwd_speedup","bf16_fwd_us","scaled_fwd_us","scaled_fwd_speedup",]rows = []for experiment in experiments:rows.append([str(experiment.config.MNKG),experiment.config.recipe,experiment.result.bf1... | 2 | 26 | 1 | 102 | 2 | 212 | 237 | 212 | null | ['rows', 'headers'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (print_results) defined within the public class called public.The function start at line 212 and ends at 237. It contains 26 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 | main | def main(args: argparse.Namespace):torch.random.manual_seed(123)configs = get_configs()results = []for config in tqdm(configs):if (config.recipe == MoEScalingType.FP8_ROWWISEand torch.cuda.get_device_capability() != (9, 0)):logging.warning(f"Skipping FP8 rowwise benchmarks, only supported on compute capability 9.0 and ... | 6 | 24 | 1 | 127 | 3 | 240 | 267 | 240 | 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 240 and ends at 267. It contains 24 lines of code and it has a cyclomatic complexity of 6. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_configs | def get_configs() -> List[ExperimentConfig]:input_shapes = [(16640, 5120)]# (Mg, K)n_groups_list = [1, 16, 64]high_precision_dtypes = [torch.bfloat16]configs = []for input_shape, n_groups, high_precision_dtype in itertools.product(input_shapes, n_groups_list, high_precision_dtypes):configs.append(ExperimentConfig(input... | 2 | 16 | 0 | 78 | 4 | 52 | 67 | 52 | null | ['n_groups_list', 'input_shapes', 'configs', 'high_precision_dtypes'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_configs) defined within the public class called public.The function start at line 52 and ends at 67. It contains 16 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 | run_experiment.warmup | def warmup(func, *args, **kwargs):for _ in range(10):func(*args, **kwargs) | 2 | 3 | 3 | 27 | 0 | 96 | 98 | 96 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment.warmup) defined within the public class called public.The function start at line 96 and ends at 98. It contains 3 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [96.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | run_experiment | def run_experiment(config: ExperimentConfig) -> ExperimentResult:# Define test inputsMg, K = config.input_shape# Column major input tensor.# Right operand in grad_weight = grad_output_t @ inputinput_tensor = (torch.randn(Mg,K,dtype=config.high_precision_dtype,device=device,).transpose(-2, -1).contiguous().transpose(-2,... | 1 | 65 | 1 | 262 | 13 | 70 | 156 | 70 | null | ['triton_time_us', 'torch_to_float8_per_group_colwise_c', 'read_write_bytes', 'read_bytes', 'torch_loop_time_us', 'bytes_per_input_el', 'n_groups', 'write_bytes', 'triton_mem_bw_gbps', 'num_elements', 'input_tensor', 'offs', 'torch_mem_bw_gbps'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment) defined within the public class called public.The function start at line 70 and ends at 156. It contains 65 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 = ["Mg,K","n_groups","high_precision_dtype","torch_loop_time_us","triton_time_us","torch_mem_bw_gbps","triton_mem_bw_gbps","triton_speedup",]rows = []for experiment in experiments:input_shape = (f"({experiment.config.input_shape[0]}, {experiment.config.input_shap... | 2 | 29 | 1 | 114 | 3 | 159 | 187 | 159 | 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 159 and ends at 187. It contains 29 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(f, *args, **kwargs):return do_bench(lambda: f(*args, **kwargs), return_mode="median") * 1e3 | 1 | 2 | 3 | 31 | 0 | 190 | 191 | 190 | null | [] | 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 190 and ends at 191. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [190.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 | 194 | 203 | 194 | 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 194 and ends at 203. 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_configs | def get_configs() -> List[ExperimentConfig]:input_shapes = [(16640, 8192)]# (Mg, N)n_groups_list = [1, 16, 64]high_precision_dtypes = [torch.bfloat16]configs = []for input_shape, n_groups, high_precision_dtype in itertools.product(input_shapes, n_groups_list, high_precision_dtypes):configs.append(ExperimentConfig(input... | 2 | 16 | 0 | 78 | 4 | 55 | 70 | 55 | null | ['n_groups_list', 'input_shapes', 'configs', 'high_precision_dtypes'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_configs) defined within the public class called public.The function start at line 55 and ends at 70. It contains 16 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 | run_experiment.warmup | def warmup(func, *args, **kwargs):for _ in range(10):func(*args, **kwargs) | 2 | 3 | 3 | 27 | 0 | 94 | 96 | 94 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment.warmup) defined within the public class called public.The function start at line 94 and ends at 96. It contains 3 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [94.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | run_experiment.run_triton_transpose_method | def run_triton_transpose_method(grad_out, offs, output_dtype, round_scales_to_power_of_2):# Restride input as column major.# Note this is the transpose of grad_output_t, which is what we are trying to compute per group rowwise scales for.grad_out = grad_out.t().contiguous().t()# Compute per group colwise scales, writin... | 1 | 8 | 4 | 52 | 0 | 132 | 142 | 132 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment.run_triton_transpose_method) defined within the public class called public.The function start at line 132 and ends at 142. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [132.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | run_experiment | def run_experiment(config: ExperimentConfig) -> ExperimentResult:# define test inputsMg, N = config.input_shape# Left operand in grad_weight = grad_output_t @ inputgrad_out = torch.randn(Mg,N,dtype=config.high_precision_dtype,device=device,)grad_out_t = grad_out.transpose(-2, -1)# - configure input to be row-major with... | 1 | 87 | 1 | 334 | 18 | 73 | 196 | 73 | null | ['to_col_major_read_write_bytes', 'triton_time_us', 'triton_transpose_mem_bw_gbps', 'read_write_bytes', 'read_bytes', 'torch_loop_time_us', 'grad_out', 'n_groups', 'bytes_per_input_el', 'write_bytes', 'torch_to_float8_per_group_rowwise_c', 'triton_transpose_us', 'num_elements', 'triton_mem_bw_gbps', 'offs', 'run_triton... | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment) defined within the public class called public.The function start at line 73 and ends at 196. It contains 87 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 = ["Mg,N","n_groups","torch_loop_time_us","triton_time_us","triton_transpose_us","torch_mem_bw_gbps","triton_mem_bw_gbps","triton_transpose_mem_bw_gbps","triton_speedup","triton_transpose_speedup",]rows = []for experiment in experiments:input_shape = (f"({experim... | 2 | 33 | 1 | 132 | 3 | 199 | 231 | 199 | 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 199 and ends at 231. It contains 33 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(f, *args, **kwargs):return do_bench(lambda: f(*args, **kwargs), return_mode="median") * 1e3 | 1 | 2 | 3 | 31 | 0 | 234 | 235 | 234 | null | [] | 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 234 and ends at 235. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [234.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 | 238 | 247 | 238 | 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 238 and ends at 247. 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_configs | def get_configs() -> List[ExperimentConfig]:# Llama4 shapes (E, N, K)input_shapes = [(1, 8192, 5120),# w1, w3(1, 5120, 8192),# w2(16, 8192, 5120),# w1, w3(16, 5120, 8192),# w2(128, 8192, 5120),# w1, w3(128, 5120, 8192),# w2]high_precision_dtypes = [torch.bfloat16]power_of_2_scales = [True]configs = []for input_shape, h... | 2 | 23 | 0 | 117 | 4 | 54 | 77 | 54 | null | ['high_precision_dtypes', 'input_shapes', 'configs', 'power_of_2_scales'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_configs) defined within the public class called public.The function start at line 54 and ends at 77. It contains 23 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 | run_experiment.warmup | def warmup(func, *args, **kwargs):for _ in range(10):func(*args, **kwargs) | 2 | 3 | 3 | 27 | 0 | 88 | 90 | 88 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment.warmup) defined within the public class called public.The function start at line 88 and ends at 90. It contains 3 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [88.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | run_experiment.run_torch | def run_torch(input_tensor: torch.Tensor):out = torch_to_3d_rowwise_float8_transpose_rhs(input_tensor,target_dtype=torch.float8_e4m3fn,round_scales_to_power_of_2=config.power_of_2_scales,)return out | 1 | 7 | 1 | 30 | 0 | 92 | 98 | 92 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment.run_torch) defined within the public class called public.The function start at line 92 and ends at 98. It contains 7 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 | run_experiment.run_triton_atomic | def run_triton_atomic(input_tensor: torch.Tensor):out = triton_fp8_rowwise_3d_transpose_rhs(input_tensor,output_dtype=torch.float8_e4m3fn,round_scales_to_power_of_2=config.power_of_2_scales,)return out | 1 | 7 | 1 | 30 | 0 | 100 | 106 | 100 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment.run_triton_atomic) defined within the public class called public.The function start at line 100 and ends at 106. It contains 7 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 | run_experiment.run_triton_reduction | def run_triton_reduction(input_tensor: torch.Tensor):out = triton_fp8_rowwise_3d_transpose_rhs_fused_reduction(input_tensor,output_dtype=torch.float8_e4m3fn,round_scales_to_power_of_2=config.power_of_2_scales,)return out | 1 | 7 | 1 | 30 | 0 | 108 | 114 | 108 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment.run_triton_reduction) defined within the public class called public.The function start at line 108 and ends at 114. It contains 7 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 | run_experiment | def run_experiment(config: ExperimentConfig) -> ExperimentResult:# Expert weights will be passed in transposed and column major in practiceinput_tensor = torch.randn(*config.input_shape,dtype=config.high_precision_dtype,device=device,).transpose(-2, -1)def warmup(func, *args, **kwargs):for _ in range(10):func(*args, **... | 1 | 48 | 1 | 247 | 16 | 80 | 166 | 80 | null | ['out', 'bytes_per_output_el', 'triton_atomic_mem_bw_gbps', 'run_triton_reduction_c', 'triton_atomic_time_us', 'read_bytes', 'bytes_per_input_el', 'compiled_run_torch', 'write_bytes', 'torch_time_us', 'run_triton_atomic_c', 'num_elements', 'input_tensor', 'triton_reduction_mem_bw_gbps', 'triton_reduction_time_us', 'tor... | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment) defined within the public class called public.The function start at line 80 and ends at 166. It contains 48 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","power_of_2_scales","torch_time_us","triton_atomic_time_us","triton_reduction_time_us","torch_mem_bw_gbps","triton_atomic_mem_bw_gbps","triton_reduction_mem_bw_gbps","triton_atomic_speedup","triton_reduction_speedup",]rows = []for experiment in e... | 2 | 31 | 1 | 130 | 3 | 169 | 199 | 169 | 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 169 and ends at 199. It contains 31 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(f, *args):return do_bench(lambda: f(*args), return_mode="median") * 1e3 | 1 | 2 | 2 | 25 | 0 | 202 | 203 | 202 | null | [] | 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 202 and ends at 203. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [202.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 | 206 | 215 | 206 | 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 206 and ends at 215. 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_configs | def get_configs() -> List[ExperimentConfig]:# (batch_size, seq_len, dim)input_shapes = [(16, 8192, 5120),]configs = []for shape in input_shapes:configs.append(ExperimentConfig(input_shape=shape,))return configs | 2 | 12 | 0 | 44 | 2 | 55 | 67 | 55 | null | ['input_shapes', 'configs'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_configs) defined within the public class called public.The function start at line 55 and ends at 67. It contains 12 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 | default_a2a_fwd_bwd | def default_a2a_fwd_bwd(routed_input: torch.Tensor,labels: torch.Tensor,output_splits_list: list[int],input_splits_list: list[int],device_mesh: DeviceMesh,):routed_input = all_to_all_single_autograd(routed_input,output_splits_list,input_splits_list,device_mesh.get_group(),)routed_input = torch.ops._c10d_functional.wait... | 1 | 18 | 5 | 87 | 2 | 70 | 89 | 70 | null | ['loss', 'routed_input'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (default_a2a_fwd_bwd) defined within the public class called public.The function start at line 70 and ends at 89. It contains 18 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [70.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | mxfp8_a2a_fwd_bwd | def mxfp8_a2a_fwd_bwd(routed_input: torch.Tensor,labels: torch.Tensor,output_splits_list: list[int],input_splits_list: list[int],device_mesh: DeviceMesh,):routed_input = to_mxfp8_a2a_dequant(routed_input,output_splits_list,input_splits_list,device_mesh.get_group(),)loss = F.mse_loss(routed_input, labels)loss.backward()... | 1 | 17 | 5 | 75 | 2 | 92 | 109 | 92 | null | ['loss', 'routed_input'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (mxfp8_a2a_fwd_bwd) defined within the public class called public.The function start at line 92 and ends at 109. It contains 17 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [92.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | run_experiment.warmup | def warmup(func_no_args):for _ in range(2):func_no_args() | 2 | 3 | 1 | 16 | 0 | 135 | 137 | 135 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment.warmup) defined within the public class called public.The function start at line 135 and ends at 137. 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 | run_experiment | def run_experiment(config: ExperimentConfig, args: argparse.Namespace) -> ExperimentResult:batch_size, seq_len, dim = config.input_shapex = torch.randn((batch_size * seq_len, dim),dtype=torch.bfloat16,device=device,requires_grad=True,)ref_x = x.detach().clone().requires_grad_(True)# Set up device meshmesh = init_device... | 3 | 68 | 2 | 316 | 13 | 117 | 199 | 117 | null | ['mesh', 'labels_shape', 'ref_x', 'bf16_ms', 'num_experts_per_rank', 'start_sec', 'input_splits', 'mxfp8_ms', 'x', 'input_tokens_per_rank', 'end_sec', 'labels', 'num_splits'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment) defined within the public class called public.The function start at line 117 and ends at 199. It contains 68 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [117.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | print_results | def print_results(experiments: List[Experiment]):headers = ["input_shape","num_splits","bf16_ms","mxfp8_ms",]rows = []num_splits = dist.get_world_size()for experiment in experiments:rows.append([str(experiment.config.input_shape),num_splits,experiment.result.bf16_ms,experiment.result.mxfp8_ms,])print(tabulate(rows, hea... | 2 | 19 | 1 | 79 | 3 | 202 | 220 | 202 | null | ['rows', 'headers', 'num_splits'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (print_results) defined within the public class called public.The function start at line 202 and ends at 220. It contains 19 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_split_lists | def get_split_lists(num_tokens_per_expert: torch.Tensor, device_mesh: DeviceMesh) -> tuple[list[int], list[int]]:ep_degree = device_mesh.size(0)# generate the input splits and output splits for sync-implsnum_tokens_per_expert_group = all_to_all_single(num_tokens_per_expert,None,None,group=device_mesh.get_group(),)# Nee... | 1 | 26 | 2 | 151 | 6 | 223 | 255 | 223 | null | ['output_splits_list', 'input_splits_list', 'input_splits', 'output_splits', 'ep_degree', 'num_tokens_per_expert_group'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_split_lists) defined within the public class called public.The function start at line 223 and ends at 255. It contains 26 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [223.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | generate_split_sizes | def generate_split_sizes(K: int, N: int, device: str = "cuda") -> torch.Tensor:"""Generates a tensor of K random non-negative integers that sum to N.Used for testing mxfp8_all_to_all_v implementation."""if K <= 0:raise ValueError("K must be a positive integer.")if N < 0:raise ValueError("N must be a non-negative intege... | 4 | 14 | 3 | 160 | 4 | 258 | 285 | 258 | null | ['result', 'boundaries', 'sorted_boundaries', 'dividers'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (generate_split_sizes) defined within the public class called public.The function start at line 258 and ends at 285. It contains 14 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [258.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | main | def main(args: argparse.Namespace):torch.random.manual_seed(123)# Set up process groupsetup_distributed()# Generate experiment configsconfigs = get_configs()results = []for config in tqdm(configs):result = run_experiment(config, args)results.append(Experiment(config=config, result=result))# Use Tabulate to print result... | 2 | 10 | 1 | 69 | 3 | 288 | 305 | 288 | 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 288 and ends at 305. 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 | 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 | 308 | 312 | 308 | 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 308 and ends at 312. 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 | get_configs | def get_configs() -> List[ExperimentConfig]:# Llama4 shapes. Input activations are scaled along K dim.input_shapes = [(1, 8192, 5120),(2, 8192, 5120),(4, 8192, 5120),(8, 8192, 5120),(16, 8192, 5120),(64, 8192, 5120),]configs = []for shape in input_shapes:configs.append(ExperimentConfig(input_shape=shape,))return config... | 2 | 17 | 0 | 84 | 2 | 51 | 68 | 51 | null | ['input_shapes', 'configs'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_configs) defined within the public class called public.The function start at line 51 and ends at 68. It contains 17 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 | run_experiment.using_to_mx | def using_to_mx(x: torch.Tensor) -> torch.Tensor:# Reference implementations_d1_ref, y_d1_ref = to_mx(# Transpose (E,N,K) to (E,K,N) so N is final dim,# since to_mx scales along that dimx.transpose(-2, -1).contiguous(),elem_dtype=torch.float8_e4m3fn,block_size=block_size,)# Transpose tensors and scales back so we have ... | 1 | 9 | 1 | 73 | 0 | 80 | 94 | 80 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment.using_to_mx) defined within the public class called public.The function start at line 80 and ends at 94. It contains 9 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 | run_experiment | def run_experiment(config: ExperimentConfig) -> ExperimentResult:block_size = 32input_shape = config.input_shapeinput_tensor = torch.randn(*input_shape,dtype=torch.bfloat16,device=device,)def using_to_mx(x: torch.Tensor) -> torch.Tensor:# Reference implementations_d1_ref, y_d1_ref = to_mx(# Transpose (E,N,K) to (E,K,N)... | 1 | 45 | 1 | 255 | 18 | 71 | 143 | 71 | null | ['to_mx_time_us', 'cuda_3d_gbps', 'bytes_per_output_el', 'using_cuda_2d_c', 'y_d1_ref', 'time_cuda_2d_us', 'bytes_per_scale_el', 'bytes_per_input_el', 'read_bytes', 'block_size', 's_d1_ref', 'input_shape', 'write_bytes', 'to_mx_gbps', 'time_cuda_3d_us', 'input_tensor', 'cuda_2d_gbps', 'using_to_mx_c'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment) defined within the public class called public.The function start at line 71 and ends at 143. It contains 45 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","to_mx_us","cuda_2d_us","cuda_3d_us","to_mx_gbps","cuda_2d_gbps","cuda_3d_gbps",]rows = []for experiment in experiments:rows.append([str(experiment.config.input_shape),experiment.result.to_mx_us,experiment.result.cuda_2d_us,experiment.result.cuda... | 2 | 24 | 1 | 115 | 2 | 146 | 169 | 146 | null | ['rows', 'headers'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (print_results) defined within the public class called public.The function start at line 146 and ends at 169. It contains 24 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 | 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 | 172 | 181 | 172 | 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 172 and ends at 181. 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_configs | def get_configs() -> List[ExperimentConfig]:# Llama4 shapes. Input activations are scaled along K dim.block_size = 32input_shapes = [(16640, 5120 // block_size),]num_groups = [16]configs = []for shape, groups in itertools.product(input_shapes,num_groups,):configs.append(ExperimentConfig(input_shape=shape,num_groups=gro... | 2 | 18 | 0 | 63 | 4 | 50 | 68 | 50 | null | ['input_shapes', 'configs', 'block_size', 'num_groups'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_configs) defined within the public class called public.The function start at line 50 and ends at 68. 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 | run_experiment | def run_experiment(config: ExperimentConfig) -> ExperimentResult:input_shape, num_groups = config.input_shape, config.num_groupsinput_tensor = torch.randint(low=0,high=256,size=input_shape,dtype=torch.uint8,device=device,)Mg, K = input_shapeinput_group_offsets = generate_jagged_offs(num_groups, Mg, multiple_of=32)_, ou... | 1 | 47 | 1 | 231 | 12 | 71 | 127 | 71 | null | ['triton_time_us', 'bytes_per_output_el', 'read_bytes', 'bytes_per_input_el', 'compiled_run_torch', 'write_bytes', 'triton_out_scales', 'input_group_offsets', 'torch_time_us', 'triton_mem_bw_gbps', 'input_tensor', 'torch_mem_bw_gbps'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment) defined within the public class called public.The function start at line 71 and ends at 127. It contains 47 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","torch_time_us","triton_time_us","torch_mem_bw_gbps","triton_mem_bw_gbps","triton_speedup",]rows = []for experiment in experiments:input_shape = (f"({experiment.config.input_shape[0]}, {experiment.config.input_shape[1]})")rows.append([input_shape... | 2 | 25 | 1 | 98 | 3 | 130 | 154 | 130 | 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 130 and ends at 154. 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 | 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 | 157 | 166 | 157 | 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 157 and ends at 166. 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_configs | def get_configs() -> List[ExperimentConfig]:# Llama4 shapes. Input activations are scaled along K dim.block_size = 32input_shapes = [# w1, w3 scaled along K (fwd)(1, 8192, 5120 // block_size),(2, 8192, 5120 // block_size),(4, 8192, 5120 // block_size),(8, 8192, 5120 // block_size),(16, 8192, 5120 // block_size),# w2 sc... | 2 | 22 | 0 | 109 | 3 | 46 | 70 | 46 | null | ['input_shapes', 'configs', 'block_size'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_configs) defined within the public class called public.The function start at line 46 and ends at 70. It contains 22 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 | run_experiment.warmup | def warmup(fn, *args, **kwargs):for _ in range(5):fn(*args, **kwargs) | 2 | 3 | 3 | 27 | 0 | 82 | 84 | 82 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment.warmup) defined within the public class called public.The function start at line 82 and ends at 84. It contains 3 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [82.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | run_experiment | def run_experiment(config: ExperimentConfig) -> ExperimentResult:input_tensor = torch.randint(low=0,high=256,size=config.input_shape,dtype=torch.uint8,device=device,)def warmup(fn, *args, **kwargs):for _ in range(5):fn(*args, **kwargs)E, N, K = config.input_shape# bench torchcompiled_run_torch = torch.compile(torch_to_... | 1 | 34 | 1 | 195 | 11 | 73 | 119 | 73 | null | ['triton_time_us', 'bytes_per_output_el', 'read_bytes', 'bytes_per_input_el', 'compiled_run_torch', 'write_bytes', 'triton_out_scales', 'torch_time_us', 'triton_mem_bw_gbps', 'input_tensor', 'torch_mem_bw_gbps'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run_experiment) defined within the public class called public.The function start at line 73 and ends at 119. It contains 34 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","torch_time_us","triton_time_us","torch_mem_bw_gbps","triton_mem_bw_gbps","triton_speedup",]rows = []for experiment in experiments:input_shape = f"({experiment.config.input_shape[0]}, {experiment.config.input_shape[1]}, {experiment.config.input_s... | 2 | 23 | 1 | 96 | 3 | 122 | 144 | 122 | 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 122 and ends at 144. It contains 23 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 | 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 | 147 | 156 | 147 | 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 147 and ends at 156. 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 | bench_f | def bench_f(f, *args):return do_bench(lambda: f(*args), return_mode="median") | 1 | 2 | 2 | 23 | 0 | 13 | 14 | 13 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (bench_f) defined within the public class called public.The function start at line 13 and ends at 14. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [13.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | enable_activation_checkpointing | def enable_activation_checkpointing(m: torch.nn.Module):assert not hasattr(m, "_forward")m._forward = m.forwardm.forward = partial(checkpoint, m.forward, use_reentrant=False) | 1 | 4 | 1 | 42 | 0 | 54 | 57 | 54 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (enable_activation_checkpointing) defined within the public class called public.The function start at line 54 and ends at 57. 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 | get_loss | def get_loss(model: Transformer, batch: torch.Tensor):logits = model(batch)[:, :-1].float().flatten(0, 1)labels = batch[:, 1:].flatten()return torch.nn.functional.cross_entropy(logits, labels) | 1 | 4 | 2 | 63 | 2 | 60 | 63 | 60 | null | ['labels', 'logits'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_loss) defined within the public class called public.The function start at line 60 and ends at 63. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [60.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_tinystories | def get_tinystories():save_path = Path("tinystories.bin")if not save_path.exists():import sentencepiece as spmfrom huggingface_hub import hf_hub_downloadtokenizer_path = hf_hub_download("meta-llama/Llama-2-7b", "tokenizer.model")tokenizer = spm.SentencePieceProcessor(tokenizer_path)assert tokenizer.vocab_size() < (1 <<... | 5 | 32 | 0 | 245 | 12 | 66 | 104 | 66 | null | ['chunk', 'tokens', 'chunk_size', 'mmap_tokens', 'tokenizer', 'filepath', 'save_path', 'i', 'tokenizer_path', 'stories', 'tokens_list', 'total_size'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_tinystories) defined within the public class called public.The function start at line 66 and ends at 104. It contains 32 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 | insert_rmsnorm | def insert_rmsnorm(module: torch.nn.Module):for name, child in module.named_children():if isinstance(child, torch.nn.Linear):w = child.weightnorm = RMSNorm(child.in_features).to(device=w.device, dtype=w.dtype)setattr(module, name, torch.nn.Sequential(norm, child))else:insert_rmsnorm(child) | 3 | 8 | 1 | 85 | 0 | 157 | 164 | 157 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (insert_rmsnorm) defined within the public class called public.The function start at line 157 and ends at 164. It contains 8 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters 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.