CPU Performance Patch (Up to 30% faster physics, up to 60% more FPS)

Other CPU Performance Patch (Up to 30% faster physics, up to 60% more FPS)

Hello, I also use Ryzen 5 5600 and there is something that my brain just can't handle :D
"affinity=1,3,5,7,9,11"
5600 is a 6 core processor. Is affinity for cores or threads? (If for cores there is no 7-9-11 only 1-6)
I'm trying to use with SMT disabled, is like 1,2,3,4,5,6 okay?
Also I get stuff acting up like, boobs just playing tick-tock, thighs rotating back and forth. Is this physics messing up?

Thanks for the answers!
the affinity means the threads to use, so if you have 6 cores and SMT enabled, you have 1-12 available and 1,3,5,7,9,11 are the non-SMT cores which you need to use on AMD. If you have SMT disabled you have cores 1-6, so you should use 1,2,3,4,5,6
do physics things act up more than in vanilla? I haven't changed anything in the way collisions work.
 
As much as I like the sound of this but... replacing DLL files? Yikes. What did you exactly do, why can't meshed implement these changes? What's the drawback? Don't tell me you just picked up performance breadcrumbs he left on the floor.
 
Hi! Thanks for the wonderful mod! Unfortunately, I have no changes :(
Vanilla:
View attachment 332864
Patched10:
View attachment 332865
SkinMeshPartDLL.ini:
View attachment 332866
Tried it settings:

[threads]
computeColliders=6 (or 15)
skinmeshPart=4 (or 6)
affinity=1,3,5,7,9,11,13,15 (or 1,2,3,4,5.....), but without changes :(

Size(K) ModuleName FileName
------- ---------- --------
1260 SkinMeshPartDLL.dll C:\Games\vam\PerformancePatches\SkinMeshPartDLL.dll - available!

No graphics mods, SMT on auto mode (BIOS). What could be the problem, do you think? Thanks!
your frame times have improved across the board, but not your FPS, weird. Do you have other processes running in the background? Like steam.
 
Hi! Thanks for the wonderful mod! Unfortunately, I have no changes :(
Vanilla:
View attachment 332864
Patched10:
View attachment 332865
SkinMeshPartDLL.ini:
View attachment 332866
Tried it settings:

[threads]
computeColliders=6 (or 15)
skinmeshPart=4 (or 6)
affinity=1,3,5,7,9,11,13,15 (or 1,2,3,4,5.....), but without changes :(

Size(K) ModuleName FileName
------- ---------- --------
1260 SkinMeshPartDLL.dll C:\Games\vam\PerformancePatches\SkinMeshPartDLL.dll - available!

No graphics mods, SMT on auto mode (BIOS). What could be the problem, do you think? Thanks!
Maybe your GPU is generating a bottleneck to your CPU, that happened to me, the MacGruber benchmark is GPU dependent, try using the CPU High Physics Benchmark that comes in Vam, or use a scene for comparison, lower the graphics to minimum and the physics to maximum, so that your GPU does not bottleneck.
 
As much as I like the sound of this but... replacing DLL files? Yikes. What did you exactly do, why can't meshed implement these changes? What's the drawback? Don't tell me you just picked up performance breadcrumbs he left on the floor.
as stated in the description I rewrote skinmeshPart and computeColliders from C# to C and put them in the library. Instead of running those costly functions in C# they get processed faster in native code optimized for AVX2. I also made it possible to set the coreaffinity of the process to use the best cores, this gives an additional CPU performance boost.
 
your frame times have improved across the board, but not your FPS, weird. Do you have other processes running in the background? Like steam.
From processes: MSI Afterburner, RivaTuner and Telegramm ) no heavy programs. I was wondering if this could be due to the monitor frequency of 240 hertz? In game 72 hertz.
 
@turtelebackgoofy: Some possible questions, if I may? (Yes, I've tried digging through the Discussion page of the tool & the Benchmark. Still not sure I understand correctly)

1) The default SkinMeshPartDLL.ini is set up for an AMD 8-core CPU, like my Zen 5800x? (computeColliders = [75% of 8 cores]= 6, affinity 1,3,5, ..., 15)?
2) Why computeColliders = 4 in VR, instead of 6? (ie 50% of physical cores instead of 75%)
3) Would disabling SMT in Bios benefit performance? (Some comments in a Benchmark you posted hint at your disabling SMT?). How much? Worth the hassle?
4) You comment quite a bit on the number of morphs registered with VaM & that that list gets checked every updatethread - would it be possible to save some diagnostics to file? Like raw number of morphs that get checked, maybe a list of the names?

Background is that there's a couple plugins (especially CheesyFX') that come with quite large sets of custom morphs - what I'd like to understand is whether, on that list, VaM counts copies of the same morph contained in different versions of the same plugin as different morphs (Depends on whether VaM uses the "internalname" of the morph, or the path of the resource). With normal morphpacks, that makes no difference, since simple morphpacks are referenced as "latest" - but combined plugins/morphpacks are by default referenced as "exact". So if you have eg. 4 scenes, each referencing a different version of BodyLanguage, you might end up with either 1 * 600 morphs, or 4*600 morphs.
 
@turtelebackgoofy: Some possible questions, if I may? (Yes, I've tried digging through the Discussion page of the tool & the Benchmark. Still not sure I understand correctly)

1) The default SkinMeshPartDLL.ini is set up for an AMD 8-core CPU, like my Zen 5800x? (computeColliders = [75% of 8 cores]= 6, affinity 1,3,5, ..., 15)?
2) Why computeColliders = 4 in VR, instead of 6? (ie 50% of physical cores instead of 75%)
3) Would disabling SMT in Bios benefit performance? (Some comments in a Benchmark you posted hint at your disabling SMT?). How much? Worth the hassle?
4) You comment quite a bit on the number of morphs registered with VaM & that that list gets checked every updatethread - would it be possible to save some diagnostics to file? Like raw number of morphs that get checked, maybe a list of the names?

Background is that there's a couple plugins (especially CheesyFX') that come with quite large sets of custom morphs - what I'd like to understand is whether, on that list, VaM counts copies of the same morph contained in different versions of the same plugin as different morphs (Depends on whether VaM uses the "internalname" of the morph, or the path of the resource). With normal morphpacks, that makes no difference, since simple morphpacks are referenced as "latest" - but combined plugins/morphpacks are by default referenced as "exact". So if you have eg. 4 scenes, each referencing a different version of BodyLanguage, you might end up with either 1 * 600 morphs, or 4*600 morphs.

1) The default SkinMeshPartDLL.ini is set up for an AMD 8-core CPU, like my Zen 5800x? (computeColliders = [75% of 8 cores]= 6, affinity 1,3,5, ..., 15)?
the default is set up for my cpu, the 5950x, with SMT enabled and both CCD active. 5950x has core1-32 enabled (16physical + SMT), so I choose the physical core (the first on the core pairs) of my first CCD). Since the 5800x only has 8 cores (16 SMT) you can use the exact same config.
2) Why computeColliders = 4 in VR, instead of 6? (ie 50% of physical cores instead of 75%)
I tried it and it improved performance, no idea why. I guess steamvr needs a little more cores in the phase when the physics happen so it can get the tracking data of the controllers faster? It's still a mystery to me.
3) Would disabling SMT in Bios benefit performance? (Some comments in a Benchmark you posted hint at your disabling SMT?). How much? Worth the hassle?
Maybe, intel users have reported that it gives them more performance if they completely disable HT in their BIOS and use affinity=1,2,3,4... My guess is that disabling HT allows Intel CPUs to boost their clock higher. I havent personaly tried it.
4) You comment quite a bit on the number of morphs registered with VaM & that that list gets checked every updatethread - would it be possible to save some diagnostics to file? Like raw number of morphs that get checked, maybe a list of the names?
you can edit the Assembly-CSharp.dll using https://github.com/dnSpyEx/dnSpy and add the following line in DAZMorphBank.ApplyMorphsThreadedFast at the very beginning:
Code:
Debug.LogWarning((object)string.Format("[ApplyMorphsThreadedFast] _morphs.Count {0} | _touchedMorphs.Count {1}", this._morphs.Count, this._touchedMorphs.Count));
Then you see output in C:\Users\Admin\AppData\LocalLow\MeshedVR\VaM\output_log.txt (This writes a lot to file and lowers FPS ofc)
_morphs.Count is the amount of morphs that are available and were checked in vanilla vam, _touchedMorphs.Count is the amount of morphs that will be checked in the current patch. I am aware of the bug with the built-in morphs not loading at scene start.

So if you have eg. 4 scenes, each referencing a different version of BodyLanguage, you might end up with either 1 * 600 morphs, or 4*600 morphs.
Yes, I think so, my _morphs.Count was in the 30,000-ish. This will be fixed in VAM2.
 
While compiling different optimization versions, I noticed that AVX2 on AMD is actually slower than AVX1 and withou any optimization at all. I guess Lisa Su lied to us.

AVX2
avx2.png

AVX1
avx1.png

Plain old SSE
sse.png
 
Maybe your GPU is generating a bottleneck to your CPU, that happened to me, the MacGruber benchmark is GPU dependent, try using the CPU High Physics Benchmark that comes in Vam, or use a scene for comparison, lower the graphics to minimum and the physics to maximum, so that your GPU does not bottleneck.
Indeed, the test CPU High Physics Benchmark showed a performance increase from 150 to 195 FPS! Thanks for the advice, the video card has become a bottleneck, but I already have good performance indicators, so I’ll put up with it) Thank you for your help!
 
The bug where the built-in morphs were not loaded on scene load is fixed (e.g. default nipples not getting hard). I also added DLLs for older CPUs. Awaiting mod approval. I also think that AVX2 is only fast on Intel CPUs.
 
the affinity means the threads to use, so if you have 6 cores and SMT enabled, you have 1-12 available and 1,3,5,7,9,11 are the non-SMT cores which you need to use on AMD. If you have SMT disabled you have cores 1-6, so you should use 1,2,3,4,5,6
do physics things act up more than in vanilla? I haven't changed anything in the way collisions work.
Thanks for explaining and I just need to say one thing.

YOU ARE A DAMN WIZARD!!!!!

I gained like 30-40%-ish fps overall at first glance...

(I haven't really tried VR and macgrubers benchmark doesn't run after I press start welp)
 
Thanks for explaining and I just need to say one thing.

YOU ARE A DAMN WIZARD!!!!!

I gained like 30-40%-ish fps overall at first glance...

(I haven't really tried VR and macgrubers benchmark doesn't run after I press start welp)
maybe a stupid question, but did you restart vam? Some scenes break the UI and some scenes break the playback for all other scenes.
 
i5-10400f + rtx3060ti - no changes (1-2% "measurement error").
Ini:
[threads]
computeColliders=6
skinmeshPart=1
affinity=1,3,5,7,9,11

[threadsVR]
computeColliders=4
skinmeshPart=1
affinity=1,3,5,7,9,11

[profiler]
enabled=0
 
i5-10400f + rtx3060ti - no changes (1-2% "measurement error").
Ini:
[threads]
computeColliders=6
skinmeshPart=1
affinity=1,3,5,7,9,11

[threadsVR]
computeColliders=4
skinmeshPart=1
affinity=1,3,5,7,9,11

[profiler]
enabled=0
try
[threads]
computeColliders=8
skinmeshPart=1
affinity=1,2,3,4,5,6,7,8,9,10,11,12

[threadsVR]
computeColliders=4
skinmeshPart=1
affinity=1,2,3,4,5,6,7,8,9,10,11,12
 
This is very... surprising. Just plain old SSE is still the best, lol. (don't fix what ain't broken I guess heh?)
my guess is that AVX2 heats up the cores and they get downclocked. I remember no CPUs supporting a AVX2 stress test without water cooling or downclocking.
 
i got a 7700X ryzen 7 + rtx4070 not sure what i was doing wrong but when i put the files in the directory, the characters body parts were flopping around and u cant move. Theyre stuck in one place.
 
i got a 7700X ryzen 7 + rtx4070 not sure what i was doing wrong but when i put the files in the directory, the characters body parts were flopping around and u cant move. Theyre stuck in one place.
this happens if you replaced the Assembly-CSharp.dll, but did not place the SkinMeshPartDLL.dll in \vamroot\PerformancePatches\
 
Hm, no differences on my system. Bugger :-(
Normal:
Benchmark-20240208-220852_Normal.jpg

With
Code:
[threads]
computeColliders=8
skinmeshPart=1
affinity=1,2,3,4,5,6,7,8,9,10,11,12
[threadsVR]
computeColliders=4
skinmeshPart=1
affinity=1,2,3,4,5,6,7,8,9,10,11,12
Benchmark-20240208-225129_Acc.jpg
 
Also,some in-built morphs (didn't even check VAR ones) don't show up in their neutral poses. Specifically the fist poses, whose neutral value is 0.15. THey show up as 0.00, even though the values are 0.15. Only by setting them to 0 and them back to default does the pose apply. That is NOT the case in the normal/unaccelerated setup

Normal - fist poses neutral (=0.15):
NeutralFistPoses_Applied.jpg


Same scene immediately after load, using accelerated setup:
NeutralFistPoses_NotApplied.jpg


That messes up several other scenes as well where originally neutral hand poses are now flat. Haven't checked if other poses or morphs are affected by that, too. I can imagine, candidates are poses/morphs with "Neutral" values other than 0.0.
 
Also,some in-built morphs (didn't even check VAR ones) don't show up in their neutral poses. Specifically the fist poses, whose neutral value is 0.15. THey show up as 0.00, even though the values are 0.15. Only by setting them to 0 and them back to default does the pose apply. That is NOT the case in the normal/unaccelerated setup

Normal - fist poses neutral (=0.15):
View attachment 332961

Same scene immediately after load, using accelerated setup:
View attachment 332962

That messes up several other scenes as well where originally neutral hand poses are now flat. Haven't checked if other poses or morphs are affected by that, too. I can imagine, candidates are poses/morphs with "Neutral" values other than 0.0.
its fixed in v11 which I already submitted for mod approval
 
Hm, no differences on my system. Bugger :-(
Normal:
View attachment 332959
With
Code:
[threads]
computeColliders=8
skinmeshPart=1
affinity=1,2,3,4,5,6,7,8,9,10,11,12
[threadsVR]
computeColliders=4
skinmeshPart=1
affinity=1,2,3,4,5,6,7,8,9,10,11,12
View attachment 332960
do you have like ALOT of vars installed? Rename the AddonPackages to AddonPackages_backup and retest please. A 11700KF should have far better numbers.
 
do you have like ALOT of vars installed? Rename the AddonPackages to AddonPackages_backup and retest please. A 11700KF should have far better numbers.
Yes, My main installation has tons of vars - and also some variations for VR rendering speedup.
But I am literally right now running the test on a "virgin" setup... however, it doesn't seem to look any different... :-(
Give me 5min for the test to finish...
...
Nope, no change either :cry:
Benchmark-20240208-233650_AccVirgin.jpg
 
Last edited:
Back
Top Bottom