Author Topic: [Release] Thread Optimizer - adjust thread parameters to achieve max performance  (Read 41567 times)

Offline Graphene

  • Useful Idiot
  • ***
  • Posts: 108
    • View Profile
Thread optimizer is plugin + config application set that allows you to adjust thread priority and CPU affinity mask of any threads created by game to achieve maximum performance.

Disclaimer:

This plugin is intended for users who at the very least understand the concept of threading.
If you have no idea what you are doing, you have the option to wait until someone else shares their preset for the game you want.


I am not responsible for any lost game progress or corrupted savedata caused by improper thread adjustments.

Please read all instructions carefully before installing!

1. Required plugins:

Thread Optimizer requires following plugins to be installed on your system:
- CoreUnlocker80000H (https://forum.devchroma.nl/index.php/topic,203.0.html).
- ioPlus (https://forum.devchroma.nl/index.php/topic,205.0.html).

Make sure you have both of them installed before continuing.

2. What is snapshot?

Snapshot is the file that holds information about all threads that game has created. Once snapshot has been made, it is also used as preset to store user-edited thread parameters.
Snapshot contains following information for each of the threads:
- CRC16 (checksum used to identify thread)
- Thread entry function address (used only to calculate CRC16)
- Thread name
- Thread priority <- can be edited in config app
- Thread CPU affinity mask <- can be edited in config app

3. Thread parameters that you can change:

- CPU afiinity mask
Determines wich CPU cores will be allowed to run the thread.

- Priority
Determines thread priority. Lower the number, higher the priority. It is not recommended to adjust it unless you know what you are doing.

4. Usage procedure:

- Install plugin and application.
Plugin can be installed under *ALL or under games you want to use it with.

- Launch the game you want to create preset for.

- Take a snapshot of game threads by holding LTRIGGER + RTRIGGER + SQUARE until you see notification.
Since snapshot accumulates all thread data since the game start, it is recommended that you at least get into the actual gameplay before taking a snapshot.
You can delete snapshot you just created by holding LTRIGGER + RTRIGGER + TRIANGLE. However, snapshots that has been taken in different game session can only be deleted from config app.

- Exit the game, open config app and adjust thread parameters of the snapshot and save it.

- Open the game again. New thread parameters will be applied automatically.

- You can delete snapshot from config application if you are not happy with your adjustments and start from scratch.

- Snapshots are stored in ux0:data/ThreadOptimizer/*titleid*/
Snapshots do not contain any personal data and can be shared with other users.

5. Current limitations:

- Parameters of the main thread cannot be adjusted.
- Threads that have same name, entry function address, priority and CPU affinity mask are considered to be the same.

TO usage guide: https://forum.devchroma.nl/index.php/topic,210.msg627.html#msg627

Download here: https://github.com/GrapheneCt/ThreadOptimizer/releases

Example of good snapshot profile (download link in the video description):

With Thread Optimizer:



Same level without Thread Optimizer:

« Last Edit: July 11, 2020, 08:58:33 PM by Graphene »

Offline Graphene

  • Useful Idiot
  • ***
  • Posts: 108
    • View Profile
Fixed an issue that caused some games not registering an input.

Offline Graphene

  • Useful Idiot
  • ***
  • Posts: 108
    • View Profile
Thread Optimizer has been updated:

- Adds support for threads created by PTHREAD_PRX module (unity games).
- Adds support for threads created by SceLibc module (??? games).

Only plugin was updated, no need to reinstall .vpk if you already have it installed.

Offline Graphene

  • Useful Idiot
  • ***
  • Posts: 108
    • View Profile
Thread Optimizer has been updated yet again:

- Fixed thread detection (previuosly entry function address was used, now CRC16 is used)

Offline Graphene

  • Useful Idiot
  • ***
  • Posts: 108
    • View Profile
Due to the popular demand, here is the good example of TO profile for Killzone Mercenary made by zanderman2009.
Download link in the video description:

With Thread Optimizer:



Same level without Thread Optimizer:

« Last Edit: July 03, 2020, 05:00:39 PM by Graphene »

Offline ZeeThirtyTwo

  • End User
  • *
  • Posts: 1
    • View Profile
So I played around with the snapshot for Jak and Daxter: The Precursor Legacy US version (PCSA00080) for a few hours and have all four cores being used quite heavily. I have tested the first four areas, not including Misty Island, at native resolution, capped at 30fps via Vitagrafix and 500Mhz through PSVshell v1.1. The game runs at 30fps most of the time and drops to about 25fps when drawing long distances. The game typically hovers between about 30fps to 45fps sometimes hitting 60fps when the cap is raised and resolution lowered. Raising the cap to 60fps makes the game run at half speed when the framerate is chugging along between 30fps to 45fps, so realistically we won't be able to play the game at 60fps ever.

I'm sure there's still plenty of tweaking to be done with better understanding of what the threads I'm assigning to cores actually do. I have not compared this to stock clocks without Thread Optimizer enabled since I know the game shipped sub native resolution with a 20fps cap. I plan on continuing to try to improve performance in this and other games on my spare time and would love to see what others can achieve with this awesome plugin. Many thanks to Graphene.

I have attached my current modified snapshot to this post (07/03/2020). Copy and paste the unzipped folder to your ux:0/data/ThreadOptimizer folder. Let me know how this works out for you and maybe we can achieve a locked 30fps at native resolution in the future!
« Last Edit: July 04, 2020, 04:56:05 AM by ZeeThirtyTwo »

Offline justalex

  • End User
  • *
  • Posts: 10
    • View Profile
Hey, I've made more progress on Killzone Mercenearies - I'm a bit of a perfectionist so I've made a console like profile - super smooth, consistent FPS - and a combat profile - lightning fast combat and low input latency by the looks of it, it'll keep up however fast you can shoot ;)

I've attacvhed the high performance profiles and only called them that because of the performance. I've tested them a good bit and the vita never breaks a sweat or ever freezes or crashes and never goes above 31c which is standard temps without a profile, the vita is a cracking piece of hardware.

Here's what the combat profile looks like
https://youtu.be/DtmWfZvLMdE

And this is the console profile:
https://youtu.be/db4VnDdPJJg

Both profiles are attached to this post


NOTE: Turning off native resolution is fantastic
https://youtu.be/jbW1U4kqWdQ

EDIT NOTE: This is all on 444mhz clock speed, I find it plays smoother. It doesnt happen all the time but it can feel like 500mhz can throw the profile a curve ball and it'll sometimes slowdown, that and I tested the profile exclusively on 444mhz :)
« Last Edit: July 06, 2020, 02:44:58 PM by justalex »

Offline justalex

  • End User
  • *
  • Posts: 10
    • View Profile
I messed around with Uncharted for a little bit, the problem is getting the cpu to rev up at all but I managed a bit more cpu usage. I was thinking it might be better trying single cores for each thread as multicore seems to kill cpu usage.


Offline justalex

  • End User
  • *
  • Posts: 10
    • View Profile
Wipeout 2048 Profiles. I've made two profiles again, this time for Wipeout 2048

Just realised that I uploaded two high intensity profiles. I havent had time lately to make any videos but I've attached my final attempt at Wipeout.

I'll include the previous profile as well. The High Intensity version is really good, the Final Version is slightly tweaked for smoothness and speed and has some FPS increases and improvements in average FPS

Link attached to post.

VIDEO @444mhz, 960x540, 60 FPS, Sharpscale Point filter, Wipeout High Intensity Profile
https://youtu.be/yuoqiTVryDE
« Last Edit: July 13, 2020, 12:55:02 PM by justalex »

Offline justalex

  • End User
  • *
  • Posts: 10
    • View Profile
TIPS AND TRICKS

Attaching the tips and tricks as a text file to make scrolling less annoying and tidied up and made the tips a bit clearer.
« Last Edit: July 31, 2020, 02:33:12 PM by justalex »

Offline kristianity77

  • End User
  • *
  • Posts: 11
    • View Profile
Any chance this can work with retroarch to squeeze a bit more performance out on consoles like snes to iron out the few games that don't quite hit 60fps consistently?

teakhanirons

  • Guest
Any chance this can work with retroarch to squeeze a bit more performance out on consoles like snes to iron out the few games that don't quite hit 60fps consistently?
Emulation in RetroArch is single threaded if I'm not wrong.
In any case, it'd be better to have 4th core support added to homebrew properly in their own source codes. Detection code for it is present in its config app.
« Last Edit: July 13, 2020, 10:52:52 PM by teakhanirons »

Offline justalex

  • End User
  • *
  • Posts: 10
    • View Profile
Spiderman keeps crashing so i cant get a full playthrough or all of the level threads.

Graphene how difficult would it be to add threads to already existing profiles? Thats the only way i could see to get all the level threads

Unless someone can manage a full playthrough, take a snapshot after the final boss and post the profile, i've tried 3 times and i dont see it happening
« Last Edit: July 16, 2020, 10:54:43 PM by justalex »

Offline justalex

  • End User
  • *
  • Posts: 10
    • View Profile
I've attached a Spiderman Profile with something I just found out 10 minutes ago...

Enable all four cores on the level threads in Spiderman and lower the priority, to be honest I dont think it matters that much what values you enter, as long as they're between 100 and 160

The values in the profile are the first values I entered and it plays incredibly. The sound crackles at some points but thats because this is a profile I worked on before and didnt fix the sound but its nowhere near game breaking.

A profile could be made in parts.
- play an hour of the game and take a snapshot
-Repeat for the rest of the game
- enable allc ores and enter a priority between 100 and 160 at a guess

Thats it. If every game was made like this we'd have a super console. Spiderman is actually one of the best made games on the vita. Textures get added the faster the game plays. The spider boss is slightly more textured.

Demo Profile attached

VIDEO:
https://youtu.be/TTuQ9fEGnV4
« Last Edit: July 22, 2020, 12:06:13 AM by justalex »

Offline justalex

  • End User
  • *
  • Posts: 10
    • View Profile
Does anyone have any ideas for good underrated games that had framerate issues?