Re: [fpc-devel] Vectorization
The idea I had currently (this is without looking at any previous theory) was to use a kind of sliding window, similar to how ZIP and other LZ77-based algorithms work when compressing repeating strings, to look backwards in the current block for a matching command and then scan forward. If the scan gets up to the instruction right before the starting point, then it's potential for vectorisable code. Using the previous example: movss 16(%rsp),%xmm0 addss 32(%rsp),%xmm0 movss %xmm0,(%rax) movss 20(%rsp),%xmm0 addss 36(%rsp),%xmm0 movss %xmm0,4(%rax) Starting at the 4th command, it looks back to find a match in the 1st command, albeit with Ann address that differs only by 4. As it scans forward, it finds similar matches in subsequent commands, and eventually realises the entire block could potentially be vectorised. If it continues, it finds the code fragment repeats 4 times and can be vectorised with little difficulty. Being only SSE commands helps too. Kit P.S. I did look at the loop unrolling code, but it almost never triggers due to the small instruction cache that's assumed. For x86-64, is it safe to assume a cache length of 60 instead of 30, since almost all modern Intel and AMD processors have 56+ elements in their queues. On Sun 10/12/17 13:50 , "Florian Klämpfl" flor...@freepascal.org sent: > Am 10.12.2017 um 02:29 schrieb J. Gareth Moreton: > > > Hi everyone, > > > > > > Since I'm masochistic in my desire to understand > and improve the Free Pascal Compiler, I would like to add > > some vectorisation support in its optimisation > cycle, since that is one thing that many other compilers > > attempt to do these days. But before I begin, > does FPC support any kind of vectorisation already? If it > > does I haven't been able to find it yet, and I > don't want to end up reinventing the wheel. > > > I started once to work on this, but never merged it into fpc trunk, it > might be even only in my > local git check out, I can look for it. > > > > > > > > I'm sure it's a mammoth task, but I would like > to start somewhere with it - however, are there any design > > plans that I should be adhering to so I don't > end up designing something that is disliked? > > > > > > Well, basically it means that another pass (like e.g. unroll_loop in > optloop.pas) of the tree must > be added which generated operations as they can be encoded by -Sv. To do > this efficiently, probably > some previous simplification of the tree is needed. But this is something > for later. > __ _ > > 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] Compiler error for target AVR - r37660
Am 04.12.2017 um 20:19 schrieb Christo: >> >> I guess I'm missing something? > > OK, missed a comment marker in the config file which is now fixed. Now I get > the origninal error > - Cannot find system type "variant" It should be fixed meanwhile. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Quickly recompiling fpc
On 09.12.2017 16:57, Sven Barth via fpc-devel wrote: Am 09.12.2017 14:57 schrieb "Benito van der Zander">: Hi, how do you recompile fpc after making a small change in the compiler, like enabling the debugmsg define in x86/aoptx86.pas? make buildbase says nothing was changed, and make clean; make buildbase recompiles not just the compiler, but also the rtl, which is a waste of time. Build it in the Lazarus IDE using the corresponding project for your platform (this will result in a compiler//pp(.exe) binary). Other than that "make cycle" inside the compiler directory *is* the recommended way to rebuild the compiler even if it rebuilds both the compiler and the RTL multiple times. I only extend: don't forget you can use the "Run Parameters" dialog to debug the modified compiler with a sample PAS program. Ondrej ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Quickly recompiling fpc
Am 09.12.2017 um 14:49 schrieb Benito van der Zander: > Hi, > > how do you recompile fpc after making a small change in the compiler, like > enabling the debugmsg > define in x86/aoptx86.pas? > > make buildbase says nothing was changed, and make clean; make buildbase > recompiles not just the > compiler, but also the rtl, which is a waste of time. For compiler development, I do not use the makefiles, I just use lazarus and work with the executables fpc builds when invoked from lazarus. Alternatively, you can do something like cd fpc/compiler rm ppc386 make ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Vectorization
Am 10.12.2017 um 02:29 schrieb J. Gareth Moreton: > Hi everyone, > > Since I'm masochistic in my desire to understand and improve the Free Pascal > Compiler, I would like to add > some vectorisation support in its optimisation cycle, since that is one thing > that many other compilers > attempt to do these days. But before I begin, does FPC support any kind of > vectorisation already? If it > does I haven't been able to find it yet, and I don't want to end up > reinventing the wheel. I started once to work on this, but never merged it into fpc trunk, it might be even only in my local git check out, I can look for it. > > I'm sure it's a mammoth task, but I would like to start somewhere with it - > however, are there any design > plans that I should be adhering to so I don't end up designing something that > is disliked? > Well, basically it means that another pass (like e.g. unroll_loop in optloop.pas) of the tree must be added which generated operations as they can be encoded by -Sv. To do this efficiently, probably some previous simplification of the tree is needed. But this is something for later. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Vectorization
Am 10.12.2017 um 14:03 schrieb Marco van de Voort: > In our previous episode, J. Gareth Moreton said: >> Since I'm masochistic in my desire to understand and improve the Free Pascal >> Compiler, I would like to add >> some vectorisation support in its optimisation cycle, since that is one >> thing that many other compilers >> attempt to do these days. But before I begin, does FPC support any kind of >> vectorisation already? > > Yes, -Sv, but it is buggy. Well, -Sv means that operations on vectors are supported but it does not mean that FPC detects vectorizable operations by itself. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Vectorization
In our previous episode, J. Gareth Moreton said: > Since I'm masochistic in my desire to understand and improve the Free Pascal > Compiler, I would like to add > some vectorisation support in its optimisation cycle, since that is one thing > that many other compilers > attempt to do these days. But before I begin, does FPC support any kind of > vectorisation already? Yes, -Sv, but it is buggy. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel