20 March 2024, 16:13 | #1 |
Registered User
Join Date: Dec 2019
Location: North Dakota
Posts: 741
|
Placement of code and data in FastRam
While working on my RTG benchmark, I want to dedicate one of the tests to differences between ChipRam and FastRam.
I'm using vasm and hunkexe format, so it should be a relocatable format (no .ORG or absolute memory addresses anywhere). When I printed the addresses of the first/last line of code and data at run-time, I noticed that they are all in FastRAM (unless I change the attribute in the SECTION to use chipram) - well based on the range that SysInfo gives me under WinUAE. Is that guaranteed, though ? I am not using AllocMem and all my data is compile-time allocated (for now). It would be of great benefit if I didn't have to refactor the code to use AllocMem and both code/data would be guaranteed to be placed in FastRAM. I do not intend to run it below 040 initially, and some time in the future, I might try to make it run on slowest RTG config (A1200, I suspect) - but for now, let's say 040. |
20 March 2024, 16:38 | #2 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,073
|
Segment loader is allocating public memory (unless a hunk is tagged to use something else), so as long as fastmem has higher priority over chipmem you'll get fastmem if a hunk fits.
|
20 March 2024, 17:05 | #3 | |
Registered User
Join Date: Dec 2019
Location: North Dakota
Posts: 741
|
Quote:
And what exactly is that kind of RAM anyway ? If it's not chipset, what other is there ? The trapdoor local expansion one perhaps ? Is there a difference between FastRAM on the expansion card (say, with 128 MB RAM) and FastRAM in the motherboard ? |
|
20 March 2024, 17:41 | #4 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,073
|
Yeah, if you run out of fastmem while asking for public mem, you will get chipmem.
Each part of the memory pool has a priority, and allocation works down the list. So, fast with several priority levels (Z3, Z2, ..., that should answer your last question) > slow/ranger > chip. |
20 March 2024, 18:09 | #5 |
Registered User
Join Date: Dec 2019
Location: North Dakota
Posts: 741
|
Thanks, that's great to hear. I presume this order of allocation should be documented somewhere in the OS/library docs...
So, technically, looks like I can get away with not refactoring the code to use AllocMem, as static allocation will work just fine and get me a FastRAM for both code+data and FrameBuffer (which is what I need). I guess I can always just print out the address range used for code+data/framebuffer and this way the user will know exactly (for his particular system), what kind of RAM has been given to the executable by the OS. This should take care of all the "why did it run slower this time?" questions - the answers will be given to the user on the first screen of the program. |
20 March 2024, 20:00 | #6 | |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,355
|
Quote:
The type of memory you get with TypeOfMem(), which is a function of exec. That provides you the memory attributes (or 0) a specific memory location has. Thus, if you requested MEMF_PUBLIC, but the system run out of fast memory, TypeOfMem() will give you MEMF_PUBLIC|MEMF_CHIP as result. |
|
20 March 2024, 20:05 | #7 |
Registered User
Join Date: Feb 2017
Location: Denmark
Posts: 1,263
|
Yes, it is documented (http://amigadev.elowar.com/read/ADCD.../node02A6.html). Static allocation will work just fine, and in practice you don't have to worry about fast buffers being demoted to chip ram. That will really only happen on very low spec systems, and the user will be used to it.
You can also force your segments to be in fast ram, but there are only downsides to this. Just use TypeOfMem and print a warning if you really need to. Most accelerator cards will just have a comparatively large amount of fast ram where you program will always fit. The priority case only comes up in niche situations (like this awesome thing: https://eab.abime.net/showthread.php?t=115241&nojs=1) |
21 March 2024, 13:00 | #8 | |
Registered User
Join Date: Dec 2019
Location: North Dakota
Posts: 741
|
Quote:
I also need to redownload the Amiga docs, as I couldn't find them in my Amiga Dev directory (it probably didn't make it to the new computer - I hate this part - you always forget some directories from old HDD). |
|
21 March 2024, 13:06 | #9 | |||
Registered User
Join Date: Dec 2019
Location: North Dakota
Posts: 741
|
Quote:
Quote:
Quote:
But still, comfortably, under 4 MB total - which shouldn't be a big deal for any low-spec RTG system, right ?. Last edited by VladR; 21 March 2024 at 13:06. Reason: typos |
|||
21 March 2024, 14:32 | #10 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,355
|
|
21 March 2024, 20:10 | #11 | ||
Registered User
Join Date: Feb 2017
Location: Denmark
Posts: 1,263
|
Quote:
Quote:
Totally fine, and on RTG systems I guess framebuffers will mostly(?) always not take up any fast ram (i.e. be buffers allocated on the graphics device). |
||
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
VBCC: How to use small code/data models with nostdlib | Hedeon | Coders. C/C++ | 23 | 04 October 2023 01:10 |
Mutable data in code section | hop | Coders. Asm / Hardware | 19 | 08 June 2022 20:09 |
Code / data / tools of Scoopex "TWO" (rotozoom cracktro for Starquake) | Yragael | Coders. Tutorials | 4 | 24 November 2018 10:44 |
A600 4mb Fastram + A1200 Mb Fastram | mikele | MarketPlace | 7 | 07 May 2012 19:28 |
A600 floppy placement. | prart | support.Hardware | 4 | 08 September 2008 08:47 |
|
|