Tingyuan LIANG via llvm-dev
2019-Jan-31 20:18 UTC
[llvm-dev] Confusing ERROR with LoopAccessLegacyAnalysis: Pass 'Unnamed pass: implement Pass::getPassName()' is not initialized.
Dear all, I write a new LoopPass which wants to use passes including LoopInfoWrapperPass, ScalarEvolutionWrapperPass and LoopAccessLegacyAnalysis. Therefore, I implement the following code based on LLVM 9.0.0: ====================================================================bool LoopInformationCollect::runOnLoop(Loop *L, LPPassManager &) { auto &SE = getAnalysis<ScalarEvolutionWrapperPass>().getSE(); auto &LI = getAnalysis<LoopInfoWrapperPass>().getLoopInfo(); // auto *LAA = &getAnalysis<LoopAccessLegacyAnalysis>(); if (Loop_id.find(L)==Loop_id.end()) // traverse instructions in the block assign instruction ID { Loop_id[L] = ++Loop_Counter; } // *Loop_out << "---------------Loop report----------------\n"; // *Loop_out << LAA->getInfo(L).getReport(); return false; } char LoopInformationCollect::ID = 0; void LoopInformationCollect::getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired<LoopInfoWrapperPass>(); AU.addRequired<ScalarEvolutionWrapperPass>(); AU.addRequired<LoopAccessLegacyAnalysis>(); AU.setPreservesAll(); } ==================================================================== I can make the project with GNU make successfully but get the error "Pass 'Unnamed pass: implement Pass::getPassName()' is not initialized." during runtime. When I remove the line "AU.addRequired<LoopAccessLegacyAnalysis>();" and make the project again, I run the program successfully. Detailed error report is shown below: --------------------------------------------------------------------------------------------------------- Pass 'Unnamed pass: implement Pass::getPassName()' is not initialized. Verify if there is a pass dependency cycle. Required Passes: Natural Loop Information Scalar Evolution Analysis --------------------------------------------------------------------------------------------------------- Please note that I am not using "opt" in the terminal to run the passes but utilize PassManager in a main() function. It seems that the problem is caused by "LoopAccessLegacyAnalysis", since I have not faced this problem with other passes. I am wondering how I can fix this situation. Thanks a lot for your time and suggestions! Best regards, ------------------------------------------ Tingyuan LIANG MPhil Student Department of Electronic and Computer Engineering The Hong Kong University of Science and Technology -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190131/5b4d4179/attachment.html>
Michael Kruse via llvm-dev
2019-Feb-01 22:10 UTC
[llvm-dev] Confusing ERROR with LoopAccessLegacyAnalysis: Pass 'Unnamed pass: implement Pass::getPassName()' is not initialized.
Hi, you will have to call initializeLoopAccessLegacyAnalysisPass(*PassRegistry::getPassRegistry()) before you can use it as a pass dependency. This is usually done by a sequence of INITIALIZE_PASS_BEGIN(YourPass, "your_pass", "Your Pass Name", false, false) INITIALIZE_PASS_DEPENDENCY(LoopAccessLegacyAnalysis) INITIALIZE_PASS_END(YourPass, "your_pass", "Your Pass Name", false, false) which also creates an initializer for your pass: initializeYourPassPass which you should call in some way in your application. Michael Am Fr., 1. Feb. 2019 um 12:58 Uhr schrieb Tingyuan LIANG via llvm-dev <llvm-dev at lists.llvm.org>:> > Dear all, > > I write a new LoopPass which wants to use passes including LoopInfoWrapperPass, ScalarEvolutionWrapperPass and LoopAccessLegacyAnalysis. > Therefore, I implement the following code based on LLVM 9.0.0: > > ====================================================================> bool LoopInformationCollect::runOnLoop(Loop *L, LPPassManager &) > { > > auto &SE = getAnalysis<ScalarEvolutionWrapperPass>().getSE(); > auto &LI = getAnalysis<LoopInfoWrapperPass>().getLoopInfo(); > // auto *LAA = &getAnalysis<LoopAccessLegacyAnalysis>(); > if (Loop_id.find(L)==Loop_id.end()) // traverse instructions in the block assign instruction ID > { > Loop_id[L] = ++Loop_Counter; > } > // *Loop_out << "---------------Loop report----------------\n"; > // *Loop_out << LAA->getInfo(L).getReport(); > return false; > } > > char LoopInformationCollect::ID = 0; > > void LoopInformationCollect::getAnalysisUsage(AnalysisUsage &AU) const { > AU.addRequired<LoopInfoWrapperPass>(); > AU.addRequired<ScalarEvolutionWrapperPass>(); > AU.addRequired<LoopAccessLegacyAnalysis>(); > AU.setPreservesAll(); > } > ====================================================================> > I can make the project with GNU make successfully but get the error "Pass 'Unnamed pass: implement Pass::getPassName()' is not initialized." during runtime. When I remove the line "AU.addRequired<LoopAccessLegacyAnalysis>();" and make the project again, I run the program successfully. > > Detailed error report is shown below: > > --------------------------------------------------------------------------------------------------------- > Pass 'Unnamed pass: implement Pass::getPassName()' is not initialized. > Verify if there is a pass dependency cycle. > Required Passes: > Natural Loop Information > Scalar Evolution Analysis > --------------------------------------------------------------------------------------------------------- > > Please note that I am not using "opt" in the terminal to run the passes but utilize PassManager in a main() function. It seems that the problem is caused by "LoopAccessLegacyAnalysis", since I have not faced this problem with other passes. I am wondering how I can fix this situation. > Thanks a lot for your time and suggestions! > > Best regards, > ------------------------------------------ > Tingyuan LIANG > MPhil Student > Department of Electronic and Computer Engineering > The Hong Kong University of Science and Technology > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Tingyuan LIANG via llvm-dev
2019-Feb-03 13:07 UTC
[llvm-dev] Confusing ERROR with LoopAccessLegacyAnalysis: Pass 'Unnamed pass: implement Pass::getPassName()' is not initialized.
Dear Michael, Thanks a lot for your suggestion but I not sure whether it is caused by this initialization because for example, I do not do such initialization for LoopInfoWrapperPass in my code but it works fine. I tried your solution for the pass but got the following compilation error ----> namespace "llvm" has no member "initializeLoopInformationCollectPass". Such error is raised from the macro define: INITIALIZE_PASS_END. Does it mean I need to specially define such function in the LLVM namespace? Thanks again for your time and patience! Best regards, ------------------------------------------ Tingyuan LIANG MPhil Student Department of Electronic and Computer Engineering The Hong Kong University of Science and Technology ________________________________ From: Michael Kruse <llvmdev at meinersbur.de> Sent: Saturday, February 2, 2019 6:10 AM To: Tingyuan LIANG Cc: llvm-dev at lists.llvm.org Subject: Re: [llvm-dev] Confusing ERROR with LoopAccessLegacyAnalysis: Pass 'Unnamed pass: implement Pass::getPassName()' is not initialized. Hi, you will have to call initializeLoopAccessLegacyAnalysisPass(*PassRegistry::getPassRegistry()) before you can use it as a pass dependency. This is usually done by a sequence of INITIALIZE_PASS_BEGIN(YourPass, "your_pass", "Your Pass Name", false, false) INITIALIZE_PASS_DEPENDENCY(LoopAccessLegacyAnalysis) INITIALIZE_PASS_END(YourPass, "your_pass", "Your Pass Name", false, false) which also creates an initializer for your pass: initializeYourPassPass which you should call in some way in your application. Michael Am Fr., 1. Feb. 2019 um 12:58 Uhr schrieb Tingyuan LIANG via llvm-dev <llvm-dev at lists.llvm.org>:> > Dear all, > > I write a new LoopPass which wants to use passes including LoopInfoWrapperPass, ScalarEvolutionWrapperPass and LoopAccessLegacyAnalysis. > Therefore, I implement the following code based on LLVM 9.0.0: > > ====================================================================> bool LoopInformationCollect::runOnLoop(Loop *L, LPPassManager &) > { > > auto &SE = getAnalysis<ScalarEvolutionWrapperPass>().getSE(); > auto &LI = getAnalysis<LoopInfoWrapperPass>().getLoopInfo(); > // auto *LAA = &getAnalysis<LoopAccessLegacyAnalysis>(); > if (Loop_id.find(L)==Loop_id.end()) // traverse instructions in the block assign instruction ID > { > Loop_id[L] = ++Loop_Counter; > } > // *Loop_out << "---------------Loop report----------------\n"; > // *Loop_out << LAA->getInfo(L).getReport(); > return false; > } > > char LoopInformationCollect::ID = 0; > > void LoopInformationCollect::getAnalysisUsage(AnalysisUsage &AU) const { > AU.addRequired<LoopInfoWrapperPass>(); > AU.addRequired<ScalarEvolutionWrapperPass>(); > AU.addRequired<LoopAccessLegacyAnalysis>(); > AU.setPreservesAll(); > } > ====================================================================> > I can make the project with GNU make successfully but get the error "Pass 'Unnamed pass: implement Pass::getPassName()' is not initialized." during runtime. When I remove the line "AU.addRequired<LoopAccessLegacyAnalysis>();" and make the project again, I run the program successfully. > > Detailed error report is shown below: > > --------------------------------------------------------------------------------------------------------- > Pass 'Unnamed pass: implement Pass::getPassName()' is not initialized. > Verify if there is a pass dependency cycle. > Required Passes: > Natural Loop Information > Scalar Evolution Analysis > --------------------------------------------------------------------------------------------------------- > > Please note that I am not using "opt" in the terminal to run the passes but utilize PassManager in a main() function. It seems that the problem is caused by "LoopAccessLegacyAnalysis", since I have not faced this problem with other passes. I am wondering how I can fix this situation. > Thanks a lot for your time and suggestions! > > Best regards, > ------------------------------------------ > Tingyuan LIANG > MPhil Student > Department of Electronic and Computer Engineering > The Hong Kong University of Science and Technology > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190203/c3795118/attachment.html>
Tingyuan LIANG via llvm-dev
2019-Mar-03 12:48 UTC
[llvm-dev] Add Bitwidth Attribute in Clang without Modification in Source Code of Clang
Hi all, I am handling some arbitrary precision integers (e.g. 13-bit) in the source code with Clang. Temporary, I declare them as structs like: struct APINT13 VarA; and during parsing the AST and generating IR, I transform the type of these variables into arbitrary precision integers. I read some other documentations and find that adding attributes for variables could be a nicer way to handle arbitrary precision integer. However, as default, there is no such attribute as "bitwidth" in Clang. I found the following link and get some hints but the instructions listed in the website require me to modify the source code of Clang ("Attr.td", "include/clang/Sema/ParsedAttr.h" and "utils/TableGen/ClangAttrEmitter.cpp"). http://clang.llvm.org/docs/InternalsManual.html#how-to-add-an-attribute I just wonder whether there is any way to add attributes like plugins without touching the source code of Clang, because to rebuild Clang could be time-consuming. As I know, LLVM passes can work as plugins and I guess there could be the similar way to handle attribute addition with Clang. Thanks in advance for your time and suggestion! \^_^/ Best regards, ------------------------------------------ Tingyuan LIANG MPhil Student Department of Electronic and Computer Engineering The Hong Kong University of Science and Technology -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190303/c8b77345/attachment.html>
Keane, Erich via llvm-dev
2019-Mar-04 18:28 UTC
[llvm-dev] Add Bitwidth Attribute in Clang without Modification in Source Code of Clang
I've actually got an implementation of this as an arbitrary precision integer extension that I've written up an RFC for (but not submitted). Below is my copy/pasted RFC (again, not reviewed, but I DO have an implementation of it that I need to prepare for review). I suspect my implementation will do what you need out of it. Its actually more significant than just adding a normal attribute. Introduction As we all know, LLVM-IR supports arbitrary precision integers via the iN syntax. Integers that aren't powers-of-two aren't particularly interesting/useful on most hardware however, so this functionality isn't typically used, and in fact, Clang does not have such support. However, certain architectures DO exist where the ability to express these values (and do math without promotion to full integers) is valuable from a performance perspective, since these values can be expressed more efficiently in hardware. I've developed a solution to expose these types in clang, and am proposing to contribute it back to the Clang community if it is sufficiently acceptable to the group. As rebasing/refactoring for the open-source version of clang is a significant effort, I'd like to get feedback on the concept and approach before putting in this effort. Syntax The syntax I'd chosen for this was as a Typedef Attribute. This permits the consumer to define various ways to expose this functionality in their code. Additionally, we've limited it to int/unsigned typedefs only for simplicity's sake. The code looks something like: // Typical way to expose this in C: typedef int __attribute__((__ap_int(3))) ap_int3; typedef unsigned __attribute__((__ap_int(3))) ap_uint3; // Better way to expose it in modern C++: template<unsigned bits> using ap_int = int __attribute__((__ap_int(bits))); template<unsigned bits> using ap_uint = unsigned __attribute__((__ap_int(bits))); For our usages, we just wrapped these in a type that would better express the further configurable semantics, but I suspect these are useful in their own right. Conversions/Promotions We consider conversions to/from integers integral promotions that follow normal conversion rules, and bool conversions are also supported (just like integers). AP-Int math is done at the size of the largest operand in order to be consistent with C rules as best as possible. Conversions to/from integers and literals happen consistently with the other integer types. Size/Align One important consideration that was made is how size/alignment is expressed in the language. Sizeof, for example works exclusively on bytes, so an ap_int<13> couldn't be directly expressed. Alignments are required to be a power-of-two, otherwise they are not expressable on some hardware. In implementation, we chose to use the next largest alignment (up to 64 bits). Additionally, for the sake of the standard library (and common array patterns), we were required to make sizeof also round up to the next power of two. This is most consistent with what a majority of LLVM backends will do (for example, an ap_int<24> will be expressed as a int-32 on most platforms), and was required to make common array patterns work. Unfortuantely, this results in arrays on these platforms having 'padding' bits, but there isn't really a way around that. So, is this something that the clang community is interested in? I'll of course expect extensive review through phabricator once it is ready, but I'd like to gauge interest (as well as determine if there is any "over my dead body" comments) before putting in the significant additional effort. From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Tingyuan LIANG via llvm-dev Sent: Sunday, March 3, 2019 4:48 AM To: llvm-dev at lists.llvm.org Subject: [llvm-dev] Add Bitwidth Attribute in Clang without Modification in Source Code of Clang Hi all, I am handling some arbitrary precision integers (e.g. 13-bit) in the source code with Clang. Temporary, I declare them as structs like: struct APINT13 VarA; and during parsing the AST and generating IR, I transform the type of these variables into arbitrary precision integers. I read some other documentations and find that adding attributes for variables could be a nicer way to handle arbitrary precision integer. However, as default, there is no such attribute as "bitwidth" in Clang. I found the following link and get some hints but the instructions listed in the website require me to modify the source code of Clang ("Attr.td", "include/clang/Sema/ParsedAttr.h" and "utils/TableGen/ClangAttrEmitter.cpp"). http://clang.llvm.org/docs/InternalsManual.html#how-to-add-an-attribute I just wonder whether there is any way to add attributes like plugins without touching the source code of Clang, because to rebuild Clang could be time-consuming. As I know, LLVM passes can work as plugins and I guess there could be the similar way to handle attribute addition with Clang. Thanks in advance for your time and suggestion! \^_^/ Best regards, ------------------------------------------ Tingyuan LIANG MPhil Student Department of Electronic and Computer Engineering The Hong Kong University of Science and Technology -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190304/61294808/attachment.html>
Seemingly Similar Threads
- Unable to find requested analysis info (Interesting Assertion Failture for Specific Target Source Code)
- Question about using LoopAccessLegacyAnalysis
- Question about using LoopAccessLegacyAnalysis
- Question about using LoopAccessLegacyAnalysis
- Polly Dependency Analysis in MyPass