tensorflow / mlir-hlo
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 941 units with 16,463 lines of code in units (78.0% of code).
    • 2 very complex units (280 lines of code)
    • 4 complex units (426 lines of code)
    • 65 medium complex units (3,840 lines of code)
    • 122 simple units (3,717 lines of code)
    • 748 very simple units (8,200 lines of code)
1% | 2% | 23% | 22% | 49%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
cc1% | 2% | 24% | 23% | 47%
h0% | 0% | 13% | 16% | 70%
cpp0% | 0% | 0% | 0% | 100%
py0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
lib/Analysis16% | 0% | 3% | 29% | 50%
lib/Dialect1% | 3% | 26% | 22% | 47%
lib/Transforms0% | 0% | 28% | 29% | 41%
include/mlir-hlo0% | 0% | 13% | 16% | 70%
lib/utils0% | 0% | 0% | 39% | 60%
lib/CAPI0% | 0% | 0% | 0% | 100%
tools/mlir-hlo-opt0% | 0% | 0% | 0% | 100%
python0% | 0% | 0% | 0% | 100%
python/mlir0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
void visit()
in lib/Analysis/shape_component_analysis.cc
143 60 1
ParseResult parseReduceOp()
in lib/Dialect/mhlo/IR/hlo_ops.cc
137 52 2
void runOnOperation()
in lib/Dialect/lhlo/transforms/lhlo_fuse_linalg.cc
118 33 0
OpFoldResult CompareOp::fold()
in lib/Dialect/mhlo/IR/hlo_ops.cc
61 30 1
LogicalResult matchAndRewrite()
in lib/Dialect/mhlo/transforms/legalize_to_linalg.cc
145 29 3
LogicalResult TryLowerTo1DOr2DReduction()
in lib/Dialect/mhlo/transforms/group_reduction_dimensions.cc
102 26 6
ParseResult parseConvolutionDimensions()
in lib/Dialect/mhlo/IR/hlo_ops.cc
134 25 2
LogicalResult matchAndRewrite()
in lib/Dialect/lhlo/transforms/lhlo_legalize_to_affine.cc
145 24 2
static LogicalResult verifyReducerShape()
in lib/Dialect/mhlo/IR/hlo_ops.cc
106 23 8
static LogicalResult Verify()
in lib/Dialect/mhlo/IR/hlo_ops.cc
89 23 1
inline Value MapMhloOpToStdScalarOp()
in include/mlir-hlo/Dialect/mhlo/transforms/map_mhlo_to_scalar_op.h
69 22 5
OpFoldResult ScatterOp::fold()
in lib/Dialect/mhlo/IR/hlo_ops.cc
82 22 1
void runOnOperation()
in lib/Dialect/mhlo/transforms/mhlo_canonicalize_reduction.cc
101 22 0
LogicalResult matchAndRewrite()
in lib/Dialect/mhlo/transforms/optimize_mhlo.cc
85 21 2
LogicalResult matchAndRewrite()
in lib/Transforms/reshape_simplifier.cc
57 19 2
LogicalResult matchAndRewrite()
in lib/Dialect/mhlo/transforms/legalize_to_linalg.cc
97 19 3
void PropagateBroadcast()
in lib/Dialect/mhlo/transforms/broadcast_propagation.cc
84 19 1
LogicalResult matchAndRewrite()
in lib/Dialect/mhlo/transforms/legalize_gather_to_torch_index_select.cc
74 19 2
LogicalResult matchAndRewrite()
in lib/Dialect/mhlo/transforms/lower_general_dot.cc
87 18 2
ParseResult parseWhileOp()
in lib/Dialect/mhlo/IR/hlo_ops.cc
29 17 2