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

Sven Barth pascaldragon at googlemail.com
Thu Nov 10 23:17:56 CET 2022


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 conditions, it got me to start wondering... might 
> compiler optimisation be a candidate for AI? Often I try to 
> hand-optimise assembly language to get the same output in fewer cycles 
> (and fewer bytes too if possible), and then see if I can program the 
> compiler to match it.  I can't hope to catch every possible 
> optimisation though, and I wonder if using an AI in some way to 
> develop more efficient machine code has ever been a serious contender 
> for research.  I have heard of stories like the Deepmind AI finding a 
> faster way to multiply matrices, so it seems logical that it can 
> improve instruction processes.

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 bug occurs in the optimizations due to some 
decision the model made... well... tough luck. With the current approach 
you need to bash your head a bit against the next wall to find the 
location of the issue, but with a machine learning approach (let's not 
call it AI, cause there's nothing “intelligent” about that) you can't 
even do that. You can only fiddle with what you fed into the model and 
hope for the best (and wonder why it now fails at a completely different 
area).

Regards,
Sven


More information about the fpc-devel mailing list