RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    [RPi 3] Optimized lr-snes9x using PGO

    Scheduled Pinned Locked Moved Ideas and Development
    snessnes9xoptimizationraspberry pi 3
    29 Posts 7 Posters 7.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G
      Griever @Darksavior
      last edited by Griever

      @darksavior As @hhromic said, links to patches are included in the OP. As for the profiling data, I'm not sure how reusable it is and wouldn't want to promote reusing data for older versions of snes9x

      Do be warned that compilation can take 15-20 minutes and profiling will be very, very slow.

      edit: Going by every other project I see that uses PGO, I doubt the data is reusable. Automating profiling isn't really feasible without macros and savestates and that's just too much effort for me.

      1 Reply Last reply Reply Quote 0
      • H
        hhromic
        last edited by

        Right, profiling data is not entirely reusable when updating the binary. You are right, I overlooked that.
        Indeed automating the profiling is not trivial to do :(

        1 Reply Last reply Reply Quote 0
        • MapleStoryM
          MapleStory
          last edited by

          Pardon my ignorance but how does one go about building lr-snes9x from source with the optimized patches?

          1 Reply Last reply Reply Quote 0
          • DarksaviorD
            Darksavior
            last edited by Darksavior

            @Griever Yes, if it's not too much trouble, a brief tutorial would be nice on how to use the patches. I know enough to dive in the .sh installer file and change stuff.

            1 Reply Last reply Reply Quote 0
            • DarksaviorD
              Darksavior
              last edited by Darksavior

              With snes9x 1.57 out I finally decided to take a stab at this and manually edit the changes since I have no idea how to use patches. Seems to be working.

              MapleStoryM 1 Reply Last reply Reply Quote 0
              • MapleStoryM
                MapleStory @Darksavior
                last edited by

                @Darksavior

                Did you do anything other than copy Griever's RetroPie-Setup changes? I replaced my system.sh and lr-snes9x.sh files to match his, updated lr-snes9x from source and despite now being on 1.57, the core runs worse than the binary he posted in the original post of this thread.

                DarksaviorD 1 Reply Last reply Reply Quote 0
                • DarksaviorD
                  Darksavior @MapleStory
                  last edited by Darksavior

                  @MapleStory I had that problem at first until I read his first post which says

                  "Note that you need to comment out CXXFLAGS, LDFLAGS and uncomment the other CXXFLAGS variable when generating the optimized binary."

                  Do that and you'll be good to go.

                  #CXXFLAGS+=" -fprofile-dir=/home/pi/pgo/out -fprofile-generate=/home/pi/pgo/out"

                  CXXFLAGS+=" -fprofile-dir=/home/pi/pgo/out -fprofile-use=/home/pi/pgo/out"

                  #LDFLAGS+=" -lgcov"

                  MapleStoryM 1 Reply Last reply Reply Quote 0
                  • MapleStoryM
                    MapleStory @Darksavior
                    last edited by MapleStory

                    @Darksavior

                    Thanks, made the changes and it compiled successfully but Kirby's Dreamland 3 cat/hamster room fluctuates between 58.7-59fps. Doesn't get to a clear 60fps. Griever's binary in the first post, however, maintains a stable 60fps throughout. Other than compiling lr-snes9x from source after editing the scripts, was there any other updates I should've done?

                    DarksaviorD mituM 2 Replies Last reply Reply Quote 0
                    • DarksaviorD
                      Darksavior @MapleStory
                      last edited by Darksavior

                      @MapleStory I only tested it against the official build on a pi3b non-plus at 1300 and it was an improvement over that one. It's still not as fast as the Griever's build. I wouldn't know what else would be required to improve it. A pi3b+ user should be fullspeed on 1.57 unless you use the slowdown fix hack. This is my first time editing building options so I'm rather new to this.

                      1 Reply Last reply Reply Quote 0
                      • mituM
                        mitu Global Moderator @MapleStory
                        last edited by

                        @MapleStory The final binary use profiling(performance) data - i.e. you run the emulator a few times, in the games you're interested on improving performance, and some performance data is generated. Then you re-compile the binary again, this time the compiler reads the performance data and produces another binary that takes into account this perf data, with some new optimisations added based on the data.

                        That's why @Griever said it's difficult to automate the build of such compiler, it's practically non-automated if you want to have meaningful results.

                        1 Reply Last reply Reply Quote 1
                        • pjftP
                          pjft
                          last edited by

                          So, I've been meaning to ask in case anyone had tried it out: if I use the binary above on a pre-RA 1.57 setup, will it still be an improvement/will it at least run, or are the improvements dependent on updating RetroArch as well? I'm not keen on updating it as I have a stable, working setup and I'm under the impression I read a few things changed on the performance front.

                          DarksaviorD mituM 2 Replies Last reply Reply Quote 0
                          • DarksaviorD
                            Darksavior @pjft
                            last edited by

                            @pjft Try it. Be adventurous and just go for it. Back up your build, of course.

                            1 Reply Last reply Reply Quote 1
                            • mituM
                              mitu Global Moderator @pjft
                              last edited by

                              @pjft You can try the core provided, but for sure the save states wouldn't work and there have been some modifications in the recent core version to accomodate the run-ahead feature introduced with RA 1.7.2 (?), so they might be imcompatibilities.

                              1 Reply Last reply Reply Quote 2
                              • pjftP
                                pjft
                                last edited by

                                @mitu @Darksavior Sounds good. I'll create a separate emulator entry and try it out.

                                Thanks.

                                1 Reply Last reply Reply Quote 0
                                • MapleStoryM
                                  MapleStory
                                  last edited by MapleStory

                                  The RetroPie-setup script updated today and now I can't update lr-snes9x from source with the PGO changes. Anyone else having this issue?

                                  EDIT: Found the problem. So it seems like there's a limit to how many games you can profile, otherwise it will crap out during compiling the optimized core. I probably profiled 15-20 games, so I think it's better off to just go with 5-10.

                                  1 Reply Last reply Reply Quote 0
                                  • First post
                                    Last post

                                  Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                                  Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.