[MPlayer-dev-eng] SFENCE really needed?

D Richard Felker III dalias at aerifal.cx
Tue Jan 21 17:10:14 CET 2003


On Tue, Jan 21, 2003 at 10:21:23AM +0100, Michael Niedermayer wrote:
> Hi
> 
> On Tuesday 21 January 2003 06:22, D Richard Felker III wrote:
> > Hmm, I was reading some of the fast/agp memcpy code and other related
> > stuff, and I'm wondering...what's the performance penalty for using
> > the SFENCE instruction, and is it really necessary after writes to
> > video memory? I could understand it being useful when writing to
> > system memory, when another procedure might need to read the data
> > after you write it. But from what I understand, it's nonsense when
> > writing to video mem unless you plan on reading from video mem (slow
> > and pointless!). Any ideas?
> its needed, btw if u really dont read the data from there then why do u write 
> it in the video mem? (hint the grafix card reads it & displays it on screen, 
> so the last few pixels could be missing ..., i dunno if that would happen in 
> practice, but it could IMHO according to the manuals) 

Hmm. I was under the impression that the special 'non-temporal' writes
or whatever caused the data to be written directly through the cache,
with only a minimal amount being cached for write combining, and that
sfence was for making sure the cpu wouldn't read stale values for
those addresses from the cache. However, you probably know a good deal
more about it than I do. It's been a long while since I coded much
asm, and back in the day it was all different -- cpu wasn't 10x as
fast as the memory so number of cycles actually mattered. :)

Rich




More information about the MPlayer-dev-eng mailing list