Skip to content

Move code from header to source

Maxence Naud requested to merge fix_reduce-obj-size into dev

Context

The goal is to reduce the code size.

Result

Individual object files sizes were reduced (see table bellow). This exercice showed that most of the code size is due to REGISTRAR templates and AIDGE_ASSERT MACROs.

file old size (KB) new size (KB)
backend/cpu/data/TensorImpl.cpp.o 545 504
analysis/StaticAnalysis.cpp.o 410 318
analysis/OperatorStats.cpp.o 402 413
analysis/DynamicAnalysis.cpp.o 364 266
graph/GraphView.cpp.o 349 347
data/Tensor.cpp.o 349 347
scheduler/Scheduler.cpp.o 348 340
operator/AvgPooling.cpp.o 332 329
operator/MaxPooling.cpp.o 262 262
operator/ConvTranspose.cpp.o 251 251
operator/Conv.cpp.o 249 249
operator/Pad.cpp.o 244 244
operator/ConvDepthWise.cpp.o 233 233
operator/Producer.cpp.o 224 224
operator/BatchNorm.cpp.o 211 209
operator/Resize.cpp.o 209 209
operator/Stack.cpp.o 207 133
operator/Reshape.cpp.o 205 152
operator/Pop.cpp.o 201 125
operator/MetaOperator.cpp.o 199 198
operator/Slice.cpp.o 187 176
backend/OperatorImpl.cpp.o 184 183
graph/Node.cpp.o 182 182
operator/Select.cpp.o 174 100
operator/Select.cpp.o 174 100
operator/Cast.cpp.o 171 168
operator/GenericOperator.cpp.o 168 168
scheduler/MemoryManager.cpp.o 165 165
operator/OperatorTensor.cpp.o 164 160
operator/Split.cpp.o 159 153
operator/Gather.cpp.o 158 154
graph/Matching.cpp.o 155 155
operator/GridSample.cpp.o 147 147
recipes/ConvToMatMul.cpp.o 144 143
operator/Transpose.cpp.o 144 144
operator/Concat.cpp.o 140 135
recipes/MatMulTiling.cpp.o 139 138
operator/Memorize.cpp.o 139 122
operator/DepthToSpace.cpp.o 137 130
recipes/ConstantFolding.cpp.o 136 136
operator/Unfold.cpp.o 134 128
recipes/HorizontalTiling.cpp.o 132 130
operator/ReduceMean.cpp.o 131 131
operator/Fold.cpp.o 128 128
operator/Shape.cpp.o 127 122
recipes/ApplyWeightInterleaving.cpp.o 125 122
operator/Scaling.cpp.o 124 124
operator/Identity.cpp.o 122 44
operator/MetaOperatorDefs/Leaky.cpp.o 121 118
operator/Squeeze.cpp.o 119 143
operator/Mod.cpp.o 119 119

Even though big object files size were reduced, the global size is unchanged. At least code is better organized.

Major modification

  • Move generic implementations to their own implementation file in backend/generic/operator
  • upd: Squeeze_Op::forwardDims()
  • Move a lot of code from header to source files
  • upd: StackOp::s_type -> StackOp::Type
Edited by Maxence Naud

Merge request reports

Loading