-
Notifications
You must be signed in to change notification settings - Fork 417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize Atari emulator by ~30% #265
Conversation
eliminating variables which are constant. Benchmarking shows avg. ~30% speedup on multiple Atari games.
LGTM, thanks for this big performance improvement! I'm going to wait for @mcmachado to give his thumbs up before merging (==> he will merge). |
@qstanczyk I'm looking to emulate my Atari games as fast as possible. Do you have a feeling for how much room there is for optimization, if any? If so, what sort of speedup % do you think is possible? |
Hi Max, I didn't have time myself to do that, but I had an idea of providing games' ROM converter to C++. Currently ALE implements full Atari instruction set and performs interpretation of ROM. Instead ROM could be converted to C++/intermediate representation and JIT-compiled. That could give order of magnitude speedup, but is a longer effort. |
@qstanczyk thanks for your reply. Do you know how much of an effort that would be and what sort of skills/tools would be needed to do that? |
It requires C++ knowledge and some profiling/optimization experience. Would be best I guess if instead of generating C++ it would generate Intermediate Representation and JIT with LLVM (https://llvm.org/docs/LangRef.html). This approach is basically a re-write of ALE. |
@qstanczyk ok, thanks -- do you know what sort of time commitment that would be? would it be less if I only focused on one game such as breakout? If so how much of a time commitment would that be? |
With some LLVM prior experience... I would say 3 weeks of actual work. Doing that for one specific game might be slightly easier, as ROMs have different versions with different operation sets (so doing that as a proof of concept for some specific game is a good start anyway). |
@qstanczyk how long do you think it would take for someone to get up to speed without any experience with LLVM, working with ROMs, or profiling/optimization, so that they can be effective? |
@maxwellreuter if you haven't heard of the CUDA port of the ALE you could also check that out. Depending on what you're trying to do that could provide some wall-time improvements. |
Hard to tell, depends on the background, approach (do you want to understand details or just get things done)... but Jesse has a point - GPU environment might be a fast option for you. |
@JesseFarebro @qstanczyk thanks! |
Files are copied unmodified for ease of verifying authenticity. Includes major changes: * Farama-Foundation/Arcade-Learning-Environment#264 * Farama-Foundation/Arcade-Learning-Environment#265 * Farama-Foundation/Arcade-Learning-Environment#327 * Farama-Foundation/Arcade-Learning-Environment#348
Files are copied unmodified for ease of verifying authenticity. Includes major changes: * Farama-Foundation/Arcade-Learning-Environment#264 * Farama-Foundation/Arcade-Learning-Environment#265 * Farama-Foundation/Arcade-Learning-Environment#327 * Farama-Foundation/Arcade-Learning-Environment#348
Eliminate variables which are constant.
Inline memory access methods.
Benchmarking shows avg. ~30% speedup on multiple Atari games.