Re: [fpc-devel] x86_64 Optimizer Overhaul
It is indeed such a complex system. I wouldn't say that I've identified a bottleneck per se, but I've chosen to focus my improvements there. The idea behind the overhaul is that it attempts to reduce the number of passes during the peephole optimizer stage - given that I've managed to shave off 15 seconds from the compile time of Lazarus, I figure I might be onto something. Generally, a good place to start with bottlenecks are routines that are most frequently entered, because any slow-downs there can very quickly multiply. For a recent example, I looked at OptPass1MOV and figure I could refactor parts of it to reduce the number of calls to "GetNextInstruction", which can take a while sometimes because it's stepping through a linked list which might not always be cached. Otherwise it's a matter of simplifying some of the conditions. Otherwise, I'm the kind of perfectionist who just looks at a wall of assembly language and thinks "that could be improved", even if it's just one cycle. But the nice thing about open source projects like this is that we can all have our individual specialisations and skillsets and choose to focus our efforts on individual parts of the compiler. If you ask me, if you see something that could be improved, pass your ideas on and submit a patch if you like. It's worth doing some tests to confirm if you've made a saving, although the hardest one to determine is if your compiled binary runs faster or not. Gareth On Wed 12/12/18 03:51 , "Ryan Joseph" r...@thealchemistguild.com sent: I’ve spent some time in the compiler sources now and I’m curious just where people think the bottle necks for performance actually are. It’s such a complicated system for anyone one person to have a good understanding of so it’s not clear where to begin looking. > On Dec 12, 2018, at 9:42 AM, J. Gareth Moreton wrote: > > The overhaul primarily increases the speed of compilation, but it makes some minor improvements to conditional branches here and there. Nevertheless, I'm always happy to find a saving here and there in the compiled assembly language! Regards, Ryan Joseph ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] x86_64 Optimizer Overhaul
I’ve spent some time in the compiler sources now and I’m curious just where people think the bottle necks for performance actually are. It’s such a complicated system for anyone one person to have a good understanding of so it’s not clear where to begin looking. > On Dec 12, 2018, at 9:42 AM, J. Gareth Moreton > wrote: > > The overhaul primarily increases the speed of compilation, but it makes some > minor improvements to conditional branches here and there. Nevertheless, I'm > always happy to find a saving here and there in the compiled assembly > language! Regards, Ryan Joseph ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Documentation check
I'll have to look that one up. I might have reinvented the wheel a bit with the binary search algorithm that I put on there ages ago, which is of O(log n) and works even if the range of test values is sparse (I came up with the algorithm originally for the case block in the peephole optimiser, where there are many hundreds if not thousands of individual opcodes, but only a handful actually have branches. The jump table is of O(1), but starts becoming prohibitive if the range is sparse. Gareth On Tue 11/12/18 19:48 , Marco van de Voort f...@pascalprogramming.org sent: Op 2018-12-11 om 17:12 schreef J. Gareth Moreton: > > I've just written up a new segment on the Wiki about how jump tables > work. Since I want to look at implementing my binary search option, I > thought I'd document what already exists; > > http://wiki.freepascal.org/Case_Compiler_Optimization [1]">http://wiki.freepascal.org/Case_Compiler_Optimization > > The "Jump Table" section is what I've added. Can people check to see > that I've got it correct? I had to go back and edit it a few times > because I got the AT">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel Links: -- [1] http://wiki.freepascal.org/Case_Compiler_Optimization ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] x86_64 Optimizer Overhaul
I think this was intended for the mailing list - I'm looking forward to it too. Depends on what Florian says though. The overhaul primarily increases the speed of compilation, but it makes some minor improvements to conditional branches here and there. Nevertheless, I'm always happy to find a saving here and there in the compiled assembly language! Gareth On Tue 11/12/18 20:57 , Ched charles.edouard.des.vastes.vig...@gmail.com sent: Hello Gareth, I'm looking forward for the implementation of your optimizer, as the gain of speed of execution for programs running hours a day is very welcome ! But I'll wait for an official upgrade of the production trunk. Cheers, Ched' Le 09. 12. 18 à 22:39, J. Gareth Moreton a écrit : > Because of how intertwined my work is, I can't easily work on something else until I know if this > overhaul is accepted or rejected. However, in the meantime, would anyone object if I start porting it to > i386, so I can get rid of all those horrible $ifdef's more than anything? From the little I've observed, > i386 still works as it does normally, which was the original intention so x86_64 can be tested in isolation. > > Gareth aka. Kit > > > ___ > 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] Documentation check
Op 2018-12-11 om 17:12 schreef J. Gareth Moreton: I've just written up a new segment on the Wiki about how jump tables work. Since I want to look at implementing my binary search option, I thought I'd document what already exists; http://wiki.freepascal.org/Case_Compiler_Optimization The "Jump Table" section is what I've added. Can people check to see that I've got it correct? I had to go back and edit it a few times because I got the AT and Intel operand ordering mixed up! I'm not really a compiler person, but afaik for large n, the number of tests can be log(n) using a bisection algorithm. The microchip C (pic16/18/24/33) compilre implements this. IOW the number of linear tests is not the metric to compare to. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[fpc-devel] Documentation check
Hi everyone, I've just written up a new segment on the Wiki about how jump tables work. Since I want to look at implementing my binary search option, I thought I'd document what already exists; http://wiki.freepascal.org/Case_Compiler_Optimization The "Jump Table" section is what I've added. Can people check to see that I've got it correct? I had to go back and edit it a few times because I got the AT and Intel operand ordering mixed up! Gareth aka. Kit ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] rfc: win32/win64 buildscript
I'll give it a whirl when I next build FPC, since I play with win32 and win64 optimisations quite a bit. Thanks Marco. Gareth aka. Kit On Tue 11/12/18 11:57 , Marco van de Voort f...@pascalprogramming.org sent: Hello, Because I got a new (Ryzen 5 2600) machine, last night I worked on improving my buildscript a bit. It is the script that I run after a SVN update to rebuild and install a snapshot. This mail is both meant as its publishing as a request for comment from people that maintain their own scripts. Since my ISP doesn't allow to attach .cmd's, I put it on my website: http://www.stack.nl/%7Emarcov/files/buildscript.zip [1]">http://www.stack.nl/~marcov/files/buildscript.zip The script allows building for win32 and win64, and has several parameterizable options, configurable by editing batch variables in the script, and warns if a step (build or install) went wrong. I use two copies of this, one for win32 and one for win64. (one line difference). Please read over the first half to check variables. It assumes a FPC directory (with tools like make etc) in the %PATH%, but allows to use the starting compiler to be specified explicitely. This is so that it works when I have a development snapshot in the path, but still want to start the build using the release compiler. Also attached is a small FPC program used to measure buildtime. Again: comments welcome. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org [2] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel [3]">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel Links: -- [1] http://www.stack.nl/%7Emarcov/files/buildscript.zip [2] mailto:fpc-devel@lists.freepascal.org [3] 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
[fpc-devel] rfc: win32/win64 buildscript
Hello, Because I got a new (Ryzen 5 2600) machine, last night I worked on improving my buildscript a bit. It is the script that I run after a SVN update to rebuild and install a snapshot. This mail is both meant as its publishing as a request for comment from people that maintain their own scripts. Since my ISP doesn't allow to attach .cmd's, I put it on my website: http://www.stack.nl/~marcov/files/buildscript.zip The script allows building for win32 and win64, and has several parameterizable options, configurable by editing batch variables in the script, and warns if a step (build or install) went wrong. I use two copies of this, one for win32 and one for win64. (one line difference). Please read over the first half to check variables. It assumes a FPC directory (with tools like make etc) in the %PATH%, but allows to use the starting compiler to be specified explicitely. This is so that it works when I have a development snapshot in the path, but still want to start the build using the release compiler. Also attached is a small FPC program used to measure buildtime. Again: comments welcome. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel