Posts: 5.076
Threads: 18
Joined: Oct 2010
Reputation:
154
Maybe another small question....
Now you know exactly how all of this works for the ps2 MMU... If you write a program like pcsx2 do you need to know how windows/linux handles this as well? Or is the compiler doing all the work for you? I would guess if you control caching you could optimize the code a lot...
Posts: 8.598
Threads: 105
Joined: May 2014
Reputation:
168
Location: 127.0.0.1
02-22-2015, 04:16 PM
(This post was last modified: 02-22-2015, 04:17 PM by ssakash.)
(02-22-2015, 03:33 PM)willkuer Wrote: I would guess if you control caching you could optimize the code a lot...
by controlling cache do you mean, having the use of cache take place only when the data has temporal locality ? is that even possible.
We're supposed to be working as a team, if we aren't helping and suggesting things to each other, we aren't working as a team.
- Refraction
Posts: 6.069
Threads: 68
Joined: May 2010
Reputation:
167
Location: Grenoble, France
Which cache? The x86 cache? Or the ps2 cache which is not emulated.
There is some special instruction to control x86 cache but generally the hardware handle it well enough. However you can code in a way that cache eviction will be reduced which in turn greatly improve perf
Posts: 8.598
Threads: 105
Joined: May 2014
Reputation:
168
Location: 127.0.0.1
Meant the x86 cache , could you explain about the special instruction on controlling the x86 cache.
We're supposed to be working as a team, if we aren't helping and suggesting things to each other, we aren't working as a team.
- Refraction
Posts: 5.076
Threads: 18
Joined: Oct 2010
Reputation:
154
As I understood ps2 software directly sets the memory access (these three modes, uncached, cached, accelerated). It is not the bios that decides which one to use.
How does x86 software (using whatever OS) handle memory access? How does the x86-cpu know that it should cache some data in the cache and not evaluate it uncached because it will never be used again? Does the OS handle the access mode or the program? I think you can give a volatile keyword in C code. Does this mean that the corresponding data is evaluated uncached?
Posts: 5.076
Threads: 18
Joined: Oct 2010
Reputation:
154
Oh wow... I just read a bit about volatile and have real concerns about the multi-threaded applications I wrote... Using that knowledge I don't even know how they worked... Obviously the compiler was smart enough to see my stupidness and solved all errors...
I thought this MMU stuff was about optimization... but this volatile keyword is much more.
Now I think I understand the whole concept sufficiently enough to open no further questions. Thank you very much.
Just another small question about something different ;D. What about L1/L2/L3 cache? Does the ps2 have more than one level? How does the MMU know to which level to put the memory? Are there even more flags or is the mmu smart enough by itself to coordinate these? I would guess transfering data from one cache to another is probably similarly expensive as from the memory to the cache?
Thank you again for this blog entries/mini series and continuous answering n00b questions.