Re: [fpc-devel] x86_64 Optimizer Overhaul
Following advice from Florian, I've split my submission into five separate patches so they are easier to test. It also now compiles under x86_64-linux. It seems that there's an apparent fault with one of the MOV optimisations that was causing incorrect code to be generated in some instances. I have a good idea as to what's going on and can try to fix this at another time. Hopefully now it's stable enough for time metrics to be taken and to confirm it doesn't break other platforms. Some more refactoring should be performed down the line; I plan to do this once my code is confirmed reasonable and I begin adapting it for i386, where there's a bounty for speed gains! Find all the new patch files over here: https://bugs.freepascal.org/view.php?id=34628 - note that some of the patches require others to work; prerequisite information is given in the first note. Gareth aka. Kit ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Linux compilation question
I admit I do wonder how hard maintenance will be. True, there is some more looking ahead, but it's not really any more complex than what it is already (e.g. take a look at OptPass1MOV in the trunk). When it comes to debugging the peephole optimiser, one thing I did was write a function that wrote the assembly of the current block to the console, so I could visually see the commands ahead. It's not part of the submitted patches because it only works for i386 and x86_64 under Windows, but it's proven useful. If there's interest, I can submit it as a separate patch, but it's not really suitable as a permanent fixture unless someone wants to try to make it a feature only enabled with debug defines. Gareth aka. Kit On Sat 01/12/18 18:57 , "J. Gareth Moreton" gar...@moreton-family.com sent: Aw, okay. Well, post peephole is still a separate stage, since that prevents a lot of other optimisations (e.g. changing mov 0,%reg into xor %reg,%reg). I'll start breaking it up into smaller chunks. Gareth aka. Kit On Sat 01/12/18 19:54 , Florian Klämpfl flor...@freepascal.org sent: Am 01.12.2018 um 17:28 schrieb J. Gareth Moreton: > Thanks Bart, > > I managed to get it to build after reinstalling the FPC compiler 3.0.4 - it seems it was getting confused between two > different versions on my virtual machine - but after all that it does look like a bug in my new code. I've managed to > get it to compile from a clean build and with a couple of modified files that don't do anything drastic, so now I'll try > to isolate the issue and update my patch file. An overhauled peephole optimizer is no use if it breaks Linux! I had a quick look at the patch and I strongly recommend to split it in multiple patches which can be reviewed more easily. This allows also to detect easier which change breaks things and also to measure which change increases speed and which change is not needed. In general, I am not happy with the merge of the four passes as it makes maintenance much harder. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org [1] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel [2]">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org [3] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel [4]">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel Links: -- [1] mailto:fpc-devel@lists.freepascal.org [2] http://secureweb.fast.net.uk/ http:= [3] mailto:fpc-devel@lists.freepascal.org [4] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Linux compilation question
Aw, okay. Well, post peephole is still a separate stage, since that prevents a lot of other optimisations (e.g. changing mov 0,%reg into xor %reg,%reg). I'll start breaking it up into smaller chunks. Gareth aka. Kit On Sat 01/12/18 19:54 , Florian Klämpfl flor...@freepascal.org sent: Am 01.12.2018 um 17:28 schrieb J. Gareth Moreton: > Thanks Bart, > > I managed to get it to build after reinstalling the FPC compiler 3.0.4 - it seems it was getting confused between two > different versions on my virtual machine - but after all that it does look like a bug in my new code. I've managed to > get it to compile from a clean build and with a couple of modified files that don't do anything drastic, so now I'll try > to isolate the issue and update my patch file. An overhauled peephole optimizer is no use if it breaks Linux! I had a quick look at the patch and I strongly recommend to split it in multiple patches which can be reviewed more easily. This allows also to detect easier which change breaks things and also to measure which change increases speed and which change is not needed. In general, I am not happy with the merge of the four passes as it makes maintenance much harder. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org [1] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel [2]">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel Links: -- [1] mailto:fpc-devel@lists.freepascal.org [2] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Linux compilation question
Am 01.12.2018 um 17:28 schrieb J. Gareth Moreton: > Thanks Bart, > > I managed to get it to build after reinstalling the FPC compiler 3.0.4 - it > seems it was getting confused between two > different versions on my virtual machine - but after all that it does look > like a bug in my new code. I've managed to > get it to compile from a clean build and with a couple of modified files that > don't do anything drastic, so now I'll try > to isolate the issue and update my patch file. An overhauled peephole > optimizer is no use if it breaks Linux! I had a quick look at the patch and I strongly recommend to split it in multiple patches which can be reviewed more easily. This allows also to detect easier which change breaks things and also to measure which change increases speed and which change is not needed. In general, I am not happy with the merge of the four passes as it makes maintenance much harder. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Linux compilation question
Thanks Bart, I managed to get it to build after reinstalling the FPC compiler 3.0.4 - it seems it was getting confused between two different versions on my virtual machine - but after all that it does look like a bug in my new code. I've managed to get it to compile from a clean build and with a couple of modified files that don't do anything drastic, so now I'll try to isolate the issue and update my patch file. An overhauled peephole optimizer is no use if it breaks Linux! Thanks for the tips everyone. Gareth aka. Kit On Sat 01/12/18 17:03 , "Bart" bartjun...@gmail.com sent: On Fri, Nov 30, 2018 at 3:41 PM J. Gareth Moreton wrote: > /usr/bin/diff ppc3 ppcx64 > Binary files ppc3 and ppcx64 differ > > And then it drops out. I've tried the usual things of doing a "make distclean", but am I missing something obvious? Preliminary Linux testing is the only thing I'm missing before I'm ready to present a patch. Works for me here. svn co https://svn.freepascal.org/svn/fpc/trunk [1] . make # after succesfull make: make clean all Fpc r40425, on Linux Mint 18.2 64-bit using fpc 3.0.4 as starting compiler. -- Bart Links: -- [1] http://secureweb.fast.net.uk/parse.php?redirect=https://svn.freepascal.org/svn/fpc/trunk ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Linux compilation question
On Fri, Nov 30, 2018 at 3:41 PM J. Gareth Moreton wrote: > /usr/bin/diff ppc3 ppcx64 > Binary files ppc3 and ppcx64 differ > > And then it drops out. I've tried the usual things of doing a "make > distclean", but am I missing something obvious? Preliminary Linux testing is > the only thing I'm missing before I'm ready to present a patch. Works for me here. svn co https://svn.freepascal.org/svn/fpc/trunk . make # after succesfull make: make clean all Fpc r40425, on Linux Mint 18.2 64-bit using fpc 3.0.4 as starting compiler. -- Bart ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[fpc-devel] x86_64 Optimizer Overhaul
Hi everyone, So for the fast few weeks, I've attempted to do some work on the peephole optimizer, specifically to reduce the number of passes required to produce optimised code, and I can finally submit a patch: https://bugs.freepascal.org/view.php?id=34628 This is only for x86_64, and I've tried to keep i386 separate until I know x86_64 works. I hope it works and is to a high standard. The bug report should explain most of the logic behind the changes. I've had problems testing it under Linux due to configuration difficulties, so if anyone is willing to try out "make all", I'll be most grateful. Thank you. Gareth aka. Kit ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Linux compilation question
I must have something configured incorrectly - I'm still getting the error. Apologies for bugging everyone. Gareth aka. Kit On Sat 01/12/18 06:14 , "Christo Crause" christo.cra...@gmail.com sent: On Sat, 1 Dec 2018, 01:37 J. Gareth Moreton ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Linux compilation question
The only thing I've managed to run so far is the standard "make all". What's mysterious though is that if I grab a clean copy from the trunk, it builds fine. However, if I do "make clean" first, that error appears. Does anyone else get this? (I'm using Ubuntu and compiling on x86_64) I managed to get an assembly dump of system.pp and compare the output between ppc1, ppc2 and ppc3. Some procedures in ppc3 look very different, as if compiled by an older version of the compiler. It's confusing, but I'll keep at it. I don't want to scrap my changes, because so far I've managed to make -O3 about 15% faster. Gareth aka. Kit On Sat 01/12/18 09:05 , "Florian Klämpfl" flor...@freepascal.org sent: > Am 30.11.2018 um 14:39 schrieb J. Gareth Moreton: > > > Hi everyone, > > > > > > I have a little question. I'm having > problems compiling fpc under x86_64- linux. At first I thought it was > a bug in one > > of my changes, but it seems to occur on the > trunk as well. After successfully compiling the compiler a few times, > the > > following happens: > > > > > > /usr/bin/diff ppc3 ppcx64 > > > Binary files ppc3 and ppcx64 differ > > > > > > And then it drops out. I've tried the > usual things of doing a "make distclean", but am I missing > something obvious? > > > This means that the compiler generates wrong code which results in wrong > code generation :). These things are very hard > to debug. The only way is to compare the disassembly manually to find out > where it differs and then to debug why it > generates this particular code at that location. > > > > > Preliminary Linux testing is the only thing I'm > missing before I'm ready to present a patch. > > > Did you run regression tests? > > __ _ > > fpc-devel maillist - fpc- de...@lists.freepascal.org > http://lists.freepascal.org/cgi- bin/mailman/listinfo/fpc-devel > > > > ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Linux compilation question
Am 30.11.2018 um 14:39 schrieb J. Gareth Moreton: > Hi everyone, > > I have a little question. I'm having problems compiling fpc under > x86_64-linux. At first I thought it was a bug in one > of my changes, but it seems to occur on the trunk as well. After > successfully compiling the compiler a few times, the > following happens: > > /usr/bin/diff ppc3 ppcx64 > Binary files ppc3 and ppcx64 differ > > And then it drops out. I've tried the usual things of doing a "make > distclean", but am I missing something obvious? This means that the compiler generates wrong code which results in wrong code generation :). These things are very hard to debug. The only way is to compare the disassembly manually to find out where it differs and then to debug why it generates this particular code at that location. > Preliminary Linux testing is the only thing I'm missing before I'm ready to > present a patch. Did you run regression tests? ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Stringlist customsort
On Fri, 30 Nov 2018, Franz Müller wrote: Do not forget that TStringlist is just a possible implementation of TStrings. You are free to create your own. For example, the inifiles unit has a specialized version which is optimized for containing name=value pairs. Of course, everyone can create his own basic classes for everything, but I think that is not how high level programming is supposed to work. The improvement that I propose is 100% compatible with current code, if you don' t need the feature (which will be the case most of the time), you just don't use it, but if you need this added flexibility, it is there. The implementation is very simple and no complexity is added for programmers who don't need the feature. That sounds as if you have an implementation ready ? If so, please submit a patch to the bugtracker. I'll evaluate it and if it is indeed simple, as you claim, I will apply the patch. Michael.___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel