refactor: decompose oversized functions flagged by codecheck - #1494
Closed
jimmychou0 wants to merge 2 commits into
Closed
refactor: decompose oversized functions flagged by codecheck#1494jimmychou0 wants to merge 2 commits into
jimmychou0 wants to merge 2 commits into
Conversation
Split the ten functions the latest scan reports over the nbnc-50 / cyclomatic-20 limits, keeping every transformation behavior-preserving: - PTOResolveBufferSelect: getTilePointerStrides 59->32 (fractal dims + RowPlusOne pad helpers) - PTORemoveRedundantBarrier: runOnOperation 110->44 (OpPipeTable, file-level sync classifiers, isRedundantBarrier rules A/B/C) - PTOExpandSoftLib: materializeCall 80->46 and runOnOperation 72->50 (cloneRenamedSoftLibFunctions, replaceWithSoftLibCall, isSupportedIntegerVdiv) - MemoryDependentAnalyzer: MemAlias 75->28 (isLocalBufferAlias, rangesOverlapOrUnknown folding the repeated empty/zero-size guards) - SyncMacroModel: getMGatherSyncMacroModel 89->21 (four build*Model helpers), getCollectiveCommSyncMacroModel 53->38 (addPingPongStagingPhases/addTReducePhases) - PTOMaterializeTileOpSections: inferTileOpKind 77->28 (classifyTileOpHelperOperation) - VPTOStatefulStreamFusion: getLoopAddressCoefficient 61->22 (computeCoefficientFromDef), parseStatefulStoreStream 52->45 - PTOValidateVMIIR: verifyLayoutSemanticSupport was already split on master into a 15-line dispatcher; its derived GroupReduction verifier is table-driven via member-function pointers (51->~28) - PTOModule: populatePTODialectBindings 1309->9 (six semantic populate*Binding sections plus the existing submodule hook) - ptoas_pipeline: runMainLoweringPipeline 99->39 (populateMainLoweringPasses, finishVPTOMainPipeline) Validated on the 144 host (LLVM 19.1.7 assert build, GCC 13.3) on top of master b465f26: full build warning-free under -Werror and CTest 73/73.
Self-review of the new diff lines against the EChecker rule set found two regressions of the very rules this series fixes: the moved coefficient lambda still used a default [&] capture (G.RES.06), and the extracted classifyTileOpHelperOperation landed at 55 nbnc (huge_method). Use an explicit capture list and split the restriction checks into rejectForbiddenTileHelperOperation (25 nbnc), leaving the classifier at 30. CTest 73/73 on the 144 assert build.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Decompose the ten functions the latest codecheck scan reports over the nbnc-50 / cyclomatic-complexity-20 limits (21 findings, all fixed; disposition table in
codecheck-fix-5.csv). Every split is behavior-preserving — extraction of cohesive helpers, no logic changes.PTOResolveBufferSelect::getTilePointerStridesPTORemoveRedundantBarrier::runOnOperationOpPipeTable, file-level sync classifiers,isRedundantBarrier(rules A/B/C)PTOExpandSoftLib::materializeCall/runOnOperationcloneRenamedSoftLibFunctions,replaceWithSoftLibCall,isSupportedIntegerVdivMemoryDependentAnalyzer::MemAliasisLocalBufferAlias,rangesOverlapOrUnknown(folds the repeated empty/zero-size guards)SyncMacroModel::getMGatherSyncMacroModel/getCollectiveCommSyncMacroModelbuild*Modelhelpers;addPingPongStagingPhases/addTReducePhasesPTOMaterializeTileOpSections::inferTileOpKindclassifyTileOpHelperOperationVPTOStatefulStreamFusion::getLoopAddressCoefficient/parseStatefulStoreStreamcomputeCoefficientFromDef,isValidStreamFlushPTOValidateVMIIR::verifyLayoutSemanticSupportPTOModule::populatePTODialectBindingspopulate*Bindingssections + the existing submodule hookptoas_pipeline::runMainLoweringPipelinepopulateMainLoweringPasses,finishVPTOMainPipelineTest plan
b465f26b5: full build warning-free under-Werror.git diff --checkclean; changed-code checker flags only known false positives on braced multi-lineifconditions.