Chris Lattner
2012-Jan-22 00:43 UTC
[LLVMdev] Fwd: How to force the creation of arrays with zeroes?
Yep check out PR1324. Doing something like this would be a great improvement. -Chris On Jan 21, 2012, at 9:42 AM, Duncan Sands <baldrick at free.fr> wrote:> Hi Anton, in a solution without CAZ, isNullValue can just return true when it > sees the special "this ConstantArray is all zero" flag. So all the places that > now look for CAZ can just use isNullValue instead and there need be no > performance loss. That said, CAZ is more "in your force" so less likely to be > forgotten about. Another interesting possibility is to handle more than just > all zero values: if a constant array has many repeated elements, maybe the > array could be stored in a compressed form. An all zeros array would just be a > special case of this. > > Ciao, Duncan. > > On 21/01/12 18:13, Anton Korobeynikov wrote: >> Sorry, forgot to reply-all >> >> ---------- Forwarded message ---------- >> From: Anton Korobeynikov<anton at korobeynikov.info> >> Date: Sat, Jan 21, 2012 at 20:59 >> Subject: Re: [LLVMdev] How to force the creation of arrays with zeroes? >> To: Stepan Dyatkovskiy<STPWORLD at narod.ru> >> >> >>> Though, there is also cases when we really need to transform it to 10,000 zeroes (just look at CBackend.cpp, when we print constant arrays, string #1027). There is also cases when we need to get either operand[i] or zero (SCCP.cpp, str #413). Both for CBackend and for SCCP we can reduce code size keeping performance on the same level. >> In these 2 particular cases the changes of the code size can >> definitely be neglected. Even more, in SCCP the use of CAZ is a >> performance win, since we do not have to check at all operands are >> zero, we already (!) know this. >> >> -- >> With best regards, Anton Korobeynikov >> Faculty of Mathematics and Mechanics, Saint Petersburg State University >> >> > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Stepan Dyatkovskiy
2012-Jan-22 07:50 UTC
[LLVMdev] Fwd: How to force the creation of arrays with zeroes?
Hi Chris. The main question is how to implement ConstantAggregateXXXXX::getOperand? Should it be empty collection, or it must return the item aggregated? -Stepan. 22.01.2012, 04:43, "Chris Lattner" <clattner at apple.com>:> Yep check out PR1324. Doing something like this would be a great improvement. > > -Chris > > On Jan 21, 2012, at 9:42 AM, Duncan Sands <baldrick at free.fr> wrote: > >> Hi Anton, in a solution without CAZ, isNullValue can just return true when it >> sees the special "this ConstantArray is all zero" flag. So all the places that >> now look for CAZ can just use isNullValue instead and there need be no >> performance loss. That said, CAZ is more "in your force" so less likely to be >> forgotten about. Another interesting possibility is to handle more than just >> all zero values: if a constant array has many repeated elements, maybe the >> array could be stored in a compressed form. An all zeros array would just be a >> special case of this. >> >> Ciao, Duncan. >> >> On 21/01/12 18:13, Anton Korobeynikov wrote: >>> Sorry, forgot to reply-all >>> >>> ---------- Forwarded message ---------- >>> From: Anton Korobeynikov<anton at korobeynikov.info> >>> Date: Sat, Jan 21, 2012 at 20:59 >>> Subject: Re: [LLVMdev] How to force the creation of arrays with zeroes? >>> To: Stepan Dyatkovskiy<STPWORLD at narod.ru> >>>> Though, there is also cases when we really need to transform it to 10,000 zeroes (just look at CBackend.cpp, when we print constant arrays, string #1027). There is also cases when we need to get either operand[i] or zero (SCCP.cpp, str #413). Both for CBackend and for SCCP we can reduce code size keeping performance on the same level. >>> In these 2 particular cases the changes of the code size can >>> definitely be neglected. Even more, in SCCP the use of CAZ is a >>> performance win, since we do not have to check at all operands are >>> zero, we already (!) know this. >>> >>> -- >>> With best regards, Anton Korobeynikov >>> Faculty of Mathematics and Mechanics, Saint Petersburg State University >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Chris Lattner
2012-Jan-22 08:50 UTC
[LLVMdev] Fwd: How to force the creation of arrays with zeroes?
Hi Stephan, I've been thinking about this a bit and have some more specific ideas, I'll write up a design and maybe implement it over the next few days. -Chris On Jan 21, 2012, at 11:50 PM, Stepan Dyatkovskiy <STPWORLD at narod.ru> wrote:> Hi Chris. The main question is how to implement ConstantAggregateXXXXX::getOperand? Should it be empty collection, or it must return the item aggregated? > > -Stepan. > > 22.01.2012, 04:43, "Chris Lattner" <clattner at apple.com>: >> Yep check out PR1324. Doing something like this would be a great improvement. >> >> -Chris >> >> On Jan 21, 2012, at 9:42 AM, Duncan Sands <baldrick at free.fr> wrote: >> >>> Hi Anton, in a solution without CAZ, isNullValue can just return true when it >>> sees the special "this ConstantArray is all zero" flag. So all the places that >>> now look for CAZ can just use isNullValue instead and there need be no >>> performance loss. That said, CAZ is more "in your force" so less likely to be >>> forgotten about. Another interesting possibility is to handle more than just >>> all zero values: if a constant array has many repeated elements, maybe the >>> array could be stored in a compressed form. An all zeros array would just be a >>> special case of this. >>> >>> Ciao, Duncan. >>> >>> On 21/01/12 18:13, Anton Korobeynikov wrote: >>>> Sorry, forgot to reply-all >>>> >>>> ---------- Forwarded message ---------- >>>> From: Anton Korobeynikov<anton at korobeynikov.info> >>>> Date: Sat, Jan 21, 2012 at 20:59 >>>> Subject: Re: [LLVMdev] How to force the creation of arrays with zeroes? >>>> To: Stepan Dyatkovskiy<STPWORLD at narod.ru> >>>>> Though, there is also cases when we really need to transform it to 10,000 zeroes (just look at CBackend.cpp, when we print constant arrays, string #1027). There is also cases when we need to get either operand[i] or zero (SCCP.cpp, str #413). Both for CBackend and for SCCP we can reduce code size keeping performance on the same level. >>>> In these 2 particular cases the changes of the code size can >>>> definitely be neglected. Even more, in SCCP the use of CAZ is a >>>> performance win, since we do not have to check at all operands are >>>> zero, we already (!) know this. >>>> >>>> -- >>>> With best regards, Anton Korobeynikov >>>> Faculty of Mathematics and Mechanics, Saint Petersburg State University >>> _______________________________________________ >>> LLVM Developers mailing list >>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Seemingly Similar Threads
- [LLVMdev] Fwd: How to force the creation of arrays with zeroes?
- [LLVMdev] Fwd: How to force the creation of arrays with zeroes?
- [LLVMdev] Fwd: How to force the creation of arrays with zeroes?
- [LLVMdev] Fwd: How to force the creation of arrays with zeroes?
- [LLVMdev] How to force the creation of arrays with zeroes?