Andreas Neustifter
2009-Sep-08 08:27 UTC
[LLVMdev] [PATCH] & Question: Preserving ProfileInfo for backend.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, the second part of my work is to preserve the profiling information through all the transformation passes and make it available to the backend machinery. Attached is an example patch on how I plan to preserve the information for a given transformation pass. And now comes the question into place: whats the best way to attach the profile info also the MachineBlocks and MachineFunctions? I was thinking of converting the ProfileInfo into a template and using it for both BasicBlocks and MachineBasicBlocks. And where is the best point to transfer this information from the bytecode CFG to the machinecode CFG? Thanks, Andi - -- =========================================================================This email is signed, for more information see http://web.student.tuwien.ac.at/~e0325716/gpg.html -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkqmFVYACgkQPiYq0rq7s/AxcgCggdPJqtjo8aujpZ6NxtQTQVBY TrEAnRrwHSHToDA6t8p4zqVVWdahj585 =8kyz -----END PGP SIGNATURE----- -------------- next part -------------- A non-text attachment was scrubbed... Name: llvm-r81204.preserve.profiling.info.patch Type: text/x-patch Size: 2157 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090908/ab02c8b2/attachment.bin>
Dan Gohman
2009-Sep-08 18:21 UTC
[LLVMdev] [PATCH] & Question: Preserving ProfileInfo for backend.
On Sep 8, 2009, at 1:27 AM, Andreas Neustifter wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi, > > the second part of my work is to preserve the profiling information > through all the transformation passes and make it available to the > backend machinery. > > Attached is an example patch on how I plan to preserve the information > for a given transformation pass.At a brief glance, this looks good. It would be helpful to override the verifyAnalysis method from the Pass class to verify that the profiling information has been kept current.> > And now comes the question into place: whats the best way to attach > the > profile info also the MachineBlocks and MachineFunctions? I was > thinking > of converting the ProfileInfo into a template and using it for both > BasicBlocks and MachineBasicBlocks. > > And where is the best point to transfer this information from the > bytecode CFG to the machinecode CFG?The SelectionDAGBuild phase is the only place where the precise relationship between the BasicBlock CFG and the MachineBasicBlock CFG is known. It would also be possible to do the transfer in a later phase, though that would require a fair amount of guesswork to determine how the two CFGs correspond. This does point out a limitation of doing instrumentation at the LLVM IR level; it won't be able to cover branches inserted during CodeGen. Dan
Shuguang Feng
2009-Sep-09 16:46 UTC
[LLVMdev] [PATCH] & Question: Preserving ProfileInfo for backend.
Hi, Does the current LLVM backend support reading in profile information (without preserving across transformations)? An earlier poster http://groups.google.com/group/llvm-dev/browse_thread/thread/4bd65dbe84394bb7 noted that accessing execution counts in a MachineFunction pass (using the BasicBlock* corresponding to the respective MachineBasicBlock) returned 0 for all blocks. Running llc with --debug-pass=Structure I noticed that the NoProfileInfo pass was being executed. I tried adding a ProfileLoaderPass in the addPreRegAlloc function of the X86 target machine to load the profile information but receive the following runtime error when the pass manager attempts to add the ProfileLoader pass: llc: <path to llvm>/llvm/lib/VMCore/PassManager.cpp:1597: virtual void llvm::ModulePass::assignPassManager(llvm::PMStack&, llvm::PassManagerType): Assertion `!PMS.empty() && "Unable to find appropriate Pass Manager"' failed. I'm not very familiar with the inner workings of the pass manager framework. Is there a simple fix that can allow existing profile information to be loaded by backend passes? I realize that the profile data would not be completely accurate, but as a first order approximation it could be useful until the proper framework is implemented? Thanks!
Maybe Matching Threads
- [LLVMdev] [PATCH] & Question: Preserving ProfileInfo for backend.
- [LLVMdev] [PATCH] & Question: Preserving ProfileInfo for backend.
- [LLVMdev] [PATCH] & Question: Preserving ProfileInfo for backend.
- [LLVMdev] [PATCH] & Question: Preserving ProfileInfo for backend.
- [LLVMdev] Loading ProfileInfo in Backend. (Was: [PATCH] & Question: Preserving ProfileInfo for backend.)