[fpc-devel] An interesting thought... AI

2022-11-10 Thread J. Gareth Moreton via fpc-devel
Hi everyone, This has been something that has been on my mind for a while now, but with my increasingly more complex optimisations being developed for the Free Pascal Compiler and the code becoming an ever bigger spiderweb of conditions, it got me to start wondering... might compiler optimisat

Re: [fpc-devel] An interesting thought... AI

2022-11-10 Thread Joao Schuler via fpc-devel
This is an interesting idea indeed. https://www.researchgate.net/publication/343322212_Automatic_Code_Optimization_With_Machine_Learning_And_Combinatorial_Optimization https://www.ijresm.com/Vol.2_2019/Vol2_Iss4_April19/IJRESM_V2_I4_149.pdf - Compiler Optimization using Artificial Intelligence

Re: [fpc-devel] An interesting thought... AI

2022-11-10 Thread Sven Barth via fpc-devel
Am 10.11.2022 um 19:10 schrieb J. Gareth Moreton via fpc-devel: Hi everyone, This has been something that has been on my mind for a while now, but with my increasingly more complex optimisations being developed for the Free Pascal Compiler and the code becoming an ever bigger spiderweb of con

Re: [fpc-devel] An interesting thought... AI

2022-11-10 Thread J. Gareth Moreton via fpc-devel
That's fair.  Currently in my eyes it's more of an academic curiosity currently that i would probably take parts of and program conventionally. Funny how you mention "black box" because recently there was a news article about scientists increasingly not understanding why machine learning is wo

Re: [fpc-devel] An interesting thought... AI

2022-11-10 Thread Karoly Balogh via fpc-devel
Hi, On Thu, 10 Nov 2022, Sven Barth via fpc-devel wrote: > You still need to feed the model with the necessary rules and with > necessary training data of both correct and incorrect approaches. > > But even then *I* wouldn't want to have any of that black box mambo > jumbo in FPC, cause when a bu

Re: [fpc-devel] An interesting thought... AI

2022-11-10 Thread J. Gareth Moreton via fpc-devel
I wouldn't advocate a neural network within FPC since, yes, it would be unbelievably slow, very difficult to port and even more difficult to maintain and verify... not just to confirm correct output (e.g. BSR is good as an approximation to the expression "floor(log2(x))", but it has some awkwar

Re: [fpc-devel] An interesting thought... AI

2022-11-10 Thread Sven Barth via fpc-devel
J. Gareth Moreton schrieb am Do., 10. Nov. 2022, 23:26: > Funny how you mention "black box" because recently there was a news > article about scientists increasingly not understanding why machine > learning is working the way it is with apparent patterns of emergent > behaviour. > That and simil

Re: [fpc-devel] An interesting thought... AI

2022-11-11 Thread Christo Crause via fpc-devel
On Thu, Nov 10, 2022 at 8:10 PM J. Gareth Moreton via fpc-devel < fpc-devel@lists.freepascal.org> wrote: > Hi everyone, > > This has been something that has been on my mind for a while now, but > with my increasingly more complex optimisations being developed for the > Free Pascal Compiler and the

Re: [fpc-devel] An interesting thought... AI

2022-11-11 Thread Jonas Maebe via fpc-devel
On 11/11/2022 00:44, J. Gareth Moreton via fpc-devel wrote: My slight concern is that the x86 peephole optimizer is becoming pretty bloated now An alternative could be to specify the peephole optimizations in a pattern matching format, and then either write a tool that converts them to a bunc

Re: [fpc-devel] An interesting thought... AI

2022-11-11 Thread Marco van de Voort via fpc-devel
On 11-11-2022 09:57, Jonas Maebe via fpc-devel wrote: On 11/11/2022 00:44, J. Gareth Moreton via fpc-devel wrote: My slight concern is that the x86 peephole optimizer is becoming pretty bloated now An alternative could be to specify the peephole optimizations in a pattern matching format, an

Re: [fpc-devel] An interesting thought... AI

2022-11-11 Thread J. Gareth Moreton via fpc-devel
I'm liking these discussions! I have done some refactoring, such as attempting to 'factor out' common conditions (sometimes a matching instruction, but also commonly the operand types).  Sometimes I choose not to factor - for example, sometimes I try to compute relatively cheap conditions firs