Hi, How can I dynamically change the code generation optimization level (e.g., None) of a JIT in other to recompile a function with a new optimization level (e.g., Default)? Thank you. Best regards, Nurudeen.
> How can I dynamically change the code generation optimization level (e.g., > None) of a JIT in other to recompile a function with a new optimization > level (e.g., Default)?From the source code I'm reading, you might have to creat another JIT with different opt level. Regards, chenwj -- Wei-Ren Chen (陳韋任) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667 Homepage: http://people.cs.nctu.edu.tw/~chenwj
Hi Chenwj, Thank you for your response. The problem with this approach is that global mappings have to be recreated in the new JIT. Can this be somehow avoided? Best regards, Nurudeen. On Thu, March 22, 2012 10:15 pm, é³éä»» wrote:>> How can I dynamically change the code generation optimization level >> (e.g., >> None) of a JIT in other to recompile a function with a new optimization >> level (e.g., Default)? > > From the source code I'm reading, you might have to creat another JIT > with different opt level. > > Regards, > chenwj > > -- > Wei-Ren Chen (é³éä»») > Computer Systems Lab, Institute of Information Science, > Academia Sinica, Taiwan (R.O.C.) > Tel:886-2-2788-3799 #1667 > Homepage: http://people.cs.nctu.edu.tw/~chenwj > >
> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of nlamee at cs.mcgill.ca > Subject: [LLVMdev] Execution Engine: CodeGenOpt level> How can I dynamically change the code generation optimization level (e.g., > None) of a JIT in other to recompile a function with a new optimization > level (e.g., Default)?We set the optimization level with a PassManagerBuilder, which is initialized for each function compilation: PassManagerBuilder PMBuilder; ... PMBuilder.OptLevel = conf.value_of(CF_OPTLEVEL); PMBuilder.SizeLevel = conf.is_set(CF_OPTSIZE) ? 1 : 0; PMBuilder.DisableUnitAtATime = !conf.is_set(CF_OPTUNIT); PMBuilder.DisableUnrollLoops = !conf.is_set(CF_UNROLL); PMBuilder.DisableSimplifyLibCalls = !conf.is_set(CF_SIMPLIB); if (Opt != CodeGenOpt::None) { PMBuilder.Inliner = createFunctionInliningPass(Opt == CodeGenOpt::Aggressive ? 250 : 200); } pFPasses = new FunctionPassManager(pMod); pFPasses->add(new TargetData(*TD)); PMBuilder.populateFunctionPassManager(*pFPasses); pFPasses->doInitialization(); pFPasses->run(*pFun); pFPasses->doFinalization(); delete pFPasses; pMPasses = new PassManager(); pMPasses->add(new TargetData(*TD)); pMPasses->add(createCFGSimplificationPass()); pMPasses->add(createBlockPlacementPass()); PMBuilder.populateModulePassManager(*pMPasses); pMPasses->run(*pMod); delete pMPasses; (There is likely some redundancy and unnecessary steps in the above.) - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
Neat approach, I think. So you set PassManagers's Opt level rather then ExecutionEngine's one? Regards, chenwj -- Wei-Ren Chen (陳韋任) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667 Homepage: http://people.cs.nctu.edu.tw/~chenwj