Welcome, Guest. Please login or register.
Amiga Kit Amiga Store Iridium Banner AMIStore App Store A600 Memory

AuthorTopic: FastCache040+ Released!  (Read 3084 times)

0 Members and 1 Guest are viewing this topic.

Offline SpeedGeek

FastCache040+ Released!
« on: October 05, 2017, 09:34:29 AM »
FastCache040+ 1.0 ©SpeedGeek 2017
             
INTRODUCTION:
FastCache040+ is a patch to replace the CachePreDMA() and
CachePostDMA() functions of most 68040/060 libraries. While
the old functions are adequate they are far from optimal.
These old functions have 3x more code then the new ones
provided with this patch!

Also, the new functions implement a much more efficient method
of managing the Copyback cache for DMA. While every system
will have some CPU performance loss under DMA conditions, the
new functions keep this performance loss to a bare minimum.          
               
FEATURES:
- Replaces CachePreDMA() and CachePostDMA() with smaller
  and more efficient code
- Replaces complex MMU code with simple and fast DTTR code
- Temporarily changes Copyback mode to Write Through for DMA
  (but only when required!)
- Never flushes the ATC!
- Never flushes the DC for Chip RAM DMA!          
- Uses 68040/060 library detection code
- Will not patch itself
- 100% Assembler code

CODE SIZE COMPARISONS:
- FastCache040+ 1.0  (NewFunc 132 bytes)
- 68060.library 46.7 (OldFunc 304 bytes)
- 68040.library 44.2 (OldFunc 414 bytes)  

REQUIREMENTS:
- Amiga with 68040 or 68060 CPU and MMU
- 68040.library or 68060.library

WARNING:
Do NOT use this patch with GigaMEM, VMM or any similar
virtual memory software! Do NOT use this patch with any
code which uses the MMU to write protect or remap modified
data structures!

NOTES:
Remapping a mirror image of the Kickstart ROM with the MMU
is OK! The new functions still have one thing in common with
the old functions. They do NOT translate virtual addresses
as specified in the Amiga RKRM! For more info on the old
functions see the Enforcer.guide by Michael Sinz.          

HISTORY:
v1.0 - First release

Here is the link:

http://eab.abime.net/showthread.php?p=1189690#post1189690
« Last Edit: October 11, 2017, 01:38:29 PM by SpeedGeek »
 

Offline Oldsmobile_Mike

Re: FastCache040+ Released!
« Reply #1 on: October 05, 2017, 01:20:47 PM »
How do these patches compare to THoR's mmu libraries?
Amiga 500: 2MB Chip|16MB Fast|30MHz 68030+68882|3.9|Indivision ECS|GVP A500HD+|Mechware card reader + 8GB CF|Cocolino|SCSI DVD-RAM
Amiga 2000: 2MB Chip|136MB Fast|50MHz 68060|3.9|Indivision ECS + GVP Spectrum|Mechware card reader + 8GB CF|AD516|X-Surf 100|RapidRoad|Cocolino|SCSI CD-RW
 Amiga videos and other misc. stuff at https://www.youtube.com/CompTechMike/videos
 

Offline SpeedGeek

Re: FastCache040+ Released!
« Reply #2 on: October 05, 2017, 03:31:48 PM »
Quote from: Oldsmobile_Mike;831335
How do these patches compare to THoR's mmu libraries?

Well, you probably don't know that he has insisted the old function code was the only way to guarantee reliable DMA transfers... and of course I strongly disagree with his claim. :furious:

Nevertheless, I don't recommend my patches for use with his MMU libraries.
They are not tested for compatibility, so if they do work it's by chance rather than by design.  ;)
 

Offline Oldsmobile_Mike

Re: FastCache040+ Released!
« Reply #3 on: October 05, 2017, 10:12:25 PM »
Quote from: SpeedGeek;831339
Well, you probably don't know that he has insisted the old function code was the only way to guarantee reliable DMA transfers... and of course I strongly disagree with his claim. :furious:

Well, that should be of no surprise to anyone. :laughing:

Good work on the patch, anyway! One of these years I still need to finish your A2091 speedup hack on my A2091.  :)
Amiga 500: 2MB Chip|16MB Fast|30MHz 68030+68882|3.9|Indivision ECS|GVP A500HD+|Mechware card reader + 8GB CF|Cocolino|SCSI DVD-RAM
Amiga 2000: 2MB Chip|136MB Fast|50MHz 68060|3.9|Indivision ECS + GVP Spectrum|Mechware card reader + 8GB CF|AD516|X-Surf 100|RapidRoad|Cocolino|SCSI CD-RW
 Amiga videos and other misc. stuff at https://www.youtube.com/CompTechMike/videos
 

Offline SpeedGeek

Re: FastCache040+ Released!
« Reply #4 on: October 06, 2017, 03:45:25 AM »
** NEWS UPDATE **

Sorry, there was a bug in v1.0 with the patch install code. :angry:

v1.1 - Fixed a bug which prevented the patch from installing
              - Added code to use OldCachePreDMA for MEMF_24BIT
       transfers (I don't know why errors occured here)
« Last Edit: October 06, 2017, 07:27:19 AM by SpeedGeek »
 

Offline SpeedGeek

Re: FastCache040+ Released!
« Reply #5 on: October 06, 2017, 02:13:31 PM »
** 2ND NEWS UPDATE **

v1.2 released (updated patch size info)  
 - Added code to use OldCachePostDMA for MEMF_24BIT
transfers (So MMU Pages can be restored to original)

EDIT:
OK, I believe I have found a solution to the MEMF_24BIT transfer
error problem without OldPre/OldPost calls. Unfortunately, the cache mode would have to be changed to NoCache.

This would make the NewFunc code a little smaller but could reduce CPU performance a little for MEMF_24BIT transfers.

So it's a trade off situation... will give it some more thought! :biglaugh:
« Last Edit: October 06, 2017, 04:37:07 PM by SpeedGeek »
 

Offline SpeedGeek

Re: FastCache040+ Released!
« Reply #6 on: October 10, 2017, 09:14:05 PM »
** 3RD NEWS UPDATE **

v1.3 Released!
- Added code to change MEMF_24BIT transfers to NoCache.
This eliminated all OldFunc calls. MEMF_24BIT transfers may have
some CPU performance loss but the NewFunc code performance
benefits should still justify this.

NOTES: v1.2 will still be available for download for users if they
believe using OldFunc calls is still justified. The v1.2 NewFuncSrc
for lbC00004E should read as follows:
CINVA    NC        ;Support 060, 040 not sure?

EDIT:
v1.4 Released!
- Removed MEMF_24BIT code from PreDMA/PostDMA for the
case of 16 byte aligned transfers. This will allow
some MEMF_24BIT transfers to be cache enabled!

EDIT2:
The v1.4 NewFuncSrc for lbC000080 should read as follows:
ORI.W   #$8000,D1    ;Cache WT mode + User FC
« Last Edit: October 13, 2017, 04:43:37 PM by SpeedGeek »
 

Offline SpeedGeek

Re: FastCache040+ Released!
« Reply #7 on: October 14, 2017, 01:43:26 PM »
Ok guys, now it's your turn to post your compatibility results!

Please provide information on 68040.library or 68060.library vendor and  version. Also, accelerator card type and vendor is requested too. Thank  you! :)
 

Offline SpeedGeek

Re: FastCache040+ Released!
« Reply #8 on: October 15, 2017, 05:58:20 PM »
** 4TH NEWS UPDATE **

The was another stupid version bug in v1.4 which has now been fixed (It  was a just a fully functional v1.4 reporting itself as v1.3).

I now have a simple benchmark tool called "CacheDMAmips" (see attached  image). I will probably release it when I am satisfied with the  compatibility results. ;)

EDIT: CacheDMAmips was removed for  providing bogus results. Obviously, programs compiled on an old "Pile  of Crap" C compiler and using v34 timer.device functions are not so  reliable. Mips benchmark results are generally bogus anyway! Thus a new  improved benchmark tool is called for! :biglaugh:
« Last Edit: October 23, 2017, 04:59:03 PM by SpeedGeek »
 

Offline matt3k

Re: FastCache040+ Released!
« Reply #9 on: October 15, 2017, 10:57:15 PM »
Hey Speed,

Been running 1.4 for a few days.  No issues so far.  System feels faster, not sure if it's reality. :)  Thanks for the great work.

System used for test:
Amiga 3000
Phase 5 Cyberstorm PPC
68060 version: 46.15

I have the command in my user-startup behind some other performance programs:
My CPU 060 Best
MemTrailer 96
MinStack 70000
CopyMem060
UtilPatch060
FastCache040+
 

Offline kolla

Re: FastCache040+ Released!
« Reply #10 on: October 16, 2017, 12:41:20 PM »
Quote from: matt3k;831781

My CPU 060 Best


Whaaaat? :confused:
B5D6A1D019D5D45BCC56F4782AC220D8B3E2A6CC
 

Offline matt3k

Re: FastCache040+ Released!
« Reply #11 on: October 16, 2017, 01:01:54 PM »
Quote from: kolla;831798
Whaaaat? :confused:


http://aminet.net/package/util/misc/MyCpu060
 

Offline Thomas Richter

Re: FastCache040+ Released!
« Reply #12 on: October 16, 2017, 03:11:31 PM »
Quote from: matt3k;831781
Hey Speed,

Been running 1.4 for a few days.  No issues so far.

No wonder, there's nothing in your system that calls CachePre/PostDMA(), even though it should. Thus, a rather pointless exercise on your side.

There are reasons for these functions, and what this patch essentially does is that it disables or bypasses one of the functionalities the functions should have.

Their API is certainly not very wisely designed, though that is not a reason to break them...
 

Offline kolla

Re: FastCache040+ Released!
« Reply #13 on: October 16, 2017, 03:47:44 PM »
Quote from: matt3k;831801
http://aminet.net/package/util/misc/MyCpu060


Oh, so you run "MyCpu060 BEST", and not "My CPU 060 Best" :laughing:
B5D6A1D019D5D45BCC56F4782AC220D8B3E2A6CC
 

Offline SpeedGeek

Re: FastCache040+ Released!
« Reply #14 on: October 17, 2017, 12:28:58 AM »
Quote from: matt3k;831781
Hey Speed,

Been running 1.4 for a few days.  No issues so far.  System feels faster, not sure if it's reality. :)  Thanks for the great work.

System used for test:
Amiga 3000
Phase 5 Cyberstorm PPC
68060 version: 46.15

I have the command in my user-startup behind some other performance programs:
My CPU 060 Best
MemTrailer 96
MinStack 70000
CopyMem060
UtilPatch060
FastCache040+

Thanks for the info Matt! :)

Unfortunately, your system is very similar to my system (A3000, A3660, 68060.library 46.7). So hopefully, some users with different systems will post their results too.