Large Language Models for Compiler Optimization
51–60 of 119 posts
Re: Large Language Models for Compiler Optimization
#52This is very interesting work, but it's not really a LLM. It doesn't have language abilities. They should have called it a seq2seq model, but I think that term is not in vogue these days :)
Re: Large Language Models for Compiler Optimization
#53Re: Large Language Models for Compiler Optimization
#54LLm's are agi, you can use them for anything so posts like "LLm's for x" are really so boring.
Re: Large Language Models for Compiler Optimization
#55Chatgpt4 can do source to source optimization which is pretty cool. I got it to beat gcc at -03 on simple small toy problems. and it can do similar things with python also. But it threw its hands up when I gave it a longer piece of code to optimize.
The toy example for those curious: #include int main(void) { int i; int a[2000] ; for(i = 0; i This program initializes an array `a` of size 2000, populates it with integers from 0 to 1999, and then prints the value at index 5, which is 5. Just as with the Python program, we can optimize this program significantly. Given that we're only interested in the sixth element (index 5) of the array, we don't need to construc…
Re: Large Language Models for Compiler Optimization
#56Earlier quoted context omitted.
It's probably both that is leaking your source out and the risk of it being a copyright violation if it spits out some GPL source verbatim and you check it in.
> if it spits out some GPL source verbatim Does that ever actually happen? I've only heard of it happening to people who forced the AI's hand by including the comments for said code in the prompt.
Re: Large Language Models for Compiler Optimization
#57I have used ChatGPT on some fairly awful code, asking it to add comments, rename variables and functions, etc. I find the outputs useful, but a couple of times it's broken the code. I imagine for many (not all) languages, you could ask the LLM to produce suggested changes, then use a code-rewriting tool to apply them in a way you could be 100% sure they weren't going to change the behaviour of the progrma.
Re: Large Language Models for Compiler Optimization
#58LLm's are agi, you can use them for anything so posts like "LLm's for x" are really so boring.
Re: Large Language Models for Compiler Optimization
#59While this isn't optimization, is there any LLM systems that create "provably correct" transformations yet? I have used ChatGPT on some fairly awful code, asking it to add comments, rename variables and functions, etc. I find the outputs useful, but a couple of times it's broken the code. I imagine for many (not all) languages, you could ask the LLM to produce suggested changes, then use a code-rewriting tool to appl…
Re: Large Language Models for Compiler Optimization
#60Earlier quoted context omitted.
It does make sense that ChatGPT can beat gcc (or any compiler really); the compiler is forced to optimise code so that it still appears to work as if it's the source you wrote. Most importantly, if there are observable side-effects, compilers must preserve them, even though you know you don't actually care about them. An AI is not bound to preserve those, and can semantically change what you wrote, so long as the one…
It seems like compilers should have an interactive mode where it suggests code that is very similar but not technically perfectly the same that is more efficient and the can accept or decline the alternate version.
clippy in rust, for example, will tell you about removing needless allocations, etc, which a backend compiler might have a harder time doing.