[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [microblaze-uclinux] another compiler oddity



Hi Yashi,

Yasushi SHOJI wrote:
> Hi John,
> 
> At Tue, 17 Aug 2004 19:01:45 +1000,
> John Williams wrote:
> 
>>Hi Yashi,
>>
>>Yasushi SHOJI wrote:
>>
>>
>>>one of my co-worker found this.  in a flat funciton, accessing block
>>>ram is _slower_ thank dram.  if you make inner loop a function, block
>>>ram is faster as i expected.
>>>
>>>any thoughts?
>>
>>Interesting...   You want to be careful with tests like this - there 
>>could well be other factors.
>>
>>AFAIK LMB/BRAM transactions are fixed at 2 cycles per access - it's 
>>deterministic.  Similarly, a cache access (hit) will also be 2 cycles.
>>
>>Did you disable the instruction cache for this test?  Because microblaze 
>>cache is direct mapped, if you cross a particular power-of-two address 
>>boundary (ie the physical cache size) you may end up thrashing the 
>>icache, which would negatively impact the results.  The fact that you 
>>got different results with inline code vs a function call might support 
>>this interpretation.
> 
> 
> well the test case is inline vs. flat.  not function.  I fist thought
> this is something with cache.  I disabled i and d cache for test.
> 
> $ /var/inline
> Elapsed time : 0.171622
> Elapsed time : 0.143324
> 
> $ /var/flat
> Elapsed time : 0.159957
> Elapsed time : 0.228431
> 
> for both test, top line is for dram and bottom is bram.

A cosmetically modified version of your test program (see attached) 
gives me this result:

# /mnt/yashitest

DRAM test 

do_test_inline(): 

Elapsed time : 0.55982 

do_test(): 

Elapsed time : 0.46411 

 

 

BRAM test 

do_test_inline(): 

Elapsed time : 0.23753 

do_test() 

Elapsed time : 0.23693


So, a couple of observations.

1 - your times are quicker overall than on my mbvanilla platform (66MHz 
clock, icache and cache enabled

2 - I see the inverse effect to you (ie BRAM quicker than DRAM) as expected.

So, what does it all mean?!  Is your platform's timekeeping accurate? 
If you open the loop right out (or make it a double loop) and compare 
the reported elapsed time with wallclock time, does it add up?

Thanks,

John
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@itee.uq.edu.au
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/