Skip to content
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

Merged
merged 1 commit into from
Jul 17, 2019

Conversation

qstanczyk
Copy link
Contributor

Eliminate variables which are constant.
Inline memory access methods.
Benchmarking shows avg. ~30% speedup on multiple Atari games.

eliminating variables which are constant.
Benchmarking shows avg. ~30% speedup on multiple Atari games.
@mgbellemare
Copy link
Contributor

LGTM, thanks for this big performance improvement! I'm going to wait for @mcmachado to give his thumbs up before merging (==> he will merge).

@maxwellreuter
Copy link

@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?

@qstanczyk
Copy link
Contributor Author

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.

@maxwellreuter
Copy link

@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?

@qstanczyk
Copy link
Contributor Author

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.

@maxwellreuter
Copy link

@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?

@qstanczyk
Copy link
Contributor Author

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).

@maxwellreuter
Copy link

@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?

@JesseFarebro
Copy link
Collaborator

@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.

@qstanczyk
Copy link
Contributor Author

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.

@maxwellreuter
Copy link

@JesseFarebro @qstanczyk thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants