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 | wait_signal | def wait_signal(addrs, sem: tl.constexpr):if sem == "relaxed":tl.inline_asm_elementwise("""{.reg .u32 %tmp32_<1>;.reg .pred%p<1>;wait_signal:atom.global.sys.relaxed.cas.b32 %tmp32_0, [$1], 1, 0;setp.eq.u32 %p0, %tmp32_0, 1;@!%p0 bra wait_signal;}""","=r, l",[addrs],dtype=tl.int32,is_pure=False,pack=1,)elif sem == "acq_... | 3 | 41 | 2 | 83 | 0 | 62 | 102 | 62 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (wait_signal) defined within the public class called public.The function start at line 62 and ends at 102. It contains 41 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [62.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | blockwise_barrier | def blockwise_barrier(signal_pad_ptrs,block_id,rank: tl.constexpr,world_size: tl.constexpr,sem: tl.constexpr,):"""Synchronizes blocks with matching block_id across participating devices.Note: the function itself is not a system level barrier/fence. It is abuilding block for expressing different synchronization patterns... | 3 | 23 | 5 | 146 | 8 | 106 | 163 | 106 | null | ['signal_pad_ptrs', 'flat_tid', 'local_signal_pad_addr', 'send_addrs', 'remote_ranks', 'block_id', 'remote_signal_pad_addrs', 'wait_addrs'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (blockwise_barrier) defined within the public class called public.The function start at line 106 and ends at 163. It contains 23 lines of code and it has a cyclomatic complexity of 3. It takes 5 parameters, represented as [106.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_flat_bid | def get_flat_bid():return (tl.program_id(2) * tl.num_programs(1) * tl.num_programs(0)+ tl.program_id(1) * tl.num_programs(0)+ tl.program_id(0)) | 1 | 6 | 0 | 48 | 0 | 167 | 172 | 167 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_flat_bid) defined within the public class called public.The function start at line 167 and ends at 172. 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 | get_tid | def get_tid():return tl.inline_asm_elementwise("""mov.u32 $0, %tid.x;mov.u32 $1, %tid.y;mov.u32 $2, %tid.z;""","=r,=r,=r",[],dtype=(tl.uint32, tl.uint32, tl.uint32),is_pure=True,pack=1,) | 1 | 13 | 0 | 41 | 0 | 176 | 188 | 176 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_tid) defined within the public class called public.The function start at line 176 and ends at 188. It contains 13 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_ntid | def get_ntid():return tl.inline_asm_elementwise("""mov.u32 $0, %ntid.x;mov.u32 $1, %ntid.y;mov.u32 $2, %ntid.z;""","=r,=r,=r",[],dtype=(tl.uint32, tl.uint32, tl.uint32),is_pure=True,pack=1,) | 1 | 13 | 0 | 41 | 0 | 192 | 204 | 192 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_ntid) defined within the public class called public.The function start at line 192 and ends at 204. It contains 13 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_flat_tid | def get_flat_tid():tid_x, tid_y, tid_z = get_tid()ntid_x, ntid_y, _ = get_ntid()return tid_z * ntid_y * ntid_x + tid_y * ntid_x + tid_x | 1 | 4 | 0 | 34 | 0 | 208 | 211 | 208 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_flat_tid) defined within the public class called public.The function start at line 208 and ends at 211. 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(ctx,input: torch.Tensor,input_splits: torch.Tensor,max_output_rows_per_rank: int,group: dist.ProcessGroup = dist.group.WORLD,):"""Args:input: input float8_e4m3fn tensor with data for all ranks concatenated.input_scales: float8_e8m0fnu scales for the input tensor.input_splits: input splits of shape (group.wo... | 5 | 81 | 5 | 440 | 0 | 49 | 164 | 49 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 49 and ends at 164. It contains 81 lines of code and it has a cyclomatic complexity of 5. It takes 5 parameters, represented as [49.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | backward | def backward(ctx, grad_output, grad_splits):"""Backward is implemented as a shuffle of the output's gradients to the input.Args:`grad_output`: output's gradients passed from the downstream.`grad_splits`: unused."""# In backward, mxfp8_all_to_all_v input is `grad_output`, and output is `grad_input`.grad_output_splits = ... | 5 | 62 | 3 | 335 | 0 | 168 | 255 | 168 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (backward) defined within the public class called public.The function start at line 168 and ends at 255. It contains 62 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [168.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _mxfp8_on_device_all_to_all_v | def _mxfp8_on_device_all_to_all_v(input: torch.Tensor,input_scales: torch.Tensor,input_splits: torch.Tensor,output: torch.Tensor,output_scales: torch.Tensor,output_splits: torch.Tensor,group: dist.ProcessGroup = dist.group.WORLD,BLOCKS_PER_REMOTE_RANK: int = 32,BLOCK_SIZE: int = 16384,):assert input.dim() == 2, f"{inpu... | 1 | 41 | 9 | 240 | 10 | 263 | 311 | 263 | null | ['num_blocks', 'input_scales_ptrs', 'input_splits_ptrs', 'signal_pad_ptrs', 'dim_scaling_groups', 'input_hdl', 'dim', 'input_ptrs', 'input_scales_hdl', 'input_splits_hdl'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_mxfp8_on_device_all_to_all_v) defined within the public class called public.The function start at line 263 and ends at 311. It contains 41 lines of code and it has a cyclomatic complexity of 1. It takes 9 parameters, represented as [263.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _mxfp8_all_to_all_v_kernel | def _mxfp8_all_to_all_v_kernel(input_ptrs,input_scales_ptrs,input_splits_ptr,output_ptr,output_scales_ptr,output_splits_ptr,signal_pad_ptrs,dim: tl.constexpr,dim_scaling_groups: tl.constexpr,rank: tl.constexpr,world_size: tl.constexpr,BLOCKS_PER_REMOTE_RANK: tl.constexpr,BLOCK_SIZE: tl.constexpr,):blockwise_barrier(sig... | 4 | 60 | 13 | 390 | 13 | 315 | 400 | 315 | null | ['output_ptr', 'block_offset', 'num_input_scale_blocks', 'total_input_scales_to_read', 'mask', 'num_input_blocks', 'offs', 'total_input_elems_to_read', 'output_scale_ptr', 'remote_rank', 'data', 'input_scale_ptr', 'input_ptr'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_mxfp8_all_to_all_v_kernel) defined within the public class called public.The function start at line 315 and ends at 400. It contains 60 lines of code and it has a cyclomatic complexity of 4. It takes 13 parameters, represented as [315.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _exchange_row_offsets | def _exchange_row_offsets(split_sizes_ptrs,local_rank: tl.constexpr,remote_rank: tl.constexpr,world_size: tl.constexpr,):"""Returns:- `input_offset_for_remote_rank`:- `output_offset_for_remote_rank`:- `num_rows`:"""# split_sizes_ptr points to 2d tensor of stacked input split size vectors (one per rank). Example:# rank ... | 1 | 25 | 4 | 169 | 10 | 404 | 457 | 404 | null | ['input_offset_for_remote_rank', 'output_offset_for_remote_rank', 'output_split_sizes_ptrs', 'split_sizes_ptrs', 'offsets', 'output_split_sizes', 'remote_rank_input_splits_ptr', 'ptr_to_each_rank_split_sizes', 'remote_split_sizes_prefix', 'num_rows_to_read'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_exchange_row_offsets) defined within the public class called public.The function start at line 404 and ends at 457. It contains 25 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [404.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | forward | def forward(ctx,input: torch.Tensor,output_splits: list[int],input_splits: list[int],group: dist.ProcessGroup = dist.group.WORLD,):"""Dynamically quantizes input to mxfp8, performs all-to-all, then dequantizes output back to original precision.Requires d2h sync to get input_splits and output_splits on host, as required... | 1 | 41 | 5 | 185 | 0 | 462 | 517 | 462 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (forward) defined within the public class called public.The function start at line 462 and ends at 517. It contains 41 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [462.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | backward | def backward(ctx, grad_output_hp):"""Backward is implemented as a shuffle of the output's gradients to the input.Args:`grad_output_hp`: high precision output gradient passed from upstream"""# In backward, mxfp8_all_to_all_v input is `grad_output`, and output is `grad_input`.# Input splits are the output splits from for... | 1 | 33 | 2 | 160 | 0 | 520 | 568 | 520 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (backward) defined within the public class called public.The function start at line 520 and ends at 568. It contains 33 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [520.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | torch_to_blocked_2d_M_groups | def torch_to_blocked_2d_M_groups(x_scales: Tensor, group_offs: Tensor, K: int, block_size: int = 32) -> Tuple[Tensor, Tensor]:"""Convert scales to blocked format for a 2D tensor (input activations / token groups),where groups are along the total_M dimension (rows).Args:x_scales: Tensor with per group scales in blocked ... | 3 | 34 | 4 | 215 | 14 | 17 | 78 | 17 | null | ['scaling_groups_per_row', 'group_scales', 'group_start_idx', 'rows_for_group', 'start_row_after_padding', 'group_size', 'prev_start_row_after_padding', 'group_rows_padded', 'group_scales_blocked', 'num_groups', 'new_start_row', 'total_M_padded', 'blocked_scales', 'start_row_after_padding_list'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (torch_to_blocked_2d_M_groups) defined within the public class called public.The function start at line 17 and ends at 78. It contains 34 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [17.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | torch_to_blocked_2d_K_groups | def torch_to_blocked_2d_K_groups(x_scales: Tensor, group_offs: Tensor, block_size: int = 32) -> Tuple[Tensor, Tensor]:"""Convert scales to blocked format for a 2D tensor (input activations),when groups are along the scaled (K) dimension.Args:x_scales: Tensor with per group scales in blocked format concatenated into one... | 3 | 33 | 3 | 211 | 13 | 81 | 140 | 81 | null | ['padded_M', 'group_scales', 'cols_after_padding', 'group_start_idx', 'prev_start_col_after_padding', 'group_size', 'group_scales_blocked', 'total_K_padded', 'start_col_after_padding_list', 'new_start_col', 'blocked_scales', 'start_cols_after_padding', 'num_groups'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (torch_to_blocked_2d_K_groups) defined within the public class called public.The function start at line 81 and ends at 140. It contains 33 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [81.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | torch_to_blocked_per_group_3d | def torch_to_blocked_per_group_3d(weight_scales: Tensor) -> Tensor:"""Convert scales to blocked format for each group for a 3D tensor (expert weights)Args:scales: Tensor of shape (E, N, K//block_size)group_offs: Tensor of shape (num_groups,) which contains the end index of each group along the"""blocked_scales_list = [... | 2 | 10 | 1 | 77 | 5 | 143 | 160 | 143 | null | ['group_scales', 'group_scales_blocked', 'blocked_scales_list', 'weight_scales_blocked', 'num_groups'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (torch_to_blocked_per_group_3d) defined within the public class called public.The function start at line 143 and ends at 160. 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 | compute_blocked_scale_offsets_for_M_groups | def compute_blocked_scale_offsets_for_M_groups(offsets: torch.Tensor):"""Given a 1D tensor of input group offsets along the total_M dimension (rows),compute the starting row offset of the scales for each group after padding to blocked format.In effect, this rrounds each integer in a 1D PyTorch tensor up to the nearest ... | 1 | 7 | 1 | 82 | 4 | 163 | 189 | 163 | null | ['group_sizes', 'zero', 'rounded_group_sizes', 'starting_row_after_padding'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (compute_blocked_scale_offsets_for_M_groups) defined within the public class called public.The function start at line 163 and ends at 189. 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 | compute_blocked_scale_offsets_for_K_groups | def compute_blocked_scale_offsets_for_K_groups(scale_group_offsets: torch.Tensor, block_size: int = 32):"""Performs round_up(x, 4) on each element in a 1D offsets tensor,to compute the starting offsets of each group after scaling along the contraction dimension.Args:offsets: A 1D PyTorch tensor of integers in ascending... | 1 | 11 | 2 | 88 | 4 | 192 | 219 | 192 | null | ['group_sizes', 'starting_col_after_padding', 'zero', 'rounded_group_sizes'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (compute_blocked_scale_offsets_for_K_groups) defined within the public class called public.The function start at line 192 and ends at 219. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [192.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | triton_mx_block_rearrange_2d_M_groups | def triton_mx_block_rearrange_2d_M_groups(scales_tensor: torch.Tensor,input_group_end_offsets: torch.Tensor,output_group_start_offsets: torch.Tensor,) -> torch.Tensor:"""Rearranges an E8M0 tensor scale to block-scaled swizzle format,where groups are along the total_M dimension (rows).This format is suitable for Tmem as... | 1 | 41 | 3 | 200 | 8 | 223 | 290 | 223 | null | ['padded_cols', 'output', 'output_stride_per_block', 'num_col_blocks', 'padded_rows', 'output_stride_per_row_of_blocks', 'grid', 'num_groups'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_mx_block_rearrange_2d_M_groups) defined within the public class called public.The function start at line 223 and ends at 290. It contains 41 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 | triton_scale_swizzle_M_groups | def triton_scale_swizzle_M_groups(scales_ptr,# (M, K//block_size)scales_stride_dim0,scales_stride_dim1,scale_rows,scale_cols,num_groups,orig_offsets,# (num_groups,)output_scales_ptr,output_scales_stride_dim0,output_scales_group_offsets,# (num_groups,)output_stride_per_block,output_stride_per_row_of_blocks,BLOCK_ROWS: t... | 2 | 57 | 14 | 284 | 17 | 294 | 366 | 294 | null | ['block_row_id', 'input_scales', 'scales_flat', 'block_col_offs', 'input_group_end_row', 'block_row_offs', 'dest_indices_flat', 'block_col_pid', 'current_start_row', 'mask', 'group_pid', 'output_block_offsets', 'output_group_start_row', 'row_offs', 'col_offs', 'block_offs', 'input_group_start_row'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_scale_swizzle_M_groups) defined within the public class called public.The function start at line 294 and ends at 366. It contains 57 lines of code and it has a cyclomatic complexity of 2. It takes 14 parameters, represented as [294.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | triton_mx_block_rearrange_per_group_3d | def triton_mx_block_rearrange_per_group_3d(scale_tensor: torch.Tensor) -> torch.Tensor:"""Rearranges an E8M0 tensor scale to block-scaled swizzle format.This format is suitable for Tmem as described in NVIDIA documentation:https://docs.nvidia.com/cuda/cublas/index.html#d-block-scaling-factors-layoutArgs:scale_tensor: I... | 1 | 36 | 1 | 199 | 11 | 370 | 427 | 370 | null | ['padded_cols', 'output', 'input_stride_dim2', 'output_stride_dim0', 'num_row_blocks', 'input_stride_dim1', 'num_col_blocks', 'padded_rows', 'grid', 'input_stride_dim0', 'output_block_stride'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_mx_block_rearrange_per_group_3d) defined within the public class called public.The function start at line 370 and ends at 427. It contains 36 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 | triton_scale_swizzle_per_group_3d | def triton_scale_swizzle_per_group_3d(input_ptr,input_stride_dim0,input_stride_dim1,input_stride_dim2,output_ptr,output_stride_dim0,output_block_stride,scale_rows,scale_cols,BLOCK_ROWS: tl.constexpr,BLOCK_COLS: tl.constexpr,):pid_group = tl.program_id(0)pid_row = tl.program_id(1)pid_col = tl.program_id(2)# Update base ... | 1 | 43 | 11 | 218 | 15 | 431 | 485 | 431 | null | ['input_scales', 'global_cols', 'scales_flat', 'block_offset', 'pid_col', 'LOCAL_NUMEL', 'start_col', 'dest_indices_flat', 'start_row', 'pid_row', 'global_rows', 'pid_group', 'mask', 'row_offs', 'col_offs'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_scale_swizzle_per_group_3d) defined within the public class called public.The function start at line 431 and ends at 485. It contains 43 lines of code and it has a cyclomatic complexity of 1. It takes 11 parameters, represented as [431.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | triton_mx_block_rearrange_2d_K_groups | def triton_mx_block_rearrange_2d_K_groups(scales_tensor: torch.Tensor,input_group_end_offsets: torch.Tensor,output_group_start_offsets: torch.Tensor,) -> torch.Tensor:"""Rearranges an E8M0 tensor scale to block-scaled swizzle format on a per group basis,where the groups are along the contraction dimension of the GEMM.T... | 1 | 38 | 3 | 186 | 7 | 489 | 552 | 489 | null | ['padded_cols', 'output', 'num_row_blocks', 'output_stride_per_block', 'padded_rows', 'grid', 'num_groups'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_mx_block_rearrange_2d_K_groups) defined within the public class called public.The function start at line 489 and ends at 552. It contains 38 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [489.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | triton_scale_swizzle_2d_K_groups | def triton_scale_swizzle_2d_K_groups(scales_ptr,# (M, total_K//block_size)scales_stride_dim0,scales_stride_dim1,scale_rows,scale_cols,padded_rows,num_groups,orig_offsets,# (num_groups,)output_scales_ptr,output_scales_group_offsets,# (num_groups,)output_stride_per_block,BLOCK_ROWS: tl.constexpr,BLOCK_COLS: tl.constexpr,... | 2 | 59 | 14 | 294 | 22 | 556 | 631 | 556 | null | ['curr_out_start_col_block', 'stride_per_row_of_blocks_in_group', 'block_row_offs', 'out_group_base_offset', 'num_col_blocks_in_group', 'mask', 'group_pid', 'block_offs', 'num_cols_in_group', 'dest_indices_flat', 'curr_input_start_col', 'input_group_end_col', 'input_scales', 'block_row_pid', 'col_offs', 'output_group_s... | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_scale_swizzle_2d_K_groups) defined within the public class called public.The function start at line 556 and ends at 631. It contains 59 lines of code and it has a cyclomatic complexity of 2. It takes 14 parameters, represented as [556.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _dest_indices_for_block | def _dest_indices_for_block(row_offs,col_offs,BLOCK_ROWS: tl.constexpr,BLOCK_COLS: tl.constexpr,):# Calculate destination indices for each row and col in block swizzled layout.# We can reuse this swizzle transformation on each block of data we read.r_div_32 = row_offs // 32r_mod_32 = row_offs % 32# Rearrange to (32, 4,... | 1 | 11 | 4 | 56 | 4 | 635 | 651 | 635 | null | ['r_mod_32', 'r_div_32', 'dest_indices', 'dest_indices_flat'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_dest_indices_for_block) defined within the public class called public.The function start at line 635 and ends at 651. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [635.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | mxfp8_quantize_cuda_3d | def mxfp8_quantize_cuda_3d(x: torch.Tensor,block_size: int = 32,scaling_mode: str = "floor",) -> Tuple[torch.Tensor, torch.Tensor]:"""Quantizes a 3D tensor of shape (E,N,K) to MXFP8 format, scaling along N.Args:x (torch.Tensor): Input tensor to be quantized.block_size (int, optional): Block size for quantization. Defau... | 1 | 13 | 3 | 82 | 0 | 672 | 696 | 672 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (mxfp8_quantize_cuda_3d) defined within the public class called public.The function start at line 672 and ends at 696. It contains 13 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [672.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _fake_mxfp8_quantize_cuda_3d | def _fake_mxfp8_quantize_cuda_3d(x: torch.Tensor,block_size: int = 32,scaling_mode: str = "floor",) -> Tuple[torch.Tensor, torch.Tensor]:assert x.ndim == 3, "Input tensor must be 3D"assert x.dtype in (torch.float32, torch.bfloat16), ("Input tensor must be float32 or bfloat16")E, N, K = x.shape# Quantized tensor is in c... | 1 | 15 | 3 | 116 | 0 | 699 | 714 | 699 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_fake_mxfp8_quantize_cuda_3d) defined within the public class called public.The function start at line 699 and ends at 714. It contains 15 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [699.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | mxfp8_quantize_cuda_3d | def mxfp8_quantize_cuda_3d(x: torch.Tensor,block_size: int = 32,scaling_mode: str = "floor",) -> Tuple[torch.Tensor, torch.Tensor]:raise NotImplementedError("mxfp8_quantize_cuda_3d is not implemented on this device") | 1 | 8 | 3 | 38 | 0 | 718 | 725 | 718 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (mxfp8_quantize_cuda_3d) defined within the public class called public.The function start at line 718 and ends at 725. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [718.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _validate_elem_dtype | def _validate_elem_dtype(elem_dtype):assert elem_dtype in SUPPORTED_ELEM_DTYPES, (f"elem_dtype: expected one of {SUPPORTED_ELEM_DTYPES}, got {elem_dtype}") | 1 | 4 | 1 | 14 | 0 | 82 | 85 | 82 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_validate_elem_dtype) defined within the public class called public.The function start at line 82 and ends at 85. 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 | _validate_gemm_kernel_choice | def _validate_gemm_kernel_choice(gemm_kernel_choice, block_size, elem_dtype):if gemm_kernel_choice == MXGemmKernelChoice.CUTLASS:assert block_size == 32, (f"block_size must be 32 to use the CUTLASS MX gemm kernels, got {block_size}")valid_dtypes = [torch.float8_e4m3fn, torch.float4_e2m1fn_x2]assert elem_dtype in valid_... | 3 | 17 | 3 | 85 | 1 | 88 | 104 | 88 | null | ['valid_dtypes'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_validate_gemm_kernel_choice) defined within the public class called public.The function start at line 88 and ends at 104. It contains 17 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [88.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _validate_mxfp8_cast_kernel_choice | def _validate_mxfp8_cast_kernel_choice(mxfp8_cast_kernel_choice, scale_calculation_mode):if mxfp8_cast_kernel_choice == MXFP8Dim1CastKernelChoice.TRITON:assert scale_calculation_mode == ScaleCalculationMode.FLOOR, (f"unsupported ScaleCalculationMode value {scale_calculation_mode} for dim1 triton cast")elif mxfp8_cast_k... | 3 | 14 | 2 | 50 | 0 | 107 | 120 | 107 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_validate_mxfp8_cast_kernel_choice) defined within the public class called public.The function start at line 107 and ends at 120. It contains 14 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [107.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __post_init__ | def __post_init__(self):_validate_elem_dtype(self.elem_dtype)_validate_gemm_kernel_choice(self.gemm_kernel_choice, self.block_size, self.elem_dtype)if self.elem_dtype_weight_override is not None:_validate_elem_dtype(self.elem_dtype_weight_override)assert self.gemm_kernel_choice == MXGemmKernelChoice.EMULATED, "unsuppor... | 3 | 14 | 1 | 83 | 0 | 151 | 164 | 151 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__post_init__) defined within the public class called public.The function start at line 151 and ends at 164. It contains 14 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | from_recipe_name | def from_recipe_name(recipe_name: Union[MXLinearRecipeName, str],) -> "MXLinearConfig":"""Input: `MXLinearRecipeName` value, or a string representing a `MXLinearRecipeName` valueOutput: a `MXLinearConfig` configured to implement the specified recipe"""if type(recipe_name) == str:valid_names = [n.value for n in MXLinear... | 8 | 31 | 1 | 160 | 0 | 167 | 202 | 167 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (from_recipe_name) defined within the public class called public.The function start at line 167 and ends at 202. It contains 31 lines of code and it has a cyclomatic complexity of 8. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | short_str | def short_str(self) -> str:"""Returns a concise representation of the current config."""s = f"bl_sz={self.block_size}, lp_dtype={DTYPE_TO_SHORT_STR[self.elem_dtype]}"if self.elem_dtype_weight_override is not None:s += (f", lp_w_override={DTYPE_TO_SHORT_STR[self.elem_dtype_weight_override]}")if self.elem_dtype_grad_outp... | 4 | 13 | 1 | 61 | 0 | 204 | 219 | 204 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (short_str) defined within the public class called public.The function start at line 204 and ends at 219. It contains 13 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _assert_equals | def _assert_equals(fp_ref, s_enc_ref, e_enc_ref, m_enc_ref, dtype):# test going from float to encodingx = torch.tensor(fp_ref, dtype=dtype)bitwidth = dtype_to_bitwidth[dtype]s_enc, e_enc, m_enc = get_sem_bits(x, bitwidth=bitwidth)assert s_enc_ref == s_encassert e_enc_ref == e_enc, f"{e_enc_ref} != {e_enc}"assert m_enc_... | 1 | 15 | 5 | 100 | 3 | 331 | 348 | 331 | null | ['x', 'fp', 'bitwidth'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_assert_equals) defined within the public class called public.The function start at line 331 and ends at 348. It contains 15 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [331.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_sem_bits | def get_sem_bits(x: torch.Tensor, bitwidth: int) -> Tuple[str, str, str]:"""Input: a tensor with a single element of the target element dtype- for PT core dtypes, that dtype (fp32, fp16, fp8_e4m3, etc)- for fp4_e2m1, fp6_e3m2, fp6_e2m3, not supported in this functionOutput: bit strings for sign, exponent, mantissa enco... | 2 | 23 | 2 | 176 | 4 | 351 | 381 | 351 | null | ['x', 'np_res', 'new_dtype', 'offset'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_sem_bits) defined within the public class called public.The function start at line 351 and ends at 381. It contains 23 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [351.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | exp_encoding_to_exp | def exp_encoding_to_exp(exp_bit_str: str, dtype):"""Input: bit string of exponent for dtypeOutput: integer representation of exponent"""exp_biased = int(exp_bit_str, 2)exp_bias = dtype_to_exp_bias[dtype]exp_unbiased = exp_biased - exp_bias# for denormalized values, increment exponent back# up by oneif all(b == "0" for ... | 3 | 7 | 2 | 46 | 3 | 384 | 398 | 384 | null | ['exp_unbiased', 'exp_biased', 'exp_bias'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (exp_encoding_to_exp) defined within the public class called public.The function start at line 384 and ends at 398. It contains 7 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [384.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | sem_bits_to_sem_vals | def sem_bits_to_sem_vals(s_enc, e_enc, m_enc, dtype):"""Input: encodings of sign, exponent, mantissa for dtypeOutput: integer sign, integer exponent, float32 mantissa, special valueSupported dtypes: PT core dtypes and fp6_e3m2 and fp6_e2m3Not supported dtypes: fp4If special value is filled out, sem are noneIf sem are f... | 18 | 35 | 4 | 259 | 8 | 401 | 454 | 401 | null | ['is_denormal', 'is_normal', 'mantissa', 'cur_pow_2', 'is_zero', 'exponent', 'sign', 'dtypes'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (sem_bits_to_sem_vals) defined within the public class called public.The function start at line 401 and ends at 454. It contains 35 lines of code and it has a cyclomatic complexity of 18. It takes 4 parameters, represented as [401.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | sem_vals_to_f32 | def sem_vals_to_f32(s_i, e_i, m_f, special_value):"""Input: integer sign, integer exponent, float32 mantissa, special valueOutput: float32 value"""if special_value is not None:return special_valuef = s_i * pow(2, e_i) * m_freturn f | 2 | 5 | 4 | 34 | 1 | 457 | 465 | 457 | null | ['f'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (sem_vals_to_f32) defined within the public class called public.The function start at line 457 and ends at 465. It contains 5 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [457.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | sem_vals_to_formula | def sem_vals_to_formula(s_i, e_i, m_f, special_value):"""Input: integer sign, integer exponent, float32 mantissa, special valueOutput: formula to get the float32 value"""if special_value is not None:return special_valuereturn f"{s_i} * 2^{e_i} * {m_f}" | 2 | 4 | 4 | 23 | 0 | 468 | 475 | 468 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (sem_vals_to_formula) defined within the public class called public.The function start at line 468 and ends at 475. It contains 4 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [468.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | assert_same | def assert_same(fp1, fp2):if math.isnan(fp1):assert math.isnan(fp2)elif math.isinf(fp1):if fp1 > 0:assert math.isinf(fp2) and fp2 > 0else:assert math.isinf(fp2) and fp2 < 0else:assert (abs(fp2 - fp1) / (fp1 + 1e-20)) - 1 < 1e-12, f"{fp2} != {fp1}" | 6 | 10 | 2 | 87 | 0 | 478 | 487 | 478 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (assert_same) defined within the public class called public.The function start at line 478 and ends at 487. It contains 10 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [478.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | run | def run(dtype):print("dtype", dtype)headers = ["orig_val", "formula", "s_enc", "e_enc", "m_enc", "note"]results = []if dtype == torch.float4_e2m1fn_x2:results = float4_e2m1_interesting_valueselif dtype == DTYPE_FP6_E3M2:results = float6_e3m2_interesting_valueselif dtype == DTYPE_FP6_E2M3:results = float6_e2m3_interesti... | 5 | 31 | 1 | 158 | 4 | 490 | 529 | 490 | null | ['results', 'headers', 'interesting_values', 'formula'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (run) defined within the public class called public.The function start at line 490 and ends at 529. It contains 31 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 | __post_init__ | def __post_init__(self):assert self.activation_dtype == self.weight_dtype, ("For now - we only support matching input/weight dtypes.")_validate_elem_dtype(self.activation_dtype)_validate_elem_dtype(self.weight_dtype)_validate_gemm_kernel_choice(self.gemm_kernel_choice, self.block_size, self.weight_dtype) | 1 | 9 | 1 | 43 | 0 | 85 | 93 | 85 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__post_init__) defined within the public class called public.The function start at line 85 and ends at 93. 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 | _linear_extra_repr | def _linear_extra_repr(self):return f"in_features={self.weight.shape[1]}, out_features={self.weight.shape[0]}, weight={_quantization_type(self.weight)}" | 1 | 2 | 1 | 8 | 0 | 96 | 97 | 96 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_linear_extra_repr) defined within the public class called public.The function start at line 96 and ends at 97. 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 | _mx_inference_linear_transform | def _mx_inference_linear_transform(module: torch.nn.Module, config: MXFPInferenceConfig):weight = module.weightassert weight.dtype == torch.bfloat16, (f"Only supporting bf16 out dtype for now, got {weight.dtype}")act_quant_kwargs = QuantizeTensorToMXKwargs(elem_dtype=config.activation_dtype,block_size=config.block_size... | 1 | 24 | 2 | 123 | 3 | 101 | 128 | 101 | null | ['quantized_weight', 'weight', 'act_quant_kwargs'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_mx_inference_linear_transform) defined within the public class called public.The function start at line 101 and ends at 128. It contains 24 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [101.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | __post_init__ | def __post_init__(self):# Validate PyTorch versionif not torch_version_at_least("2.8.0"):raise RuntimeError("NVFP4InferenceConfig requires PyTorch 2.8 or later") | 2 | 3 | 1 | 17 | 0 | 153 | 156 | 153 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__post_init__) defined within the public class called public.The function start at line 153 and ends at 156. 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 | _nvfp4_inference_linear_transform | def _nvfp4_inference_linear_transform(module: torch.nn.Linear, config: NVFP4InferenceConfig):"""Quantization handler for NVFP4InferenceConfig"""if config.mm_config == NVFP4MMConfig.DYNAMIC:assert is_sm_at_least_100(), ("NVFP4 DYNAMIC mode is only supported on sm100+ machines")weight = module.weightif weight.shape[0] % ... | 8 | 37 | 2 | 201 | 5 | 160 | 204 | 160 | null | ['tensor_amax', 'per_tensor_scale', 'quantized_weight', 'weight', 'act_quant_kwargs'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_nvfp4_inference_linear_transform) defined within the public class called public.The function start at line 160 and ends at 204. It contains 37 lines of code and it has a cyclomatic complexity of 8. It takes 2 parameters, represented as [160.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _auto_filter_for_nfp4 | def _auto_filter_for_nfp4(mod: nn.Module, fqn: str) -> bool:"""Generic Filter fn for NVFP4 that is best practice for most models."""# Define any FQNs you want to exclude directly in the functionfilter_fqns = ["embedder", "embed", "embedding", "time_text_embed"]# Only support Linear modulesif not isinstance(mod, nn.Line... | 9 | 18 | 2 | 113 | 3 | 222 | 250 | 222 | null | ['dims_multiples_of_16', 'filter_fqns', 'is_filtered_fqn'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_auto_filter_for_nfp4) defined within the public class called public.The function start at line 222 and ends at 250. It contains 18 lines of code and it has a cyclomatic complexity of 9. It takes 2 parameters, represented as [222.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | get_bits | def get_bits(x: torch.Tensor) -> str:bits_per_byte = 8# Numpy has a nice function to get the string representation of binary.# Since we are using ints as views of floats, need to specify the width# to avoid numpy from using two's complement for negative numbers.return np.binary_repr(x.cpu().numpy(), width=x.element_siz... | 1 | 3 | 1 | 39 | 1 | 42 | 47 | 42 | null | ['bits_per_byte'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_bits) defined within the public class called public.The function start at line 42 and ends at 47. 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 | f32_to_f4_unpacked | def f32_to_f4_unpacked(x):"""Input: torch.Tensor of dtype torch.floatOutput: torch.Tensor of dtype torch.uint8, with bits 0-3 empty andbits 4-7 in fp4_e2m1"""return _f32_to_floatx_unpacked(x, EBITS_F4_E2M1, MBITS_F4_E2M1) | 1 | 2 | 1 | 15 | 0 | 68 | 74 | 68 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (f32_to_f4_unpacked) defined within the public class called public.The function start at line 68 and ends at 74. 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 | f32_to_f6_e2m3_unpacked | def f32_to_f6_e2m3_unpacked(x):"""Input: torch.Tensor of dtype torch.floatOutput: torch.Tensor of dtype torch.uint8, with bits 0-1 empty andbits 2-7 in fp6_e2m3"""return _f32_to_floatx_unpacked(x, EBITS_F6_E2M3, MBITS_F6_E2M3) | 1 | 2 | 1 | 15 | 0 | 77 | 83 | 77 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (f32_to_f6_e2m3_unpacked) defined within the public class called public.The function start at line 77 and ends at 83. 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 | f32_to_f6_e3m2_unpacked | def f32_to_f6_e3m2_unpacked(x):"""Input: torch.Tensor of dtype torch.floatOutput: torch.Tensor of dtype torch.uint8, with bits 0-1 empty andbits 2-7 in fp6_e3m2"""return _f32_to_floatx_unpacked(x, EBITS_F6_E3M2, MBITS_F6_E3M2) | 1 | 2 | 1 | 15 | 0 | 86 | 92 | 86 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (f32_to_f6_e3m2_unpacked) defined within the public class called public.The function start at line 86 and ends at 92. 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 | f4_unpacked_to_f32 | def f4_unpacked_to_f32(x: torch.Tensor):"""Input: torch.Tensor of dtype uint8, with bits 0-3 empty and bits 4-7containing an fp4_e2m1 encodingOutput: torch.Tensor of dtype fp32 with the dequantized value"""return _floatx_unpacked_to_f32(x, EBITS_F4_E2M1, MBITS_F4_E2M1) | 1 | 2 | 1 | 19 | 0 | 95 | 101 | 95 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (f4_unpacked_to_f32) defined within the public class called public.The function start at line 95 and ends at 101. 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 | f6_e2m3_unpacked_to_f32 | def f6_e2m3_unpacked_to_f32(x: torch.Tensor):"""Input: torch.Tensor of dtype uint8, with bits 0-1 empty and bits 2-7containing an fp6_e3m2 encodingOutput: torch.Tensor of dtype fp32 with the dequantized value"""return _floatx_unpacked_to_f32(x, EBITS_F6_E2M3, MBITS_F6_E2M3) | 1 | 2 | 1 | 19 | 0 | 104 | 110 | 104 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (f6_e2m3_unpacked_to_f32) defined within the public class called public.The function start at line 104 and ends at 110. 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 | f6_e3m2_unpacked_to_f32 | def f6_e3m2_unpacked_to_f32(x: torch.Tensor):"""Input: torch.Tensor of dtype uint8, with bits 0-1 empty and bits 2-7containing an fp6_e3m2 encodingOutput: torch.Tensor of dtype fp32 with the dequantized value"""return _floatx_unpacked_to_f32(x, EBITS_F6_E3M2, MBITS_F6_E3M2) | 1 | 2 | 1 | 19 | 0 | 113 | 119 | 113 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (f6_e3m2_unpacked_to_f32) defined within the public class called public.The function start at line 113 and ends at 119. 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 | _fp4_packed_to_bf16 | def _fp4_packed_to_bf16(x_packed,sign_mask_f4,mantissa_mask_f4,mbits_f4_e2m1,ebits_f4_e2m1,f4_e2m1_exp_bias,mbits_f32,ebits_f32,f32_exp_bias,zero_bits_f32,zero_point_five_bits_f32,):"""Input: a tensor of packed fp4 valuesOutput: a tensor of bfloat16 values"""# low-bits: original location 0:3# high-bits: original locati... | 1 | 36 | 11 | 200 | 0 | 127 | 199 | 127 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_fp4_packed_to_bf16) defined within the public class called public.The function start at line 127 and ends at 199. It contains 36 lines of code and it has a cyclomatic complexity of 1. It takes 11 parameters, represented as [127.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _fp6_packed_to_bf16 | def _fp6_packed_to_bf16(packed_4bits_a,packed_4bits_b,packed_2bits,sign_mask_f6,mbits_f6,f6_exp_bias,mbits_f32,f32_exp_bias,):"""Input: a tensor of packed fp6 valuesOutput: a tensor of bfloat16 values"""# L/R shift and combine back into uint8 with first 2 bits empty (i.e. unpacked)x_0 = ((packed_4bits_a >> 2) & 0x3C) |... | 1 | 26 | 8 | 221 | 0 | 202 | 256 | 202 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_fp6_packed_to_bf16) defined within the public class called public.The function start at line 202 and ends at 256. It contains 26 lines of code and it has a cyclomatic complexity of 1. It takes 8 parameters, represented as [202.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | triton_f6_to_bf16_kernel | def triton_f6_to_bf16_kernel(x_ptr,output_ptr,n_mx_blocks,mx_block_size: tl.constexpr,packed_mx_block_size: tl.constexpr,sign_mask_f6: tl.constexpr,mbits_f6: tl.constexpr,f6_exp_bias: tl.constexpr,mbits_f32: tl.constexpr,f32_exp_bias: tl.constexpr,BLOCK_SIZE_IN: tl.constexpr,):pid = tl.program_id(axis=0)block_start = p... | 1 | 49 | 11 | 285 | 0 | 268 | 323 | 268 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_f6_to_bf16_kernel) defined within the public class called public.The function start at line 268 and ends at 323. It contains 49 lines of code and it has a cyclomatic complexity of 1. It takes 11 parameters, represented as [268.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | triton_f6_to_scaled_bf16_kernel | def triton_f6_to_scaled_bf16_kernel(x_ptr,s_ptr,output_ptr,n_mx_blocks,mx_block_size: tl.constexpr,packed_mx_block_size: tl.constexpr,sign_mask_f6: tl.constexpr,mbits_f6: tl.constexpr,f6_exp_bias: tl.constexpr,mbits_f32: tl.constexpr,f32_exp_bias: tl.constexpr,e8m0_exponent_bias: tl.constexpr,e8m0_exponent_nan_val: tl.... | 1 | 62 | 14 | 422 | 0 | 335 | 412 | 335 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_f6_to_scaled_bf16_kernel) defined within the public class called public.The function start at line 335 and ends at 412. It contains 62 lines of code and it has a cyclomatic complexity of 1. It takes 14 parameters, represented as [335.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | triton_pack_uint6_kernel | def triton_pack_uint6_kernel(input_ptr,output_ptr,n_mx_blocks,MX_BLOCK_SIZE: tl.constexpr,PACKED_MX_BLOCK_SIZE: tl.constexpr,BLOCK_SIZE_IN: tl.constexpr,):pid = tl.program_id(axis=0)block_start = pid * BLOCK_SIZE_IN# input_ptr is shape [n_mx_blocks, MX_BLOCK_SIZE]# Load BLOCK_SIZE rows of input_ptroffsets_rows = block_... | 1 | 53 | 6 | 358 | 0 | 424 | 493 | 424 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_pack_uint6_kernel) defined within the public class called public.The function start at line 424 and ends at 493. It contains 53 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [424.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | triton_f6_to_bf16_kernel | def triton_f6_to_bf16_kernel(x_ptr,output_ptr,n_elements_in,sign_mask_f6,mbits_f6,f6_exp_bias,mbits_f32,f32_exp_bias,BLOCK_SIZE_IN,):raise AssertionError("unsupported without triton") | 1 | 12 | 9 | 27 | 0 | 497 | 508 | 497 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_f6_to_bf16_kernel) defined within the public class called public.The function start at line 497 and ends at 508. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 9 parameters, represented as [497.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | triton_f6_to_scaled_bf16_kernel | def triton_f6_to_scaled_bf16_kernel(x_ptr,s_ptr,output_ptr,n_elements_in,mx_block_size,sign_mask_f6,mbits_f6,f6_exp_bias,mbits_f32,f32_exp_bias,e8m0_exponent_bias,e8m0_exponent_nan_val,BLOCK_SIZE_IN,):raise AssertionError("unsupported without triton") | 1 | 16 | 13 | 35 | 0 | 510 | 525 | 510 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_f6_to_scaled_bf16_kernel) defined within the public class called public.The function start at line 510 and ends at 525. It contains 16 lines of code and it has a cyclomatic complexity of 1. It takes 13 parameters, represented as [510.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | triton_pack_uint6_kernel | def triton_pack_uint6_kernel(input_ptr,output_ptr,n_mx_blocks,MX_BLOCK_SIZE,PACKED_MX_BLOCK_SIZE,BLOCK_SIZE,):raise AssertionError("unsupported without triton") | 1 | 9 | 6 | 21 | 0 | 527 | 535 | 527 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_pack_uint6_kernel) defined within the public class called public.The function start at line 527 and ends at 535. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [527.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | triton_f6_e2m3_to_bf16 | def triton_f6_e2m3_to_bf16(x: torch.Tensor) -> torch.Tensor:"""Input: a tensor of packed fp6 valuesOutput: a tensor of bfloat16 valuesNote: this function is only used in testing, so we can testthe numerical correctness of the cast without the scaling."""packed_mx_block_size = x.shape[-1]mx_block_size = 4 * packed_mx_bl... | 2 | 23 | 1 | 152 | 7 | 538 | 571 | 538 | null | ['output', 'n_mx_blocks', 'new_shape', 'x', 'packed_mx_block_size', 'grid', 'mx_block_size'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_f6_e2m3_to_bf16) defined within the public class called public.The function start at line 538 and ends at 571. 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 | triton_f6_e3m2_to_bf16 | def triton_f6_e3m2_to_bf16(x: torch.Tensor) -> torch.Tensor:"""Input: a tensor of packed fp6 valuesOutput: a tensor of bfloat16 valuesNote: this function is only used in testing, so we can testthe numerical correctness of the cast without the scaling."""packed_mx_block_size = x.shape[-1]mx_block_size = 4 * packed_mx_bl... | 2 | 23 | 1 | 149 | 7 | 574 | 607 | 574 | null | ['output', 'n_mx_blocks', 'new_shape', 'x', 'packed_mx_block_size', 'grid', 'mx_block_size'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_f6_e3m2_to_bf16) defined within the public class called public.The function start at line 574 and ends at 607. 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 | triton_f6_e2m3_to_scaled_bf16 | def triton_f6_e2m3_to_scaled_bf16(x: torch.Tensor,s_e8m0: torch.Tensor,mx_block_size: int,) -> torch.Tensor:"""Input: a tensor of packed fp6 values, and a scale in e8m0 format. The blocksize is currently assumed to be 32.Output: a tensor of bfloat16 values, multiplied by the encoded scale"""s_e8m0 = s_e8m0.view(torch.u... | 2 | 30 | 3 | 171 | 7 | 611 | 650 | 611 | null | ['output', 'n_mx_blocks', 'new_shape', 'x', 'packed_mx_block_size', 'grid', 's_e8m0'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_f6_e2m3_to_scaled_bf16) defined within the public class called public.The function start at line 611 and ends at 650. It contains 30 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [611.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | triton_f6_e3m2_to_scaled_bf16 | def triton_f6_e3m2_to_scaled_bf16(x: torch.Tensor,s_e8m0: torch.Tensor,mx_block_size: int,) -> torch.Tensor:"""Input: a tensor of packed fp6 values, and a scale in e8m0 format. The blocksize is currently assumed to be 32.Output: a tensor of bfloat16 values, multiplied by the encoded scale"""s_e8m0 = s_e8m0.view(torch.u... | 2 | 30 | 3 | 171 | 7 | 654 | 693 | 654 | null | ['output', 'n_mx_blocks', 'new_shape', 'x', 'packed_mx_block_size', 'grid', 's_e8m0'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_f6_e3m2_to_scaled_bf16) defined within the public class called public.The function start at line 654 and ends at 693. It contains 30 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [654.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _ | def _(x, s_e8m0, mx_block_size):_padded_mx_block_size = 3 * mx_block_size // 4out_shape = (x.numel() // _padded_mx_block_size, mx_block_size)return torch.empty(*out_shape, device=x.device, dtype=torch.bfloat16) | 1 | 4 | 3 | 44 | 2 | 697 | 700 | 697 | null | ['_padded_mx_block_size', 'out_shape'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_) defined within the public class called public.The function start at line 697 and ends at 700. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [697.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _ | def _(x, s_e8m0, mx_block_size):_padded_mx_block_size = 3 * mx_block_size // 4out_shape = (x.numel() // _padded_mx_block_size, mx_block_size)return torch.empty(*out_shape, device=x.device, dtype=torch.bfloat16) | 1 | 4 | 3 | 44 | 2 | 704 | 707 | 697 | null | ['_padded_mx_block_size', 'out_shape'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_) defined within the public class called public.The function start at line 704 and ends at 707. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [697.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | down_size | def down_size(size):assert size[-1] % 2 == 0, f"{size} last dim not divisible by two"return (*size[:-1], size[-1] // 2) | 1 | 3 | 1 | 34 | 0 | 714 | 716 | 714 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (down_size) defined within the public class called public.The function start at line 714 and ends at 716. 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 | up_size | def up_size(size):return (*size[:-1], size[-1] * 2) | 1 | 2 | 1 | 23 | 0 | 719 | 720 | 719 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (up_size) defined within the public class called public.The function start at line 719 and ends at 720. 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 | unpack_uint4 | def unpack_uint4(uint8_data) -> torch.Tensor:"""Get the original weight from the normalized float weight format"""assert uint8_data.is_contiguous()shape = uint8_data.shape# since we are using uint8 we will decode 2 entries per byte# Shift elements down 4 and select out the bottom 4 bits## Note: known slow with triton# ... | 1 | 9 | 1 | 77 | 4 | 723 | 753 | 723 | null | ['first_elements', 'shape', 'unpacked', 'second_elements'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (unpack_uint4) defined within the public class called public.The function start at line 723 and ends at 753. 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 | pack_uint4 | def pack_uint4(uint8_data: torch.Tensor) -> torch.Tensor:# converting to uint8 for operationsshape = uint8_data.shapeassert shape[-1] % 2 == 0uint8_data = uint8_data.contiguous().view(-1)return (uint8_data[::2] << 4 | uint8_data[1::2]).view(down_size(shape)) | 1 | 5 | 1 | 67 | 2 | 756 | 761 | 756 | null | ['uint8_data', 'shape'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (pack_uint4) defined within the public class called public.The function start at line 756 and ends at 761. 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 | pack_uint6_pytorch | def pack_uint6_pytorch(uint8_data: torch.Tensor) -> torch.Tensor:# check shape is divisible by 4 along packing axisshape = uint8_data.shapeassert shape[-1] % 4 == 0packed_shape = [*shape[:-1], 3 * shape[-1] // 4]uint8_data = uint8_data.contiguous().view(-1)# pack 4 bits of each of 4 numbers into 2xuint8, remaining 2 bi... | 1 | 16 | 1 | 199 | 6 | 765 | 786 | 765 | null | ['bits_packed_4_b', 'packed_shape', 'bits_packed_2', 'uint8_data', 'shape', 'bits_packed_4_a'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (pack_uint6_pytorch) defined within the public class called public.The function start at line 765 and ends at 786. It contains 16 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 | pack_uint6 | def pack_uint6(uint8_data: torch.Tensor) -> torch.Tensor:# ensure input data is contiguous before passing to kernelassert uint8_data.is_contiguous()# tensor should already be of shape [..., mx_block_size]mx_block_size = uint8_data.shape[-1]assert mx_block_size % 4 == 0# effective mx block size since we're packing 2 fp4... | 1 | 19 | 1 | 124 | 6 | 790 | 818 | 790 | null | ['packed_shape', 'n_mx_blocks', 'packed_uint8_data', 'packed_mx_block_size', 'grid', 'mx_block_size'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (pack_uint6) defined within the public class called public.The function start at line 790 and ends at 818. It contains 19 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 | _ | def _(uint8_data):out_shape = (*uint8_data.shape[:-1], 3 * uint8_data.shape[-1] // 4)return torch.empty(*out_shape, device=uint8_data.device, dtype=torch.uint8) | 1 | 3 | 1 | 48 | 1 | 822 | 824 | 822 | null | ['out_shape'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_) defined within the public class called public.The function start at line 822 and ends at 824. 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 | _triton_calculate_scale | def _triton_calculate_scale(x, axis):# There is no good support for accessing globals from a jit'ed triton# function, so we redefine them here. Since this is prototype code which# we plan to remove after torch.compile catches up, this is fine.target_max_pow2 = 8e8m0_exponent_bias = 127bf16_mbits = 7bf16_exp_bias = 127f... | 1 | 21 | 2 | 147 | 0 | 833 | 872 | 833 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_triton_calculate_scale) defined within the public class called public.The function start at line 833 and ends at 872. It contains 21 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [833.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _get_mxfp8_dim1_kernel_autotune_configs | def _get_mxfp8_dim1_kernel_autotune_configs():# Values to sweep over here were determined by a manual# sweep over a small set of shapes, it's likely that this# can be improved in the future.results = []for ROW_TILE_SIZE in (64, 128):for COL_TILE_SIZE in (64, 128):for num_warps in (1, 2, 4):config = triton.Config({"ROW_... | 4 | 14 | 0 | 67 | 0 | 874 | 890 | 874 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_get_mxfp8_dim1_kernel_autotune_configs) defined within the public class called public.The function start at line 874 and ends at 890. It contains 14 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | to_mxfp8_dim1_kernel | def to_mxfp8_dim1_kernel(x_ptr,# pointer to input tensoroutput_col_major_ptr,# pointer to column-major output tensor (column-normalized)col_scale_ptr,# pointer to store column-wise maximum absolute valuesn_rows,# number of rows in the tensorn_cols,# number of columns in the tensorROW_TILE_SIZE: tl.constexpr,COL_TILE_SI... | 1 | 49 | 8 | 334 | 0 | 897 | 1,039 | 897 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (to_mxfp8_dim1_kernel) defined within the public class called public.The function start at line 897 and ends at 1039. It contains 49 lines of code and it has a cyclomatic complexity of 1. It takes 8 parameters, represented as [897.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | triton_to_mxfp8_dim1 | def triton_to_mxfp8_dim1(x: torch.Tensor, inner_block_size: int = 32) -> Tuple[torch.Tensor, torch.Tensor]:"""Input:* `x` - input tensor, in row major memory layout* `inner_block_size` - size of tiles to scale across, default is 32 for MX recipesOutput:* `output_col_major`: the `float8_e4m3fn` values of `x` cast to mxf... | 1 | 34 | 2 | 198 | 0 | 1,042 | 1,100 | 1,042 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_to_mxfp8_dim1) defined within the public class called public.The function start at line 1042 and ends at 1100. It contains 34 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1042.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | custom_triton_to_mxfp8_dim1_sharding | def custom_triton_to_mxfp8_dim1_sharding(x, inner_block_size=32):replicate = ([Replicate(), Replicate()], [Replicate(), None])# Note that the data is returned transposed, which is why# we flip the sharding dim belowshard_dim0 = ([Shard(1), Shard(1)], [Shard(0), None])shard_dim1 = ([Shard(0), Shard(0)], [Shard(1), None]... | 1 | 6 | 2 | 89 | 0 | 1,103 | 1,110 | 1,103 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (custom_triton_to_mxfp8_dim1_sharding) defined within the public class called public.The function start at line 1103 and ends at 1110. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1103.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | triton_to_mxfp8_dim1_reference | def triton_to_mxfp8_dim1_reference(x_hp: torch.Tensor, block_size) -> Tuple[torch.Tensor, torch.Tensor]:"""A reference version of `to_mxfp8_dim1`."""from torchao.prototype.mx_formats.mx_tensor import to_mx# cast across dim1x_hp_d1 = x_hp.t().contiguous()scale_e8m0_dim1, x_hp_d1_normalized = to_mx(x_hp_d1, torch.float8_... | 1 | 13 | 2 | 85 | 0 | 1,112 | 1,129 | 1,112 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_to_mxfp8_dim1_reference) defined within the public class called public.The function start at line 1112 and ends at 1129. It contains 13 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1112.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | triton_scale_swizzle | def triton_scale_swizzle(scale_ptr,scale_rows,scale_cols,output_ptr,input_row_stride,input_col_stride,output_block_stride,BLOCK_ROWS: tl.constexpr,BLOCK_COLS: tl.constexpr,):pid_row = tl.program_id(0)pid_col = tl.program_id(1)rows = tl.arange(0, BLOCK_ROWS)[:, None]cols = tl.arange(0, BLOCK_COLS)[None, :]# Calculate st... | 1 | 36 | 9 | 213 | 0 | 1,132 | 1,180 | 1,132 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_scale_swizzle) defined within the public class called public.The function start at line 1132 and ends at 1180. It contains 36 lines of code and it has a cyclomatic complexity of 1. It takes 9 parameters, represented as [1132.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | triton_mx_block_rearrange | def triton_mx_block_rearrange(scale_tensor: torch.Tensor) -> torch.Tensor:"""Rearranges an E8M0 tensor scale to block-scaled swizzle format.This format is suitable for Tmem as described in NVIDIA documentation:https://docs.nvidia.com/cuda/cublas/index.html#d-block-scaling-factors-layoutArgs:scale_tensor: Input tensor i... | 1 | 30 | 1 | 183 | 0 | 1,183 | 1,237 | 1,183 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_mx_block_rearrange) defined within the public class called public.The function start at line 1183 and ends at 1237. It contains 30 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_fp32_to_fp4_packed | def convert_fp32_to_fp4_packed(x_pairs):"""Convert FP32 pairs to packed FP4 format.This function takes tensor where consecutive values along the last dimensionare packed together into single bytes.Args:x_pairs: [Tensor, Tensor] both w/ shapes [..., 1] where zipped last dimension containsinterleaved pairs of FP32 values... | 1 | 19 | 1 | 43 | 0 | 1,240 | 1,280 | 1,240 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (convert_fp32_to_fp4_packed) defined within the public class called public.The function start at line 1240 and ends at 1280. It contains 19 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 | quantize_nvfp4_triton_kernel | def quantize_nvfp4_triton_kernel(x_ptr,tensor_scale_ptr,q_ptr,s_ptr,stride_xm,stride_xn,M,N,USE_TENSOR_SCALE: tl.constexpr,MASK_SCALES: tl.constexpr,):F4_E2M1_MAX = 6.0F8E4M3_MAX = 448.0E4M3_EPS = 1.5258789e-05pid_m = tl.program_id(1)pid_n = tl.program_id(0)offs_m = pid_m * 128 + tl.arange(0, 128)[:, None]offs_n = pid_... | 5 | 69 | 10 | 555 | 0 | 1,284 | 1,374 | 1,284 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (quantize_nvfp4_triton_kernel) defined within the public class called public.The function start at line 1284 and ends at 1374. It contains 69 lines of code and it has a cyclomatic complexity of 5. It takes 10 parameters, represented as [1284.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | triton_quantize_nvfp4 | def triton_quantize_nvfp4(x: torch.Tensor, per_tensor_scale: Optional[torch.Tensor] = None) -> Tuple[torch.Tensor, torch.Tensor]:"""Quantize a tensor to NVFP4 format.Args:x (torch.Tensor): Input tensor to be quantized.tensor_scale (Optional[torch.Tensor]): Per-tensor scale for two-level quantization.If None, uses singl... | 3 | 33 | 2 | 211 | 0 | 1,377 | 1,434 | 1,377 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_quantize_nvfp4) defined within the public class called public.The function start at line 1377 and ends at 1434. It contains 33 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [1377.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _ | def _(x, per_tensor_scale=None):M, N = x.shapenum_scales = N // 16n_row_blocks = triton.cdiv(M, 128)n_col_blocks = triton.cdiv(num_scales, 4)padded_rows = n_row_blocks * 128padded_cols = n_col_blocks * 4scales = torch.empty(padded_rows, padded_cols, device=x.device, dtype=torch.float8_e4m3fn)xq = torch.empty(M, N // 2,... | 1 | 12 | 2 | 86 | 0 | 1,437 | 1,449 | 1,437 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_) defined within the public class called public.The function start at line 1437 and ends at 1449. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1437.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _ | def _(scale_tensor):rows, cols = scale_tensor.shapen_row_blocks = triton.cdiv(rows, 128)n_col_blocks = triton.cdiv(cols, 4)padded_rows = n_row_blocks * 128padded_cols = n_col_blocks * 4return scale_tensor.new_empty((padded_rows, padded_cols)) | 1 | 7 | 1 | 53 | 0 | 1,452 | 1,459 | 1,452 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_) defined within the public class called public.The function start at line 1452 and ends at 1459. 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 | triton_to_mxfp8_dim1 | def triton_to_mxfp8_dim1(x, inner_block_size=32) -> Tuple[torch.Tensor, torch.Tensor]:raise AssertionError("needs torch version 2.8+ and triton") | 1 | 4 | 2 | 25 | 0 | 1,462 | 1,465 | 1,462 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_to_mxfp8_dim1) defined within the public class called public.The function start at line 1462 and ends at 1465. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1462.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | triton_to_mxfp8_dim1_reference | def triton_to_mxfp8_dim1_reference(x_hp: torch.Tensor,block_size,) -> Tuple[torch.Tensor, torch.Tensor]:raise AssertionError("needs torch version 2.8+ and triton") | 1 | 5 | 2 | 28 | 0 | 1,467 | 1,471 | 1,467 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_to_mxfp8_dim1_reference) defined within the public class called public.The function start at line 1467 and ends at 1471. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1467.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | triton_mx_block_rearrange | def triton_mx_block_rearrange(scale_tensor: torch.Tensor) -> torch.Tensor:raise AssertionError("needs torch version 2.8+ and triton") | 1 | 2 | 1 | 18 | 0 | 1,473 | 1,474 | 1,473 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_mx_block_rearrange) defined within the public class called public.The function start at line 1473 and ends at 1474. 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 | triton_quantize_nvfp4 | def triton_quantize_nvfp4(x: torch.Tensor, tensor_scale: Optional[torch.Tensor] = None) -> Tuple[torch.Tensor, torch.Tensor]:raise AssertionError("needs torch version 2.8+ and triton") | 1 | 4 | 2 | 36 | 0 | 1,476 | 1,479 | 1,476 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (triton_quantize_nvfp4) defined within the public class called public.The function start at line 1476 and ends at 1479. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1476.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | mxfp8_quantize_cuda | def mxfp8_quantize_cuda(x: torch.Tensor,rowwise: bool = False,colwise: bool = True,scaling_mode: str = "floor",) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]:# Input shape must be 2D.assert x.ndim == 2rows, cols = x.shape# Block size must be a multiple of 32.block_size = 32assert rows % block_size =... | 1 | 20 | 4 | 116 | 0 | 1,500 | 1,524 | 1,500 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (mxfp8_quantize_cuda) defined within the public class called public.The function start at line 1500 and ends at 1524. It contains 20 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [1500.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | _ | def _(x: torch.Tensor,rowwise: bool = False,colwise: bool = True,scaling_mode: str = "floor",) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]:assert x.ndim == 2rows, cols = x.shapeblock_size = 32assert rows % block_size == 0, "rows must be a multiple of 32"assert cols % block_size == 0, "cols must be ... | 3 | 35 | 4 | 256 | 0 | 1,527 | 1,569 | 1,527 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_) defined within the public class called public.The function start at line 1527 and ends at 1569. It contains 35 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [1527.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | custom_mxfp8_quantize_cuda_dim1_sharding | def custom_mxfp8_quantize_cuda_dim1_sharding(x: torch.Tensor,rowwise: bool = False,colwise: bool = True,scaling_mode: str = "floor",):# This function signature can be used to understand the shardings:# _, colwise_data, _, colwise_scales = mxfp8_quantize_cuda(x, rowwise=False, colwise=True)# When inputs and scale are re... | 1 | 24 | 4 | 152 | 0 | 1,572 | 1,606 | 1,572 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (custom_mxfp8_quantize_cuda_dim1_sharding) defined within the public class called public.The function start at line 1572 and ends at 1606. It contains 24 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [1572.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | mxfp8_quantize_cuda | def mxfp8_quantize_cuda(x: torch.Tensor,rowwise: bool = False,colwise: bool = True,scaling_mode: str = "floor",) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]:raise NotImplementedError("`mxfp8_quantize_cuda` needs (1) torch 2.8+ and (2) torchao built from source on a machine with CUDA capability 10.0... | 1 | 9 | 4 | 52 | 0 | 1,609 | 1,617 | 1,609 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (mxfp8_quantize_cuda) defined within the public class called public.The function start at line 1609 and ends at 1617. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [1609.0] and does not return any value.. |
pytorch_ao | public | public | 0 | 0 | implements_func.decorator | def decorator(func):for op in torch_ops:MX_FUNC_TABLE[op] = funcreturn func | 2 | 4 | 1 | 18 | 0 | 30 | 33 | 30 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (implements_func.decorator) defined within the public class called public.The function start at line 30 and ends at 33. 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 | implements_func | def implements_func(torch_ops):"""Register torch ops to the mx op table for torch function"""def decorator(func):for op in torch_ops:MX_FUNC_TABLE[op] = funcreturn funcreturn decorator | 1 | 3 | 1 | 10 | 0 | 27 | 35 | 27 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (implements_func) defined within the public class called public.The function start at line 27 and ends at 35. 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 | mx_linear | def mx_linear(func, types, args, kwargs):a, b = args[0], args[1]assert isinstance(a, MXTensor) and isinstance(b, MXTensor)bias = args[2] if len(args) == 3 else Nonereturn _addmm_mx_dispatch(a, b.t(), func, bias=bias) | 3 | 5 | 4 | 70 | 1 | 39 | 43 | 39 | null | ['bias'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (mx_linear) 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 3. It takes 4 parameters, represented as [39.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.