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

Async #4876

Merged
merged 4 commits into from
Jul 14, 2018
Merged

Async #4876

merged 4 commits into from
Jul 14, 2018

Conversation

kd-11
Copy link
Contributor

@kd-11 kd-11 commented Jul 11, 2018

  • Implements asynchronous decompiling of shaders

NOTE: Includes fixes from #4869 for testing
NOTE2: When shaders are loading in there will be extreme pop-in (missing graphics that will slowly resolve). This is normal. You can disable this functionality in config.yml, set "Disable asynchronous shader compiler" to true.

@ruipin
Copy link
Contributor

ruipin commented Jul 11, 2018

I'm curious, and so people are aware, should we expect similar issues to those that Dolphin saw when they tried asynchronous shaders? Or do these kinds of issues not occur in RPCS3?

I'll quote their Ubershaders blog post:

In the end, it just came down to the fact that the people who could have implemented [asynchronous shaders] along with other core developers were against it as a solution. They saw it as nothing more than a hack that would cause a lot of false positives on the issue tracker and cause bigger issues down the road. Those worries were proven somewhat valid when you realize that some games need objects to be rendered on the frame they expect it to be. In this case, the Mii heads are only rendered once to the Embedded Framebuffer. If the EFB copy is missing because of Async Shader Compilation, the Mii heads will not show up for the remainder of the game or until they're regenerated.

@vietnam13231
Copy link

In all games I tested (P5, Project Diva, Drakengard 3, NieR Replikant, Infamous), it works just as note2 says, massive pop-ups everywhere, and have not met with any problems. It lags when few first shaders are loading, after that it plays while loading more and more, and at the end works as normal. No drops or increase in performance, no dropping OOB. That's why I'm not sure if it's a needed thing at all...

@Asinin3
Copy link
Contributor

Asinin3 commented Jul 11, 2018

Try with this PR vs Master with Asura's Wrath or Uncharted, the difference is huge. Asura's Wrath doesn't perform well on master unless you spend atleast a few hours compiling shaders. With this PR the amount of shaders that compile is significantly lower the game now performs well with a clean cache. Saying that it's not needed is just wrong.

@kd-11
Copy link
Contributor Author

kd-11 commented Jul 11, 2018

Also some games will crash if the emulator slows down to a crawl because the developers did not account for low framerates. This largely evades this issue.

@kd-11
Copy link
Contributor Author

kd-11 commented Jul 11, 2018

@ruipin ofc they are there. Dark souls character portraits are a good example (drawn once and copied) and if you have no shaders ready they will never appear.

@TigiHof
Copy link

TigiHof commented Jul 11, 2018

Did short tests on P5, Lollipop Chainsaw, Bayonetta, Demon's Souls and Ni No Kuni. On my system (i7 6700K) shader compilation stutter is practically removed. This is nothing less than spectacular, I can hardly believe it. Great work!

@ActualMandM
Copy link

Just tried it with Project Diva F without any shader cache, I can finally now play a song (when playing it for the first time mind you) without restarting it once or twice due to shader compilation.

@paxsyr
Copy link
Contributor

paxsyr commented Jul 12, 2018

Just played a bit of Medal of Honor: Airborne and the shader stutter is almost completely gone! I can actually play a for a bit without it being a slideshow. Nothing short of amazing!

@ventuskh123
Copy link

ventuskh123 commented Jul 12, 2018

Testing GT HD Prologue and doesn't stuck anymore changing the camera angle

@greentop
Copy link

TOCS2 [BLUS31597] is a game for a while now that doesn't suffer from shader compiling stutter. The observation with this PR is that the map loading times are now faster (by a few short seconds) where there is no precompiled shader cache that is already present. The visual effect seen upon loading is a world map that is being rendered on the fly piece by piece for the duration of only a few very short seconds, where it is then completely rendered. (As described in kd-11 Note2.)

@hch12907
Copy link

Will there be an option to keep the synchronous shaders after this PR? Figured that will be easier for debugging and testing, since some games may draw some objects only once.

@kd-11
Copy link
Contributor Author

kd-11 commented Jul 12, 2018

You can still use synchronous shaders. The option already exists and will be added to the GUI.

@YaPeL
Copy link

YaPeL commented Jul 12, 2018

tested person 5, much better, and in some occasions where there use to be some heavy stutter now its gone, some times even without any observable issue, though there are occasions where it stills crawls on his knees.

edit: I was using spu llvm, thats why I still had the stuttering as pointed out on the comments.

@Bitr0t-Zygzz
Copy link

Bitr0t-Zygzz commented Jul 12, 2018

This PR branch including fixes branch now freezes my client upon game load and bring to front.

Game Works flawlessly if not clicked on. but when brought onto front screen 'in focus' freezes but game can still be interacted with(audio says so)
No Error seen. in both gl and vulkan

Fixes #4869 Build 0.0.5-8ba10462 3 days ago: works (edit: seems to be last build that worked)
Master branch: does not happen.

Just a heads up just in case as you might have an idea. It seems no one else has the issue yet.

@dbz400
Copy link
Contributor

dbz400 commented Jul 12, 2018

Tested with P5 .Make sure to use SPU ASMJIT (Giga also work well) and disable Zcull . Also SPU LLVM still have intermittent shutter when using async shader here.

@jobs-git
Copy link

I also experience the freeze that Buzzing described. When the screen is clicked on rpcs3 window stops responding but game is still running this happens both for disable async=true and false.

On "disable async=false", Lags due to shader compilation has been dramatically reduced! Great work!

Specs:

Win 10, Gtx 1060, Intel Avx cpu, D3 blus31437

@ghost
Copy link

ghost commented Jul 12, 2018

Dragon Ball Raging Blast 2 freezes with async both Vulkan and OpenGL, but I don't think Async works with Vulkan for me, because with openGL it runs better, and it was always slower with OpenGL.
Fullscreen makes the game freeze sooner, but freezes in windows also. But performance is better even with the wrong graphics, nice imporvement.

You said Raging Blast 2 has problems with fragment shader compilation, right? Do you know approx when it will be fixed?

Here is the log. Also, if trophy popup is enabled, the game freezes every time a trophy appears. (In master there are a few times when it doesn't but usually trophy makes it freezes there too.)
RPCS3.zip

@kd-11
Copy link
Contributor Author

kd-11 commented Jul 12, 2018

@buzing Not able to reproduce. Are you using any monitoring tools?

@kd-11
Copy link
Contributor Author

kd-11 commented Jul 12, 2018

@Patkos96 Async is working but your CPU cannot handle the extra work Intel(R) Core(TM) i5 CPU 760 @ 2.80GHz | 4 Threads. Even modern i5s will freeze a little when using vulkan as compiling from ps3->glsl->spirv->driver is quite a lot of work. Add the lower CPU speed and you might be better disabling it.

@kd-11
Copy link
Contributor Author

kd-11 commented Jul 13, 2018

Freezing window bugs are caused by #4878 and have nothing to do with rsx code. This is why its important to test all builds not just rsx ones when checking regressions.

@kd-11 kd-11 changed the title [TESTING NEEDED] Async Async Jul 13, 2018
@spyropt
Copy link

spyropt commented Jul 13, 2018

Missing character portrait in dark souls II
image

RPCS3.log.gz

@Asinin3
Copy link
Contributor

Asinin3 commented Jul 13, 2018

@spyropt Normal, not an issue read the comment in this PR from kd above. #4876 (comment)

@marosis
Copy link

marosis commented Jul 13, 2018

@kd-11 can i ask from where you know everything this about PS3 and how you know what can emulation improve? Something like this? This is really unwriteable 😄. Absolutely amazing

@Asinin3
Copy link
Contributor

Asinin3 commented Jul 13, 2018

@marosis GitHub is not the place for discussion. You can ask on Discord https://discord.me/RPCS3 or our forums https://forums.rpcs3.net/

@marosis
Copy link

marosis commented Jul 13, 2018

Yeah i understand sorry. Iam only really interrested in. I Will not do it again next time.

@kd-11
Copy link
Contributor Author

kd-11 commented Jul 13, 2018

@spyropt that is normal. The game only renders the faces once so once they are skipped they never show up. If you restart the game the shader will have been saved to cache and faces will be ok. Or disable async to force synchronous compilation making sure the writes are always present. Or load a save then return to menu, etc. Anyrhing that triggers the faces to update will show correctly after the first time.

kd-11 added 2 commits July 14, 2018 13:15
- Defer compilation process to worker threads
- vulkan: Fixup for graphics_pipeline_state.
  Never use struct assignment operator on vk** structs due to padding after sType member (4 bytes)
@Lagahan
Copy link

Lagahan commented Jul 14, 2018

Huge improvement on all of my games with deleted shader caches, brings shader compilation from complete lockups to very slight slowdowns. This will make updates that invalidate shader cache much less painful!

@kd-11 kd-11 merged commit 46abe0f into RPCS3:master Jul 14, 2018
@newDevPL
Copy link

newDevPL commented Jul 14, 2018

Silent Hill: Downpour now is almost perfect. Occasional frame drops but Shader Compilation without any cache is not causing (almost) any stutter. i7 5820, GTX 1070, 16GB DDR4, SSD. Vulkan, Strict Rendering, 1 SPU and I am getting almost solid 30fps on 1080p. 4k without strict rendering on Vulkan crashes emulator complaining small buffer. OpenGL works fine but framerate suffers a bit on 4k. Amazing work!

@Finoderi
Copy link

It looks like this PR made white/black flickering in Demon's Souls much less prominent than it was before. I have a Rizen 5 1600 and Radeon RX480. Audio stuttering is still there though.

@newDevPL
Copy link

@Finoderi did you try running with single spu?

@Finoderi
Copy link

If you mean one preffered SPU thread, than yes I tried this. It reduces audio and microstuttering a little, but when PC rolls through any breakable object, the game turns to a slideshow. I found out that 4 SPU threads is optimal setting for me. On 5 and 6 threads the game hangs more often for some reason. 2 and 3 are pretty much like 1.

@gandalfthewhite19890404

Async causes F {rsx::thread} class std::runtime_error thrown: Verification failed:
(in file c:\projects\rpcs3\rpcs3\emu\rsx\gl\GLHelpers.h:990) in every game on some GPUs. Tested with tetris(bundled with emulator) on NVIDIA 210GT (yes - its old, I know it).

@AniLeo
Copy link
Member

AniLeo commented Jul 16, 2018

GT 210 doesn't seem to support OpenGL 4 as per NVIDIA spec page, so that's irrelevant

@AkagiShiroe
Copy link

@gandalfthewhite19890404 clear shadercache first and make sure you use SPU ASMJIT Recompiler
(i got that issue when i have SPU LLVM Recompiler) @AniLeo .. yeah that's more awfull card than mine.. even 9600GT are breathing 8-16fps here.

@kd-11 kd-11 deleted the async-shader branch July 17, 2018 18:20
@Asinin3
Copy link
Contributor

Asinin3 commented Jul 20, 2018

This pull request fixes the outstanding issue plaguing KH 2.5 when playing as roxas. The slowdown when attacking or in attack stance has been totally fixed!!

Before:
7091_2018-07-20_1852

After:
image

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

Successfully merging this pull request may close these issues.