forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

PSP cache HOWTO/FAQ

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
jsgf



Joined: 12 Jul 2005
Posts: 254

PostPosted: Wed Oct 12, 2005 7:20 am    Post subject: PSP cache HOWTO/FAQ Reply with quote

I've been seeing a fair amount of confusion about cache issues here, along with misleading/incomplete advice about how to deal with them.

So I decided to write up a HOWTO for dealing with PSP cache issues: http://goop.org/psp/cache-howto.html

This is a first draft, and I'd love to have comment/suggestions/corrections for it.
Back to top
View user's profile Send private message Visit poster's website
ChaosKnight



Joined: 14 Apr 2005
Posts: 142
Location: Florida, USA

PostPosted: Wed Oct 12, 2005 7:28 am    Post subject: Reply with quote

This is extremely helpful, thanks for posting it!
_________________
w00t
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
holger



Joined: 18 Aug 2005
Posts: 204

PostPosted: Wed Oct 12, 2005 7:35 am    Post subject: Reply with quote

nice!

maybe worth noting that cache-line-aligned unchached memory blocks should have a multiple-of-64-byte size, in order to avoid cached/uncached aliasing at the end of buffer.

Can you make this part of the psp-wiki?
Back to top
View user's profile Send private message
jsgf



Joined: 12 Jul 2005
Posts: 254

PostPosted: Wed Oct 12, 2005 8:07 am    Post subject: Reply with quote

I've updated it to note that allocatons should be cacheline multiples in size too. I also spelled out the implciations of write-back caching.

I'm planning to put it on the wiki when it settles a bit, and I've added some diagrams. It's easier to edit locally for now.
Back to top
View user's profile Send private message Visit poster's website
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Wed Oct 12, 2005 8:50 am    Post subject: Reply with quote

Rather than all the mess with uncached pointers and cache line sizes, can't you just do business as usual and force a writeback before telling the GE to use it? I haven't used the GE; obviously this wouldn't work if there's a case where you're changing the data as the GE reads it.
Back to top
View user's profile Send private message
jsgf



Joined: 12 Jul 2005
Posts: 254

PostPosted: Wed Oct 12, 2005 10:03 am    Post subject: Reply with quote

jimparis wrote:
Rather than all the mess with uncached pointers and cache line sizes, can't you just do business as usual and force a writeback before telling the GE to use it?

You could; that would handle the case of writing commands to be written by GE (or whatever). But it isn't the most efficient path (uncached writes seems faster, I'm guessing because of reduced cache pollution), and a lot of code is already using uncached pointers (mostly in unsafe ways).

Also, if you're reading back memory which has been written by hardware, then you also need to make sure the cache has been invalidated, and/or use uncached reads.

Quote:
I haven't used the GE; obviously this wouldn't work if there's a case where you're changing the data as the GE reads it.

Well, that would be inherently buggy code anyway.
Back to top
View user's profile Send private message Visit poster's website
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Wed Oct 12, 2005 12:10 pm    Post subject: Reply with quote

jsgf wrote:
Quote:
I haven't used the GE; obviously this wouldn't work if there's a case where you're changing the data as the GE reads it.

Well, that would be inherently buggy code anyway.

Concurrent memory access can surely work if you're careful (think Dekker's algorithm), and this might be useful for future work with the ME. But I digress; your guide is certainly useful, thanks.
Back to top
View user's profile Send private message
jsgf



Joined: 12 Jul 2005
Posts: 254

PostPosted: Wed Oct 12, 2005 5:14 pm    Post subject: Reply with quote

jimparis wrote:
Concurrent memory access can surely work if you're careful (think Dekker's algorithm), and this might be useful for future work with the ME.

Possibly; though Dekker's algorithm also assumes strict in-order writes. I'm guessing the PSP does that, but it is a stronger requirement than simply uncached writes.
Back to top
View user's profile Send private message Visit poster's website
holger



Joined: 18 Aug 2005
Posts: 204

PostPosted: Wed Oct 12, 2005 11:12 pm    Post subject: Reply with quote

jimparis wrote:
jsgf wrote:
Quote:
I haven't used the GE; obviously this wouldn't work if there's a case where you're changing the data as the GE reads it.

Well, that would be inherently buggy code anyway.

Concurrent memory access can surely work if you're careful (think Dekker's algorithm), and this might be useful for future work with the ME. But I digress; your guide is certainly useful, thanks.


The GE signal command may be useful for this, but I have no idea whether anybody found out yet how they work.
Back to top
View user's profile Send private message
jsgf



Joined: 12 Jul 2005
Posts: 254

PostPosted: Thu Oct 13, 2005 1:18 am    Post subject: Reply with quote

holger wrote:
The GE signal command may be useful for this, but I have no idea whether anybody found out yet how they work.

I played with it for a while, but didn't have much success; I could never get a callback from it. But that's quite a different matter from actually playing with the GE's command memory as it reads it...
Back to top
View user's profile Send private message Visit poster's website
holger



Joined: 18 Aug 2005
Posts: 204

PostPosted: Thu Oct 13, 2005 2:26 am    Post subject: Reply with quote

see http://forums.ps2dev.org/viewtopic.php?t=3764
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group