PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

ARM11 / VFP development

I am working on porting some of my applications to an ARM11-based system with the vector floating point unit (WinCE 5.0). Looking through the documentation, it seems that the current VS.NET toolchain still does not support the floating point hardware. What are the best alternatives? Is there any 3rd-party compiler that would work? Or are there assembly language math libraries?

Thanks,
HM
I heard that the next VisualStudio (Orcas) will have support for ARM11. Maybe try the public beta. It should also work with the compiler of the latest WinCE platform builder.

I haven't tried both myself though.

Daniel
drgoldie wrote:I heard that the next VisualStudio (Orcas) will have support for ARM11. Maybe try the public beta. It should also work with the compiler of the latest WinCE platform builder.

I haven't tried both myself though.

Daniel

Thanks Daniel! I will take a look.

- HM
From the beta-1 doc:
1.3.77. The native compiler's use of Vector Floating Point (VFP) registers is not compatible with Exception Handling (SEH and C++ EH)

The Orcas Beta 1 ARM compiler supports native code generation of Vector Floating Point (VFP) instructions if the -QRfpe- switch is used. However, the compiler’s use of VFP registers is not compatible with Exception Handling (SEH and C++ EH). If a function that uses VFP throws an exception, catches an exception, or is on the callstack between the functions where an exception is thrown and caught, stack corruption may result. This situation could lead to unpredictable behavior or process termination.

So VFP support should be there. Thanks again,
HM
Do a lot of PDAs have ARM11 CPUs?
mm40 wrote:Do a lot of PDAs have ARM11 CPUs?

The first phones I know of were introduced last summer, and from what I can tell more and more of the high end media-enabled phones are based on ARM11.

- HM
Currently I believe it is mostly the OMAP 24xx CPU, which one can find e.g. in the Moto Q9.

What I'm really waiting for is the OMAP 3xxx series (already available as CPU, expect devices beginning of next year) which will be far more powerful and include OpenGL ES 2.0 support...

I already had a Q9 in my hands a few months ago but no compiler to test the VPU. Hans-Martin: Could you post some performance results when you are done testing? I'd be very interested in seeing how floating point compares to fixed point on these devices.

Daniel
If they have an FPU, why would they not replace the floating point emulation libraries on their device with the real thing? This is something that should be transparent and automatic for all games/apps.
Is floating point emulation really implemented in DLLs in Windows Mobile?

Daniel
drgoldie wrote:Hans-Martin: Could you post some performance results when you are done testing? I'd be very interested in seeing how floating point compares to fixed point on these devices.

I am still trying to figure out how to do a fair comparison; so far my code wasn't quite optimized for vectorized floating point values. I might well just move completely over to my OGL-ES 2.0 code base, which is floating point only. But then of course the comparison is not really fair, even though the actual algorithms are actually still mostly the same. In either case I'll let you know.

- HM
Actually synthetic tests such as posted sometimes in this forum would be enough for me. Ideally it would compare floating point in hard- and software against fixed point.

I should try to get my hands on such an ARM11 powered device again... :)

BTW, Since you installed and played around with VS2008: What's your experience with it? Is it usable for production already?

Daniel
drgoldie wrote:Actually synthetic tests such as posted sometimes in this forum would be enough for me. Ideally it would compare floating point in hard- and software against fixed point.

I am not sure what you'd expect from a synthetic test. I mean, you can read the throughput and latency numbers of the FPU in the data sheets, coordinates are still 32 bits compared to fixed, and the memory interface hasn't changed.

The question I need to answer is how much I can increase the framerate for Vincent if I switch to hardware floating point (with the added precision as a bonus). I am not interested in benchmarking how well/badly existing compiler runtimes implemented floating point emulation.

- HM
Isn't getting ARM11 fully up to speed kind of a waste of time because intels mobile x86 CPU is just around the corner, which will probably have automatic floating point, and possibly run native windows apps 8O How awesome would that be.
Hi Hans-Martin,

did you have any success using VFP on the ARM11?
We got a Moto Q9, but as soon as I activate the -QRfpe- compiler switch in VS2008 the application crashes with an illegal instruction error.

Looking into the dissambly I find that the following instruction is causing the problem:

flds s0, [r3]

Any ideas?

Daniel
drgoldie wrote:Hi Hans-Martin,

did you have any success using VFP on the ARM11?
We got a Moto Q9, but as soon as I activate the -QRfpe- compiler switch in VS2008 the application crashes with an illegal instruction error.

Looking into the dissambly I find that the following instruction is causing the problem:

flds s0, [r3]

Any ideas?

Daniel

Same problem here; I am using an i.MX31 LITE board. Looks like the VFP is not enabled in the WinCE kernel; at least I am getting

IsProcessorFeaturePresent(PF_ARM_VFP_SINGLE_PRECISION) == FALSE

Still undecided if I should jump through the hoops of rolling by own OS image, or just wait for somebody else (manufacturer???) to do it.

- HM
mm40 wrote:Isn't getting ARM11 fully up to speed kind of a waste of time because intels mobile x86 CPU is just around the corner, which will probably have automatic floating point, and possibly run native windows apps 8O How awesome would that be.

Are you aware of any phones that will have an x86 any time soon?

- HM
Are you aware of any phones that will have an x86 any time soon?


I guess he's relating to the fact that Intel abandoned its ARM product line in favour of ULV X86 CPUs. It has yet to be shown though that even the most powersaving CPUs of this breed can compete with ARM CPUs that are designed from the very beginning to save power.

Even in case these CPUs would be released soon I doubt that they could quickly break the dominance of ARM cores in this market rather soon...

Daniel
On the MotoQ9, only ARM4, ARM5, and Thumb are activated. Everything else (especially ARM6 and VFP) are not reported as present...

I have quite little experience with the ARM instruction sets, but I don't understand why OS support is required to use floating point instructions.

Daniel
drgoldie wrote:On the MotoQ9, only ARM4, ARM5, and Thumb are activated. Everything else (especially ARM6 and VFP) are not reported as present...

I have quite little experience with the ARM instruction sets, but I don't understand why OS support is required to use floating point instructions.

Daniel

Well, among other things, once you have those additional registers, they also need to be taken into account during context switches, interrupt handlers etc. Also, there some bootsequence published by ARM that needs to be seeded.

- HM
Ok, that makes a lot of sense.

So am I right that we have this cool phone now, but can not use VFP because the phone creator decided that this is not an important feature?

Daniel
Ok, here are some good news.
I contacted some people at MS and they told me that there are two solutions:

The first one is to build a new OS image, as Hans-Martin already suggested. The asm code below should then be executated during startup. In my case (using a commercial phone) this is of course not an option though.

Luckily there's a second option: The application can switch to kernel mode in order to activate the co-processor, which will work then, but only for a single thread (since the OS is not aware that it has to safe those registers).

To activate the co-processor the application has to execute the following assembler code:

Code:
; Enable VFP via Coprocessor Access Control Register
mrc p15, 0, r0, c1, c0, 2
orr r0, r0, #0x00F00000
mcr p15, 0, r0, c1, c0, 2


Details on these registers can be found on page 218 in http://www.arm.com/pdfs/DDI0211J_arm1136_r1p5_trm.pdf.

The same should also be possible using intrinsics as documented at http://msdn2.microsoft.com/en-us/library/ms253515(vs.80).aspx.

I'll try to make use of that, but my knowledge in this area is quite limited, so let's see...

Daniel
drgoldie wrote:Ok, here are some good news.

Interesting. Even though I decided to wait for my development board vendor to fix the OS image. And in the interim got Linux up and running... can even use my MBP for development... :)

- HM
Ok, I got it to run, although some more lines of ASM code were required. A big thanks goes to Russ Keldorph from Microsoft to help me out on this.

Here are some results (all with single precision floating point), comparing h/w vs. s/w floating point using some synthetic benchmarks I wrote:

Multiplication: 22.5 times faster
Addition: 22.2 times faster
Square root: 1.04 times faster
4x4 Matrix Multiply: 28.7 times faster

It seems that the square root was not done with hardware support, but the rest is pretty impressive.

I did notice though that using VFP did not work after some tests requiring a reboot of the device to make it work again. I will have to invenstigate that further.

Daniel
drgoldie wrote:I did notice though that using VFP did not work after some tests requiring a reboot of the device to make it work again. I will have to invenstigate that further.

Maybe an IRQ?

- HM
Russ warned me that it might happen that the OS turns of the VFP for some reason. I did not find the time yet to look at this in more detail.

I hope though that in the future hardware vendors appreciate the need for the VFP. I guess it is just a click in the platform builder to turn on VFP support...

Daniel
hm wrote:
Same problem here; I am using an i.MX31 LITE board. Looks like the VFP is not enabled in the WinCE kernel; at least I am getting

IsProcessorFeaturePresent(PF_ARM_VFP_SINGLE_PRECISION) == FALSE

Still undecided if I should jump through the hoops of rolling by own OS image, or just wait for somebody else (manufacturer???) to do it.

Not sure if anybody cares in this forum (since it's not really PocketPC), but LogicPD posted a new WinCE image that has floating point support enabled.

- HM