Compiler generated feedback for Large Language Models
We introduce a novel paradigm in compiler optimization powered by Large
Language Models with compiler feedback to optimize the code size of LLVM
assembly. The model takes unoptimized LLVM IR as input and produces optimized
IR, the best optimization passes, and instruction counts of both unoptimized
and optimized IRs. Then we compile the input with generated optimization passes
and evaluate if the predicted instruction count is correct, generated IR is
compilable, and corresponds to compiled code. We provide this feedback back to
LLM and give it another chance to optimize code. This approach adds an extra
0.53% improvement over -Oz to the original model. Even though, adding more
information with feedback seems intuitive, simple sampling techniques achieve
much higher performance given 10 or more samples.
66010123e3faf4b4d95c4484
Dejan Grubisic
admin_assigned
2024-03-25T11:47:04.538Z
65d8b5a3132f10d591f3c00f
/avatars/3939f9582d882128dc2e64b0220f3844.svg
Dejan Grubisic
user
dejangrubisic
66010123e3faf4b4d95c4485
Chris Cummins
admin_assigned
2024-03-25T11:47:11.670Z
63d32301c20657d2434d2fcb
https://cdn-avatars.huggingface.co/v1/production/uploads/1674781395584-noauth.jpeg
Chris Cummins
user
ChrisCummins
66010123e3faf4b4d95c4486
Volker Seeker
66010123e3faf4b4d95c4487
Hugh Leather
Compiler generated feedback for Large Language Models
We introduce a novel paradigm in compiler optimization powered by Large
Language Models with compiler feedback to optimize the code size of LLVM
assembly. The model takes unoptimized LLVM IR as input and produces optimized
IR, the best optimization passes, and instruction counts of both unoptimized
and optimized IRs. Then we compile the input with generated optimization passes
and evaluate if the predicted instruction count is correct, generated IR is
compilable, and corresponds to compiled code. We provide this feedback back to
LLM and give it another chance to optimize code. This approach adds an extra
0.53% improvement over -Oz to the original model. Even though, adding more
information with feedback seems intuitive, simple sampling techniques achieve
much higher performance given 10 or more samples.
A feedback-driven Large Language Model optimizes LLVM IR for code size, improving upon existing methods with iterative refinement and sampling techniques.
Large Language Models LLVM IR compiler optimization instruction counts -Oz sampling techniques