Welcome, Guest. Please login or register.

Author Topic: CopyMem Quick & Small released!  (Read 14279 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Thorham

  • Hero Member
  • *****
  • Join Date: Oct 2009
  • Posts: 1150
    • Show only replies by Thorham
Re: CopyMem Quick & Small released!
« Reply #29 on: January 03, 2015, 07:03:08 AM »
Quote from: Thomas Richter;780935
For the blitter, you get however a substantial disadvantage from not using the Os: If you try to implement a graphics primitivity, it might simply not work on an rtg system if you don't use the Os. Is it worth not using the Os? Typically not, because you "shoot yourself in the foot".
Whether it's worth it or not depends entirely on one's requirements. The OS blit routine is generic, and therefore unsuitable for fast, non-generic blits, even when the nature of the blits is very simple (you can see this clearly when you look at the function call). The right solution for getting both maximum performance on native screen modes and have GFX card compatibility is to simply implement both methods.
 

guest11527

  • Guest
Re: CopyMem Quick & Small released!
« Reply #30 on: January 03, 2015, 09:45:32 AM »
Quote from: Thorham;780952
Whether it's worth it or not depends entirely on one's requirements. The OS blit routine is generic, and therefore unsuitable for fast, non-generic blits, even when the nature of the blits is very simple (you can see this clearly when you look at the function call). The right solution for getting both maximum performance on native screen modes and have GFX card compatibility is to simply implement both methods.

And from where do you know that you have a gfx card in the system? And is it worth to implement both methods? For rendering graphics, it *usually* doesn't matter - not worth spending bytes on this decision. For implementing an I/O driver, the situation might again be different (though it probably shouldn't copy data in first place).

Yes, as usual, it depends on the situation, but I currently cannot come up with a situation where I would need to blit something and not use the Os, or where I would need to copy a lot of memory, and the simple CopyMemQuick() interface is sufficient.

For example, we had the problem in P96 to copy memory quickly around (from the board to an off-board buffer, and reverse), but CopyMemQuick() is not even closely sufficient for that as it was necessary to copy "rectangular" memory regions with a different "modulo" factor from A to B. CopyMemQuick() cannot do that.
 

guest11527

  • Guest
Re: CopyMem Quick & Small released!
« Reply #31 on: January 03, 2015, 09:52:07 AM »
Quote from: kolla;780939
What's the big deal, it's just one out of hundreds of patches around. It is entirely optional to add patches and updates.

There are two answers I can give, a generic one and one that is specific to this series of patches. The generic one is that I have a problem with the "patch culture" on the Amiga. There are so many bad patches around that actually break interfaces that it is hard for the average user to maintain a stable system. Programs like MCP really *broke* certain functions, and provided functionality that was available in the Os anyhow - you just had to use them. The same goes for this program, a small improvement (if at all) for a patch, probably not worth thinking about.

Or to put it differently: The easyness of the average user to install a patch is in no relation to the complexity of implementing a *correct* patch, and the average quality of patches is pretty "average".

The specific one is that MOVE16 is not a good instruction to use on the Amiga. Problem is that MOVE16 runs a burst-cycle, even into memory or target regions that are marked as "cache-inhibited". The problem is now that it depends on the well-behaivedness of the turbo-board to detect this case and abort the burst. Given the "rather average" quality of some expansions and extensions, I would not be surprised that this actually doesn't always work as it should. Indeed, if I test this on my A2000, *not* trying to burst provides a small but measurable speed advantage over trying to initiate the burst.
 

Offline ElPolloDiabl

  • Hero Member
  • *****
  • Join Date: May 2009
  • Posts: 1702
    • Show only replies by ElPolloDiabl
Re: CopyMem Quick & Small released!
« Reply #32 on: January 03, 2015, 12:26:00 PM »
Quote from: Oldsmobile_Mike;780765
IMHO I love that people like SpeedGeek and Cosmos are taking on these "micro optimizations" of old Amiga code.  I know other people's mileage may vary, but I'm running a ton of their patches on my A2000, and sitting right next to a 2000MHz PC running the latest version of Lubuntu, my 33MHz Amiga still feels like it flies.  :)

You can make them faster turning off things like pop up info and prefetch.
You could be limited by bloated programs.
Go Go Gadget Signature!
 

Offline Oldsmobile_Mike

Re: CopyMem Quick & Small released!
« Reply #33 on: January 03, 2015, 01:08:39 PM »
Quote from: Thomas Richter;780957
There are two answers I can give, a generic one and one that is specific to this series of patches. The generic one is that I have a problem with the "patch culture" on the Amiga.

The "patch culture" is what makes Amiga's the most fun!  You can customize and tune it to make it your own.  No two Amiga's will ever be the same.  Or should we all just go back to running stock 3.1?  My other favorite hobby is working on old cars.  Replacing the carburetor with a higher flow model.  Replacing the stock exhaust manifold with some custom headers.  Isn't that the same as what people are doing with their Amiga's?  Or would you say everyone should keep their cars exactly stock, as well?

Oh well, to each their own!  :D
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 psxphill

Re: CopyMem Quick & Small released!
« Reply #34 on: January 03, 2015, 02:14:36 PM »
Quote from: Oldsmobile_Mike;780963
Replacing the stock exhaust manifold with some custom headers. Isn't that the same as what people are doing with their Amiga's?

You realise and take responsibility that your car could explode killing you and your entire family if you start changing things.
 
 If you're running any patches then don't expect to be able to raise any bug reports against any software you run. Also don't release any software if you've only tested it while running unofficial patches.
 

guest11527

  • Guest
Re: CopyMem Quick & Small released!
« Reply #35 on: January 03, 2015, 02:15:55 PM »
Quote from: Oldsmobile_Mike;780963
The "patch culture" is what makes Amiga's the most fun!  You can customize and tune it to make it your own.  

What you don't understand is that this makes developing software for the Amiga needlessly hard and resource intensive. The problem is that I cannot simply go along and implement a program against the Os interfaces. It happened often enough that something broke at user side, and not because of a software bug, but because of a patch.

Thus, patches create additional maintenance issues for any software developer, frustration and cost, in the end both for the user and the program author. Patches prevent "isolation" between software projects - they create dependencies between the patch author and the software author.
 

Offline kolla

Re: CopyMem Quick & Small released!
« Reply #36 on: January 03, 2015, 02:17:41 PM »
The "patch culture" is pretty much what keeps this platform alive and moving forward still.
B5D6A1D019D5D45BCC56F4782AC220D8B3E2A6CC
---
A3000/060CSPPC+CVPPC/128MB + 256MB BigRAM/Deneb USB
A4000/CS060/Mediator4000Di/Voodoo5/128MB
A1200/Blz1260/IndyAGA/192MB
A1200/Blz1260/64MB
A1200/Blz1230III/32MB
A1200/ACA1221
A600/V600v2/Subway USB
A600/Apollo630/32MB
A600/A6095
CD32/SX32/32MB/Plipbox
CD32/TF328
A500/V500v2
A500/MTec520
CDTV
MiSTer, MiST, FleaFPGAs and original Minimig
Peg1, SAM440 and Mac minis with MorphOS
 

Offline kolla

Re: CopyMem Quick & Small released!
« Reply #37 on: January 03, 2015, 02:23:08 PM »
You make it sound as if there's much software developed, but really there isn't.
B5D6A1D019D5D45BCC56F4782AC220D8B3E2A6CC
---
A3000/060CSPPC+CVPPC/128MB + 256MB BigRAM/Deneb USB
A4000/CS060/Mediator4000Di/Voodoo5/128MB
A1200/Blz1260/IndyAGA/192MB
A1200/Blz1260/64MB
A1200/Blz1230III/32MB
A1200/ACA1221
A600/V600v2/Subway USB
A600/Apollo630/32MB
A600/A6095
CD32/SX32/32MB/Plipbox
CD32/TF328
A500/V500v2
A500/MTec520
CDTV
MiSTer, MiST, FleaFPGAs and original Minimig
Peg1, SAM440 and Mac minis with MorphOS
 

Offline Oldsmobile_Mike

Re: CopyMem Quick & Small released!
« Reply #38 on: January 03, 2015, 02:31:45 PM »
Quote from: psxphill;780964
You realise and take responsibility that your car could explode killing you and your entire family if you start changing things.
 
 If you're running any patches then don't expect to be able to raise any bug reports against any software you run. Also don't release any software if you've only tested it while running unofficial patches.

Bit of an extreme example, doncha think?  ;)

And in 30 years of working on computers, I think the only time I ever emailed someone with a legitimate software bug report was with Tales Of Gorluth, which has a "load game" function, but nowhere is it documented how to actually save the game in progress.  Still haven't heard back from that one.  Oh well, maybe I should've asked them in German!  ;)

I'm just gonna say, there is always people who think a certain way, and always people who think a different.  Like they say about opinions and the Internet.  Continuing my car metaphor, if you were to go to a classic car forum you could see people arguing all day long about the merits of one spark plug brand over another.  Or I'm sure if you went to an Atari ST forum you'd find people arguing about something similar to the arguments here.  Hell, I bet if you went to a forum about kitchen utensils, you'd find people arguing about one type of mixer or another.  No one has ever said "that Internet argument fundamentally changed my way of thinking", nor will they ever.  So, keep on keepin' on.  Hate on patches or use them religiously, I think the Amiga is more fun because you can customize it how you want.  Some people don't like that, and for them there's also the boring, generic import cars.  ;)
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
 

guest11527

  • Guest
Re: CopyMem Quick & Small released!
« Reply #39 on: January 03, 2015, 02:32:16 PM »
Quote from: kolla;780967
You make it sound as if there's much software developed, but really there isn't.

But is that because or despite the patchery? Besides, I wouldn't call the average "making the average program 1% faster" "keeping the platform alive". It sounds like a needless waste of talent to me - there are better programs that could be written in the same time, providing more benefits to the average user.
 

Offline Oldsmobile_Mike

Re: CopyMem Quick & Small released!
« Reply #40 on: January 03, 2015, 02:35:15 PM »
Quote from: Thomas Richter;780969
But is that because or despite the patchery?

I think the answer to your question is actually $$$$$$.  Or more precisely, the near lack of any for doing development on this platform.  ;)
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 Thorham

  • Hero Member
  • *****
  • Join Date: Oct 2009
  • Posts: 1150
    • Show only replies by Thorham
Re: CopyMem Quick & Small released!
« Reply #41 on: January 03, 2015, 02:52:15 PM »
Quote from: Thomas Richter;780956
And from where do you know that you have a gfx card in the system?
1. Ask the user.
2. Icon tool type and have two icons.

Quote from: Thomas Richter;780956
And is it worth to implement both methods?
Depends on the software. How much code are we talking about anyway? Two, maybe three kb extra? Hardly a waste if it means more users can enjoy the software.

Quote from: Thomas Richter;780956
For rendering graphics, it *usually* doesn't matter - not worth spending bytes on this decision.
It matters for the case I'm talking about:

2x 16 pixel wide background tile.
2x 16 pixel wide sprite mask.
2x 16 pixel wide sprite data.
2x 16 pixel wide second sprite mask.
2x 16 pixel wide second sprite data.
2x 16 pixel wide status gfx mask.
2x 16 pixel wide status gfx data.

That's seven sources. With a handwritten routine you can do this:
Code: [Select]
   move.l  (a0)+,d0
    and.l   (a1)+,d0
    or.l    (a1)+,d0
    and.l   (a2)+,d0
    or.l    (a2)+,d0
    and.l   (a3)+,d0
    or.l    (a3)+,d0
Do that twice, transpose, write to chipmem. After that you can unroll to use the pipeline on 20+ and get the transposes almost for free. I don't see how that's going to be anywhere near as fast with the OS blit function, so in this case it's crystal clear that it matters, because it lowers the CPU requirements.

Quote from: Thomas Richter;780956
Yes, as usual, it depends on the situation, but I currently cannot come up with a situation where I would need to blit something and not use the Os
I have another example. I wrote a simple real-time memory viewer. It opens a single bit plane 640x512 screen and blits 8x8 chars to the screen with my own code (which contains some optimized transposes from kalms' c2p routines). Very fast, and I highly doubt the OS can match that speed. It's important that such a program is fast because you're also running the program you're working on.

Quote from: Thomas Richter;780956
For example, we had the problem in P96 to copy memory quickly around (from the board to an off-board buffer, and reverse), but CopyMemQuick() is not even closely sufficient for that as it was necessary to copy "rectangular" memory regions with a different "modulo" factor from A to B. CopyMemQuick() cannot do that.
That's the whole reason. Something doesn't run at sufficient speed, or you know this is going to happen, or simply want to reduce CPU usage as much as possible, so you write your own code. Nothing wrong with that.

This is Amiga land after all. Lots of not so fast < 68060s out there, and you can do more on those lower end machines if your code is faster.
 

Offline SpeedGeekTopic starter

Re: CopyMem Quick & Small released!
« Reply #42 on: January 03, 2015, 03:39:57 PM »
Quote from: Thomas Richter;780957
The specific one is that MOVE16 is not a good instruction to use on the Amiga. Problem is that MOVE16 runs a burst-cycle, even into memory or target regions that are marked as "cache-inhibited". The problem is now that it depends on the well-behaivedness of the turbo-board to detect this case and abort the burst. Given the "rather average" quality of some expansions and extensions, I would not be surprised that this actually doesn't always work as it should. Indeed, if I test this on my A2000, *not* trying to burst provides a small but measurable speed advantage over trying to initiate the burst.

There you go again, sounding the Burst warning alarm system you invented. I've tried to explain this many times (but you still don't get it). Burst is just an optional feature which under best case conditions can improve performance but there also worst case conditions where it reduces performance.

The CPU may only request a Burst cycle but the hardware (memory controller logic) makes the final decision on when (if ever) any Burst cycle will happen.
« Last Edit: January 03, 2015, 04:19:39 PM by SpeedGeek »
 

Offline biggun

  • Sr. Member
  • ****
  • Join Date: Apr 2006
  • Posts: 397
    • Show only replies by biggun
    • http://www.greyhound-data.com/gunnar/
Re: CopyMem Quick & Small released!
« Reply #43 on: January 03, 2015, 04:27:01 PM »
One question:

If you compare the time needed to develop the memcopy with the time spend on talking / defneding it here. How does this time compare?

Offline psxphill

Re: CopyMem Quick & Small released!
« Reply #44 from previous page: January 03, 2015, 04:57:16 PM »
Quote from: SpeedGeek;780974
The CPU may only request a Burst cycle but the hardware (memory controller logic) makes the final decision on when (if ever) any Burst cycle will happen.

And when you rely on this then it's slower than not requesting the burst in the first place. Does Zorro III actually support it?
« Last Edit: January 03, 2015, 04:59:36 PM by psxphill »