Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
49 user(s) are online (32 user(s) are browsing Forums)

Members: 0
Guests: 49

more...

Headlines

Forum Index


Board index » All Posts




Re: 2024 - April - Space Cadet Pinball
Just can't stay away
Just can't stay away



Rock lobster bit me - so I'm here forever
X1000 + AmigaOS 4.1 FE
"Anyone can build a fast CPU. The trick is to build a fast system." - Seymour Cray
Go to top


Re: Qemu Pegasos II interrupts issue
Quite a regular
Quite a regular


@geennaam
Quote:
So without further diagnostics, you at least know that nothing changed for vfio with the irq fix.

For these cards at least. But if I remember correctly there were other cards which worked with PCI pass through but had to disable IRQ to avoid problems. For those cards the IRQ fix might help.

I wouldn't know what's the problem with these cards that you've tried but do these work with a real PegasosII? I've heard from @joerg that amigaone was better for using such cards but they did not work with Pegasos. So if you have amigone version of AmigaOS you might try that with vfio. Also it might need the board firmware to run the card's BIOS so you may try running BBoot from pegasos2.rom (see README in BBoot, instead of -kernel bboot copy Kickstart.zip, bboot and bboot.fth to your boot volume and use boot hd:0 bboot.fth with -bios pegasos2.rom) or use U-Boot with amigaone. BBoot will just truncate 64bit BARs and fix IRQ controller setup on pegasos2 but won't try to set up gfx cards instead of the firmware or OS (that would need a BIOS emulator in BBoot).

Go to top


Re: Qemu Pegasos II interrupts issue
Quite a regular
Quite a regular


@balaton

Quote:
when using passed through GPU on Linux host


I had a spare hour and still the hard file with the Pegasos2 install and the zip with Kickstart modules on my disk. So out of curiosity I gave it a try.

Same issues since I last touched qemu with vfio (a year ago?).

qemu 9.0.0rc4+bboot-0.7 (pre-build version in archive) +pegasos2

- hd4850: crash of RadeonHD driver during loading of wb
-R9 270x: complete freeze of Ubuntu during init of RadeonHD
- RX560/570: QEMU fails to start with some PCI error message which I forgot to note down.

All tested cards work fine with my pc and Ubuntu 23.10.


So without further diagnostics, you at least know that nothing changed for vfio with the irq fix.

Go to top


Re: A1222 support in the SDK and problems
Just can't stay away
Just can't stay away


@joerg

Quote:

Unless the way I implemented the newlib libc.(a|so) stub functions was changed only a new startup code (crtbegin) using interface "spe" instead of "main" should be required.


Yes, that should still work.

Go to top


Re: A1222 support in the SDK and problems
Just can't stay away
Just can't stay away


@sailor
Quote:
at least printf, fprintf and sin() are not identical ( newlib.library 53.84 )- calling from SPE code returns nonsence.
There is no soft-float newlib, the function calls are -mhard-float using the PowerPC ABI with FPU registers, even if the A1222 version is internally using SPE code.
You have to use clib2 for now.

Go to top


Re: A1222 support in the SDK and problems
Not too shy to talk
Not too shy to talk


@joergQuote:

- Build everything which doesn't use (much) float/double code with -msoft-float and use the soft-float C library.
- Put code which uses float/double calculations in separate sources compiled with -mabi=spe -mfloat-gprs=double instead.

And what if I need to use math library functions ( sin,cos..)? Do you know, what is faster? To call it newlib + standard powerpc way, i.e. it uses LTE emulator, or to use clib2 + integer emulation from here?
Of course, I cam measure it, I am asking just for case.

Quote:
- Make sure SPE functions called from soft-float code, and the other way round, are compatible, for example by only using pointers to float/double instead of direct float/double parameters. May not even be required if they are compatible anyway, as salass00 wrote.

at least printf, fprintf and sin() are not identical ( newlib.library 53.84 )- calling from SPE code returns nonsence. These I tested.

AmigaOS3: Amiga 1200
AmigaOS4: Micro A1-C, AmigaOne XE, Pegasos II, Sam440ep, Sam440ep-flex, AmigaOne X1000
MorphOS: Efika 5200b, Pegasos I, Pegasos II, Powerbook, Mac Mini, iMac, Powermac Quad
Go to top


Re: A1222 support in the SDK and problems
Not too shy to talk
Not too shy to talk


@joerg
@salass00

Thank you for explanation.

AmigaOS3: Amiga 1200
AmigaOS4: Micro A1-C, AmigaOne XE, Pegasos II, Sam440ep, Sam440ep-flex, AmigaOne X1000
MorphOS: Efika 5200b, Pegasos I, Pegasos II, Powerbook, Mac Mini, iMac, Powermac Quad
Go to top


Re: A1222 support in the SDK and problems
Just can't stay away
Just can't stay away


@sailor
Quote:
And please, how to use soft-float C library?
Is it something like: "gcc -mcrt=clib2 -msoft-float .... -lm" ?
Yes.

Quote:
And how is floating-point parameters passed when I used "-mcpu=powerpc -msoft-float" ? Via GPR registers? They are 32-bit in powerpc ABI. Or via stack?
Same as regular integers, first in the 8 registers, if more parameters are used on the stack.
float = int32 = one 32 bit register, double = int64 = two 32 bit registers.

A SPE C library is required, but as long as there is none and if for some reason rebuilding clib4 for it doesn't work, the old, already existing soft-float clib2 could be used for now:
- Build everything which doesn't use (much) float/double code with -msoft-float and use the soft-float C library.
- Put code which uses float/double calculations in separate sources compiled with -mabi=spe -mfloat-gprs=double instead.
- Make sure SPE functions called from soft-float code, and the other way round, are compatible, for example by only using pointers to float/double instead of direct float/double parameters. May not even be required if they are compatible anyway, as salass00 wrote.

@salass00
Quote:
What might however be possible would be to also expose the SPE ABI functions directly through another "main.spe" interface but in order for it to be usable special versions of the startup code and libc will likely also be needed.
Unless the way I implemented the newlib libc.(a|so) stub functions was changed only a new startup code (crtbegin) using interface "spe" instead of "main" should be required.


Edited by joerg on 2024/4/18 15:13:07
Edited by joerg on 2024/4/18 15:17:55
Go to top


Re: A1222 support in the SDK and problems
Just can't stay away
Just can't stay away


@flash

Quote:

Also libc libraries (newlib/clib) needs to be recompiled for P1222 support, we need new sdk to produce the right binaries for A1222 without any workaround.


A special SPE compiled version of newlib.library for the Tabor/A1222 exists since version 53.54 (released to beta testers in October 2019).

The exposed ABI of the library's "main" interface is and has to remain that of generic PPC code (e.g. floating point parameters and results are passed in the emulated FPU registers) because otherwise it wouldn't be possible to run existing non-SPE compiled programs on the A1222.

What might however be possible would be to also expose the SPE ABI functions directly through another "main.spe" interface but in order for it to be usable special versions of the startup code and libc will likely also be needed.

The ABI for SPE code generated by gcc is identical to soft-float ABI in that double precision floats are passed as register pairs (r3/r4, r5/r6, r7/r8, r9/r10) even though for the SPE they could be passed in a single 64-bit register.

Go to top


Re: A1222 support in the SDK and problems
Just popping in
Just popping in


@sailor

Use GCC -S switch to generate assembler source code and look inside it.

You'll see SPE code using these flags -mcpu=8540 -mabi=spe -mfloat-gprs=double

In soft-floats you'll see standard integer powerpc instructions where math operations are only emulated (much slower).

Go to top


Re: A1222 support in the SDK and problems
Not too shy to talk
Not too shy to talk


@flash

It is not so simple
From point of view of SPE embedded FPU it is HARD float, becouse it uses SPE-natural instructions and registers ( but these are not FPRs, but 64-bit GPRs ).
From point of view of powerpc code it is SOFT float, because it uses GPR registers and has no powerpc instructions.

From the point of view of gcc SPE code is SOFT float:
gcc -mcpu=8540 -mspe -mabi=spe -mfloat-gprs=double -c Stream2_mh.-o Stream2_mh.o
gcc 
-mcpu=powerpc -c spe_float_transition.-o spe_float_transition.o
gcc Stream2_mh
.o spe_float_transition.-o Stream2_mh
ld
Warningspe_float_transition.o uses hard floatStream2_mh uses soft float
Stream2_mh.c is benchmark compilled with SPE, spe_float_transition.c contains functions which should be called with powerpc float parameters, like printf.
gcc recognizes SPE code like soft-float.

If I remember good, comlilling with additional -mhard-float:
gcc -mcpu=8540 -mspe -mabi=spe -mfloat-gprs=double -mhard-float -c Stream2_mh.-o Stream2_mh.o
generates some error - but I can check it again.

And gcc 6.4.0 online docs says:
Quote:
-msoft-float
-mhard-float
Generate code that does not use (uses) the floating-point register set. Software floating-point emulation is provided if you use the -msoft-float option, and pass the option to GCC when linking.

And as if embedded spe FPU has no floating-point register set, it is recognized like soft


It is only my explanation, and of course, I can be wrong. I start to play with this only after A1222+ arrive, so there is a lot of things more to study.

AmigaOS3: Amiga 1200
AmigaOS4: Micro A1-C, AmigaOne XE, Pegasos II, Sam440ep, Sam440ep-flex, AmigaOne X1000
MorphOS: Efika 5200b, Pegasos I, Pegasos II, Powerbook, Mac Mini, iMac, Powermac Quad
Go to top


Re: 2024 - April - Space Cadet Pinball
Just can't stay away
Just can't stay away


Wow - first to reach 8 digits .

I was awarded two replays, without them I wouldn't have made it that far.

10557250

Best regards,

Niels

Resized Image

Go to top


Re: A1222 support in the SDK and problems
Just popping in
Just popping in


@sailor

The spe code ( -mcpu=8540 -mabi=spe ) is always hard-float.
Part of integer register file of P1222 cpu is used for vectors/scalar floats using hardware decoding engine.
It can act like a sort of an "altivec unit" or an "fpu unit".
Problem is that even if GCC 6 can manage it the result code is bugged in amigaland.

Also libc libraries (newlib/clib) needs to be recompiled for P1222 support, we need new sdk to produce the right binaries for A1222 without any workaround.

Go to top


Re: A1222 support in the SDK and problems
Home away from home
Home away from home


@sailor

[qote]I am sorry Hans, it was joke. It only means, that for me was not enough to read your article, and I had to make some examples and experiments before I understood it completely. Nothing other needed. Thanks.[/quote]
Ah, okay. Suggestions for improvements are still welcome.

Hans

http://hdrlab.org.nz/ - Amiga OS 4 projects, programming articles and more.
https://keasigmadelta.com/ - more of my work
Go to top


Re: A1222 support in the SDK and problems
Not too shy to talk
Not too shy to talk


@joergQuote:
joerg wrote:
You have to use gcc -msoft-float ...
But if you do not only your own code but all libraries, incl. the C library, you are using have to be compiled with -msoft-float as well. You can't mix FPU with soft-float code, at least not without using similar workarounds you are using for SPE now.

There is probably no soft-float version of newlib. There used to be soft-float versions of clib2, but in case it's no longer available rebuilding clib2 or clib4 with -msoft-float should be no big problem.
With a soft-float C library and building your own code with -msoft-float you don't need workarounds for functions like printf() either, but of course a SPE C library for the A1222 would be much better than a soft-float one which uses integer instructions and registers for float/double.


Thank you for detailed info.
And please, how to use soft-float C library?
Is it something like: "gcc -mcrt=clib2 -msoft-float .... -lm" ?
Or other way?

The spe code ( -mcpu=8540 -mabi=spe ) is allways soft-float, regardless of c library used.
And how is floating-point parameters passed when I used "-mcpu=powerpc -msoft-float" ? Via GPR registers? They are 32-bit in powerpc ABI. Or via stack? Or float via GPR and double via stack?
I read wiki.amigaos.net, but trere is not much about SPE.

AmigaOS3: Amiga 1200
AmigaOS4: Micro A1-C, AmigaOne XE, Pegasos II, Sam440ep, Sam440ep-flex, AmigaOne X1000
MorphOS: Efika 5200b, Pegasos I, Pegasos II, Powerbook, Mac Mini, iMac, Powermac Quad
Go to top


Re: A1222 support in the SDK and problems
Not too shy to talk
Not too shy to talk


@flashQuote:
flash wrote:@sailor
As workaround you need to pass float parameters by reference and not by value.
Another solution is to pass them using heap space and not stack.
To do this you can use an array of floats and pass it's base address to function.
Another solution is to pass a struct with floats vars as members.

Anyway also printf function is bugged for A1222 and need to be fixed for floats.

I am using the first workaround, and I wrote my printf float function alternative for for print for spe.

@HansQuote:
Hans wrote:@sailor
How could I make it more accessible to "blones, who did C-coding 25 years before?"

I am sorry Hans, it was joke. It only means, that for me was not enough to read your article, and I had to make some examples and experiments before I understood it completely. Nothing other needed. Thanks.

AmigaOS3: Amiga 1200
AmigaOS4: Micro A1-C, AmigaOne XE, Pegasos II, Sam440ep, Sam440ep-flex, AmigaOne X1000
MorphOS: Efika 5200b, Pegasos I, Pegasos II, Powerbook, Mac Mini, iMac, Powermac Quad
Go to top


Re: A1222 support in the SDK and problems
Just can't stay away
Just can't stay away


@sailor
Quote:
I tried to use -lsoft-fp, but it not exists: "ld: cannot find -lsoft-fp"..
You have to use gcc -msoft-float ...
But if you do not only your own code but all libraries, incl. the C library, you are using have to be compiled with -msoft-float as well. You can't mix FPU with soft-float code, at least not without using similar workarounds you are using for SPE now.

There is probably no soft-float version of newlib. There used to be soft-float versions of clib2, but in case it's no longer available rebuilding clib2 or clib4 with -msoft-float should be no big problem.
With a soft-float C library and building your own code with -msoft-float you don't need workarounds for functions like printf() either, but of course a SPE C library for the A1222 would be much better than a soft-float one which uses integer instructions and registers for float/double.

Go to top


Re: A1222 support in the SDK and problems
Home away from home
Home away from home


@sailor

Quote:
Answer is inside this nice Hans's Taborizing guide - see paragraph 2. But unfortunatelly, this guide is too short, is not written for blondes, who did c-coding 25 years before.

How could I make it more accessible to "blones, who did C-coding 25 years before?"

Hans

http://hdrlab.org.nz/ - Amiga OS 4 projects, programming articles and more.
https://keasigmadelta.com/ - more of my work
Go to top


Re: 2024 - April - Space Cadet Pinball
Just can't stay away
Just can't stay away



Rock lobster bit me - so I'm here forever
X1000 + AmigaOS 4.1 FE
"Anyone can build a fast CPU. The trick is to build a fast system." - Seymour Cray
Go to top


Re: A1222 support in the SDK and problems
Just popping in
Just popping in


@sailor

As workaround you need to pass float parameters by reference and not by value.
Another solution is to pass them using heap space and not stack.
To do this you can use an array of floats and pass it's base address to function.
Another solution is to pass a struct with floats vars as members.

Anyway also printf function is bugged for A1222 and need to be fixed for floats.

I hope someone is working on it and new sdk will be released soon.

Go to top



TopTop
« 1 ... 41 42 43 (44) 45 46 47 ... 7240 »




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project