Closed lxw-1006 closed 2 years ago
Hi @lxw-1006, good question. It depends on what you want the extra actions to do. Are the extra actions implemented in LLVM, or are they separate tools?
If the extra action you want to add can be implemented in Python, then you could consider using a wrapper class to extend the action space and handle the extra action within Python.
If you want to interact with LLVM, then you will have to modify the the source code of CompilerGym. Here is the function which applies an action in the LLVM environment:
Note there are two generated files:
which list all of the 124 passes, and how to apply them. You could extend those?
Cheers, Chris
Closing this as I have answered the question but please feel free to continue the discussion if you have follow up questions 🙂
First of all, thank you very much for your response. Secondly, the additional options we want to add can be regarded as a pass of llvm, such as different options of ollvm. Because our goal is to get the optimization sequence with the largest code difference compared with the o0 optimization sequence through compiler gym. So we think we need to modify the source code of compiler gym. Not only do we need to add additional options, we may also need to expand the additional reward section.
That sounds really interesting. In that case, take a look at the code pointers above for expanding the action space.
To add a new reward space you expose this through observations (i.e. the instruction count reward is just the change in instruction count observation from one step to the next). Here's your starting point for adding a new observation space:
I'd be interested to hear how you get on. Keep me posted! 🙂
Cheers, Chris
Hello, I'm sorry to bother you. We may need your help.We have new questions about expanding the action space of the llvm. We added 9 self-made passes on the basis of 124 passes. However, we found that the number of passes is still 129. Is there a limit on the size of the action space of the llvm, which cannot exceed 129 options?Looking forward to your reply, thank you!
Hey! Sorry for the slow response. It may be easier to have a chat to go through the changes you want to make. Shoot me an email at chrisc.101@gmail.com and we can figure out a time to hop on Zoom.
Cheers, Chris
The action space of llvm used has 124 optimization options.However, additional options are required in our research,so how should we add these optimization options to the behavior space? Is it necessary to modify the source code of compiler-gym in order to add additional optimization options?