RISC OS Open
A fast and easily customised operating system for ARM devices
ROOL
Home | News | Downloads | Bugs | Bounties | Forum | Documents | Photos | Contact us
Account
Forums → Code review →

BASICVFP

Subscribe to BASICVFP 47 posts, 12 voices

Posts per page:

Pages: 1 2

 
Feb 26, 2017 7:02pm
Avatar David Feugey (2125) 1956 posts

(based on some of your add-ons of course :) )

 
Feb 26, 2017 7:37pm
Avatar Jeffrey Lee (213) 5288 posts

Basic could also simply throw an error, as programmer can simulates 2 and 5 cases itself (manual zeroing or manual copy).

The new version will still throw an error. I just want to change the timing of when the error is generated, so that it occurs at the end of the operation (after all the results have been written), instead of needing to check for errors during the core loop which is performing the calculations and writing the results.

 
Mar 4, 2017 6:25pm
Avatar Jeffrey Lee (213) 5288 posts

New test build uploaded

Apart from these changes, I think the only significant change compared to the previous test version is that the array operations (apart from matrix multiply) now use VFP/NEON vectors where possible. Currently the VFP array operations check for errors before writing back each vector.

 
Mar 20, 2017 5:33pm
Avatar David Feugey (2125) 1956 posts

Quick test on a Raspberry Pi 3:
Basic VFP: 25,7s
Basic VFP crunched: 16,5s

Much faster than Basic VI:
Basic VI: 98s
Basic VI crunched: 87,9s

And still faster than Basic V:
Basic V : 30,5s
Basic V crunched: 20,4s

Better than ABC too:
ABC: 33s
ABC quick: 32,3s

It would be cool to get a FPEmulator module compiled with VFP instructions.
And direct support of VFP on ABC :)

 
Mar 20, 2017 6:12pm
Avatar Rick Murray (539) 7571 posts

And direct support of VFP on ABC :)

This, actually, shouldn’t be that difficult as ABC is a closed environment (that is to say, it is really only compatible with itself) so having a VFP choice ought to be simpler that, say, in the C compiler (which could have consequences for every library that expects to work with FPA style floats).

The problem here is who is willing to develop the code. There have been some tweaks, but ABC isn’t part of the open source so we just have to hope…

 
Mar 20, 2017 6:55pm
Avatar Rick Murray (539) 7571 posts

To put this into context, I tried this in Charm:

Module Main
{

export proc ~start (int argc, ref array ref array char argv)
{
   int  loop := 1000000;
   real calc := 0;
   int  start := 0;
   int  end := 0;

   start := Riscos.read_time();
   repeat
   {
      calc := 123.45 * loop;
      loop := loop - 1;
   } loop = 0;
   end := Riscos.read_time() - start;

   Out.vdu.str ("That took ");
   Out.vdu.num (end);
   Out.vdu.str (" cs\n");
   Out.vdu.nl ();
}
}

Never coded anything in Charm before, so apologies if the code sucks.
That said, targeting the FPA (default) runs the code in 117cs on my Pi1.
Switching to VFP (needs a full rebuild of the libraries, easy to do…) generates a program that does the exact same job in a mere 6cs.

Need we say more? ;-)

 
Mar 20, 2017 9:08pm
Avatar David Feugey (2125) 1956 posts

The problem here is who is willing to develop the code. There have been some tweaks, but ABC isn’t part of the open source so we just have to hope…

Now It should be more easy to get access to source code (under NDA, of course).

 
Jun 12, 2017 5:27pm
Avatar Rick Murray (539) 7571 posts

Now that BASICVFP is a thing, has anybody tried benchmarking the various versions of BASIC?
I wonder if it would be as dramatic as my Charm test (117cs FPE → 7cs VFP)?

 
Jun 12, 2017 7:53pm
Avatar Clive Semmens (2335) 1360 posts

Now that BASICVFP is a thing

Is it necessary to write a whole new RISCOS image to an SD card to get BASICVFP, or can it be added to an existing RC15 card? (Does it even work on RC15, or does it require high vectors?)

I’m quite interested to give it a whirl if I can do it without messing with my nicely working system, or having to change cards to use it.

 
Jun 12, 2017 9:15pm
Avatar Jeffrey Lee (213) 5288 posts

I don’t think there are any specific requirements, beyond needing a version of RISC OS which has the VFPSupport module.

Since I’m feeling generous, I’ve updated the test archive from above with an up-to-date build of BASICVFP.

Overall you can expect performance to be better than that of regular BASIC V (David posted some figures above). Also, in CVS there’s an array test/benchmark app that gives a good indication of the performance of the vector-optimised whole-array operations – which will actually vary a lot from machine to machine depending on whether VFP short vectors and/or NEON are supported.

https://www.riscosopen.org/viewer/view/~checkout~/castle/RiscOS/Sources/Programmer/BASIC/Tests/Math/Array%2Cffb?rev=1.1;content-type=application%2Foctet-stream

 
Jun 13, 2017 6:11am
Avatar Clive Semmens (2335) 1360 posts

Brilliant – thanks!

I love the way it starts up saying © Acorn 1989 8~)

 
Jun 13, 2017 4:33pm
Avatar Rick Murray (539) 7571 posts

They all start up saying that. It’s a bit disconcerting. ;-)

I’m sure there are long boring reasons why it doesn’t claim to be copyright the current owner and year of release of that version. After all, the “copyright Acorn 1989” is pretty arbitrary, as I think I can go out on a limb here and say the (original) Arthur version didn’t say that. ;-)

 
Jun 13, 2017 4:46pm
Avatar Clive Semmens (2335) 1360 posts

You’d normally expect it to say “© Acorn & XXX 1989-2017” (or whatever) so that it claims priority over anything after 1989, and gives preliminary evidence that at least on of the authors was still alive in 2017 (and that therefore the copyright doesn’t expire until 2087 at the earliest).

 
Jun 14, 2017 7:34pm
Avatar Clive Semmens (2335) 1360 posts

I can’t report any benchmarks, but I can confirm that BASICVFP runs all my publicly available programs perfectly well, and produces results with greater precision (not that it’s relevant to any of the purposes they’re for). The extra speed is probably irrelevant, so unless anyone tells me otherwise I’ll not be changing the !RUN files in the published versions to use BASICVFP.

 
Jun 15, 2017 8:03am
Avatar jan de boer (472) 45 posts

Benchmarks…

Module is: BBC BASIC V 1.67 (03 Jun 2017)
Array-array addition perf
10.891304348MFlops
210.42000002Mops
Array-scalar subtraction perf
12.956896551MFlops
248.01980197Mops
Scalar-array subtraction perf
12.846153848MFlops
252.98019803Mops
Array-array multiply perf
11.051470589MFlops
176.82352942Mops
Array-array divide perf
5.7257142849MFlops
13.300884955Mops
Array sum perf
25.049999997MFlops
325.64999998Mops
Array modulus perf
11.051470589MFlops
235.47000003Mops

Module is: BBC BASIC VI (VFP) 1.64 (04 Mar 2017)
Array-array addition perf
77.825242718446603MFlops
410.81999999999999Mops
Array-scalar subtraction perf
84.32673267326733MFlops
526.04999999999995Mops
Scalar-array subtraction perf
85.170000000000002MFlops
541.08000000000004Mops
Array-array multiply perf
79.366336633663366MFlops
406.75247524752473Mops
Array-array divide perf
35.469026548672566MFlops
13.419642857142858Mops
Array sum perf
255.50999999999999MFlops
751.5Mops
Array modulus perf
255.50999999999999MFlops
631.25999999999999Mops

Module is: BBC BASIC VI (VFP) 1.67 (03 Jun 2017)
Array-array addition perf
119.04950495049505MFlops
410.81999999999999Mops
Array-scalar subtraction perf
133.93069306930693MFlops
526.04999999999995Mops
Scalar-array subtraction perf
133.93069306930693MFlops
546.09000000000003Mops
Array-array multiply perf
121.60194174757281MFlops
410.81999999999999Mops
Array-array divide perf
41.75MFlops
12.421487603305785Mops
Array sum perf
257.94059405940595MFlops
746.49000000000001Mops
Array modulus perf
255.50999999999999MFlops
631.25999999999999Mops

Unreal.

 
Jun 15, 2017 9:44am
Avatar Rick Murray (539) 7571 posts

Err… <eyes glaze over at big pile of numbers>

So… VFP… That’s good, then, right?

 
Jun 15, 2017 9:47am
Avatar Rick Murray (539) 7571 posts

Wait… I know my maths capabilities suck, but am I reading this right? FPE can outperform VFP (how?!?) and normal BASIC wipes the floor with both of the FP systems? That can’t be… Can it? Tell me I’m reading this wrongly.

 
Jun 15, 2017 9:54am
Avatar Grahame Parish (436) 139 posts

It’s in ops (operations per second), so higher is better!

 
Jun 15, 2017 10:37am
Avatar Jeffrey Lee (213) 5288 posts

MFlops = million floating point ops / sec
Mops = million integer ops / sec

Also I see no FPE results in there (jan has posted results from two different versions of BASICVFP; I guess an older test build and the release version)

The results would be a bit easier to read if I’d thought to reset @% before printing them! (it’s output from the “Array” test program I linked to above; the high-precision output is useful for if a test fails and it prints out the input/output numbers)

 
Jun 15, 2017 11:04am
Avatar dave_j (3231) 50 posts

From a Titanium.

*fx0
RISC OS 5.23 (14 Jun 2017)


Module is: BBC BASIC V     1.68 (13 Jun 2017)
*BASIC

Array-array addition perf
      19.8MFlops
     430.9Mops
Array-scalar subtraction perf
      28.9MFlops
     511.0Mops
Scalar-array subtraction perf
      27.8MFlops
     516.0Mops
Array-array multiply perf
      21.1MFlops
     431.6Mops
Array-array divide perf
       7.8MFlops
      16.6Mops
Array sum perf
      35.2MFlops
     596.2Mops
Array modulus perf
      18.9MFlops
     501.0Mops


Module is: BBC BASIC VI    1.68 (13 Jun 2017)
*basic64

Array-array addition perf
       2.4MFlops
     430.9Mops
Array-scalar subtraction perf
       2.6MFlops
     511.0Mops
Scalar-array subtraction perf
       2.7MFlops
     511.0Mops
Array-array multiply perf
       2.5MFlops
     431.6Mops
Array-array divide perf
       2.0MFlops
      16.7Mops
Array sum perf
       3.1MFlops
     591.2Mops
Array modulus perf
       1.7MFlops
     295.6Mops


Module is: BBC BASIC VI (VFP)      1.68 (13 Jun 2017)
*basicvfp

Array-array addition perf
     330.7MFlops
     806.6Mops
Array-scalar subtraction perf
     410.8MFlops
     901.8Mops
Scalar-array subtraction perf
     415.8MFlops
     956.9Mops
Array-array multiply perf
     332.3MFlops
     721.4Mops
Array-array divide perf
      49.6MFlops
      17.0Mops
Array sum perf
     270.5MFlops
    1177.3Mops
Array modulus perf
     330.7MFlops
    1022.0Mops
>
 
Jun 15, 2017 11:22am
Avatar Chris Evans (457) 1438 posts

Jan: What hardware were you using?

 
Jun 15, 2017 9:13pm
Avatar jan de boer (472) 45 posts

Chris: The VFP benchmarks were done on an RPI3. I should have mentioned it. Titanium is still a lot faster, I see.

Pages: 1 2

Reply

To post replies, please first log in.

Forums → Code review →

Search forums

Social

Follow us on and

ROOL Store

Buy RISC OS Open merchandise here, including SD cards for Raspberry Pi and more.

Donate! Why?

Help ROOL make things happen – please consider donating!

RISC OS IPR

RISC OS is an Open Source operating system owned by RISC OS Developments Ltd and licensed primarily under the Apache 2.0 license.

Description

Developer peer review of proposed code alterations.

Voices

  • David Feugey (2125)
  • Jeffrey Lee (213)
  • Rick Murray (539)
  • Clive Semmens (2335)
  • jan de boer (472)
  • Grahame Parish (436)
  • dave_j (3231)
  • Chris Evans (457)

Options

  • Forums
  • Login
Site design © RISC OS Open Limited 2018 except where indicated
The RISC OS Open Beast theme is based on Beast's default layout

Valid XHTML 1.0  |  Valid CSS

Powered by Beast © 2006 Josh Goebel and Rick Olson
This site runs on Rails

Hosted by Arachsys