Halide icon indicating copy to clipboard operation
Halide copied to clipboard

Migrate src/CodeGen_PTX_Dev.cpp to new pass manager

Open MaskRay opened this issue 3 years ago • 3 comments

Using LLVM's legacy PM for optimization pipeline was deprecated in 13.0.0 and the relevant functionality was scheduled to be removed after 14.0.0 (got delayed). The legacy PM for code generation (assembly, object file generation; mainly addPassesToEmitFile) is still supported.

Clang dropped legacy PM support in D123609 (milestone: 15.0.0). I plan to remove instrumentation passes like gcov, PGO, and sanitizers (milestone: 15.0.0).

LLVM's legacy PM for optimization pipeline may be completely removed in 16.0.0 (llvm::create*Pass, populateModulePassManager, etc). llvm-project clang/lib/CodeGen/BackendUtil.cpp can serve as an example using the new pass manager.

MaskRay avatar Apr 16 '22 19:04 MaskRay

This has been raised a few times before. We do not use the legacy PM for the optimization pipeline. We only use it for code generation.

abadams avatar Apr 16 '22 20:04 abadams

Sorry for unclear first message. Edited to be clear that populateModulePassManager is a legacy API pending removal.

In src/CodeGen_PTX_Dev.cpp, these functions use the legacy PM for the optimization pipeline.

    PassManagerBuilder b;
    b.OptLevel = 3;
    b.Inliner = createFunctionInliningPass(b.OptLevel, 0, false);
    b.LoopVectorize = do_loop_opt;
    b.SLPVectorize = true;
    b.DisableUnrollLoops = !do_loop_opt;

    target_machine->adjustPassManager(b);
 
    b.populateFunctionPassManager(function_pass_manager);
    b.populateModulePassManager(module_pass_manager);

MaskRay avatar Apr 16 '22 20:04 MaskRay

Ah, I didn't realize the PTX backend had lagged behind. We upgraded the main CodeGen_LLVM a while ago. Thanks for the heads up.

abadams avatar Apr 16 '22 21:04 abadams