Friday, 3 June 2011

VFPv3/SIMD Assembler Progressing

The last couple of days have been spent full-time on the VFPv3 / SIMD assembler for BASIC.  It's now approaching a first complete version as I've been through a lot of tidying up and commenting.  Some SIMD instructions remain to add as it's a very large instruction set but all the major ones are there now.

The exercise in writing an assembler has been fantastic in getting an understanding of the instructions and their uses.  I've had to read through the variations of each instruction and the associated encoding formats.  The only headache has been errors and inconsistencies in the ARM reference manual.   I guess with everyone using C compilers these days few people delve into raw machine code.

The reason for all this work on VFP is to create a new 3D calculations library for TAG.  This has to run using hardware floating point to achieve the performance and accuracy we require.  We've decided not to go with Mesa Open GL now as it won't run fast enough and will take significant effort to get running.  However we will revisit it in future if time permits.  An open source driver for the PowerVR/SGX hardware may well end up in the Mesa code-base.

Today I also downloaded the RISC OS source and took a look at the BASIC source code.   The idea is to add the VFP and SIMD instructions to the BASIC assembler while learning about how it works to add language extensions.  Sadly the code appears poorly structured and documented.  Thankfully it isn't that large so it should be possible to digest what is going on.  I'll try and get my head around it after I've completed the VFP library.

12 comments:

  1. Impressive work.

    It's great to see someone who is obviously very talented work with RISC OS 5 and move it forward.

    While you are making inroads to TAG3D to work with newer hardware it was interesting to note that Martin Piper has been doing the complete opposite - It now works on the C64! http://pouet.net/prod.php?which=56793

    anyway, great to see you back working on RISC OS. It's a great platform with *plenty* of opportunity to improve it.

    ReplyDelete
  2. Thanks - nice to hear some positive comments.

    I developed a pre-emptive multi-tasking demo with Martin for the C64 and BBC B many years ago. It's no surprise that some kind of 3D is possible - pre-calculated or however it is done :)

    ReplyDelete
  3. Nice !!! I'm really looking forward to use the Basic Assembler again. For the moment I'm using ExtASM, as it supports the additional cpu units already. You may have seen my Mandelbrot stuff in the RiscOSOpen forums, if not, find it here -> www.mikusite.de

    By the way: The VFP unit is quite slow, even for non SIMD use the Neon is much faster.

    Just there's a lack of fast math operations (sqrt, sin, etc.) for Neon. In the net I found that -> http://math-neon.googlecode.com/svn-history/r27/trunk/

    ...may be usefull for you, too. I guess you would need sqrt/sin etc., but may be lookuptables are still good enough or faster...

    ReplyDelete
  4. Thanks, those links are very helpful.

    ExtASM will be useful as a reference to test the output from the library. We don't have access to the official ARM development tools so it's not exactly easy to debug an assembler.

    All the instructions for NEON and VFPv3 are included as per the ARM manual. I'm not currently 100% on all of the syntax as the manual is rather unclear in some places and contains errors in others.

    I'm also looking at an alternative 32:32 fixed precision method as it can be much faster. As you say lookup tables are good for certain basic maths.

    ReplyDelete
  5. About the BASIC assembler:

    "Sadly the code appears poorly structured and documented."

    Yeah, that was my impression, too, when I looked at it earlier(http://www.riscosopen.org/forum/forums/3/topics/183#posts-5235)

    If you wonder about something regarding the implementation of VFP/SIMD instructions, feel free to send me a mail about it (tslettebo@broadpark.no), as I may be of some help, from the experience with extASM.

    You may also know that the DecAOF disassembler now handles ARMv7, although it requires the code to be wrapped in the AOF format for it to work.

    Such a file is reasonably easy to make, though, and you should be able to do it in BASIC/assembly, with a bunch of EQUD for the various fields.

    I used DecAOF to verify extASM, myself.

    I also agree regarding OpenGL: I've played with the idea of implementing it in RISC OS, myself, but concluded that without hardware acceleration, it would be too slow for interactive rendering.

    Regards,

    Terje Slettebø

    ReplyDelete
  6. Superbly written article..
    Antivirus comes in the list of most needed software as it protects our device for virus but several times it shows tech issues also. In case Avast installed in your device is putting you in panic then call Avast Support Number UK and get your issue solved in just few minutes.

    ReplyDelete
  7. Nice blog.

    Call @ Acer Support Number UK to get resolved all your issues related to your Acer computer or laptop.

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete
  9. Hotmail has introduced the fastest mailing experience for two decades. Besides this, complications related to username and password keep on bothering us. In this case, Hotmail Help Number UK is what you need to solve this problem in a short a while.
    Hotmail Support Number UK
    Hotmail Contact Number UK

    ReplyDelete
  10. Want to get best catering services in Delhi at affordable price?Call us at Vintage Delhi +91-8471048958.

    ReplyDelete