#1 2021-08-02 22:59:15

ttomas
Member
Registered: 2013-03-08
Posts: 57

Oracle OCI ARMv8.2 VM

Just open account on Oracle Cloud and create new compute VM: 4 ARMv8.2 CPU 3GHz, 24GB Ram (yes 24GB).
This is always free VM (you can combine this 4 cores and 24GB Ram to 1 or many (4) VM).
Install Ubuntu 20.04 server, then install LXDE and XRdp for remote access.
Now I have nice speed workstation. Install fpcupdeluxe then fpc 3.2.2/laz 2.0.12, all OK. fpcup build is faster then my local pc build :-)
mormot2 compile package OK, build mormot2_test OK.
mormot2test freeze on  2.7. Client server access: , I must press ^C
log end screen stdout: http://halkyon.com/download/mormot2test.zip

This OCI VM can be great mormot application server for some projects. I don't have any connection to Oracle just test there product.

Offline

#2 2021-08-03 07:04:48

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 12,534
Website

Re: Oracle OCI ARMv8.2 VM

Nice findings about Oracle Cloud!
FPC 3.2.2 has troubles with variants late binding, even on Intel/AMD.
https://synopse.info/forum/viewtopic.php?id=5894

But there seems indeed to be a problem with our SQLite3 / AARCH64 static linked content.
We will try to see what's wrong. Perhaps Alfred could help here also. wink

I just tried Oracle Cloud, but it needs a small credit card fee of 1€ which failed for my french Visa. Don't know why.
Anyway, I will boot up my Raspery Pi and try out! smile

Offline

#3 2021-08-03 08:48:55

ttomas
Member
Registered: 2013-03-08
Posts: 57

Re: Oracle OCI ARMv8.2 VM

1€ only for verification, try several times. I see this problem on some youtube video.
Try Netherlands as home

Last edited by ttomas (2021-08-03 08:52:38)

Offline

#4 2021-08-03 10:18:22

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 12,534
Website

Re: Oracle OCI ARMv8.2 VM

With another credit card from another bank, it worked.

But I had no success installing xrdp first.
I did have to use a ssh connection tunnel, and connect via the loopback.
Adding a new dedicated user.

Offline

#5 2021-08-03 12:04:25

ttomas
Member
Registered: 2013-03-08
Posts: 57

Re: Oracle OCI ARMv8.2 VM

After boot of VM you need this commands:
sudo apt update
sudo apt upgrade
sudo apt install lxde
sudo apt install xrdp

sudo passwd ubuntu
# you will add pw for gui login to default ubuntu user

# Lazarus dependency
sudo apt install make binutils build-essential gdb subversion zip unzip libx11-dev libgtk2.0-dev libgdk-pixbuf2.0-dev libcairo2-dev libpango1.0-dev

wget fpcupdeluxe aarch64 and be happy

Yes rdp tcp port 3389 is not public I use ssh port forwarding to my PC
Linux: ssh -L 3389:localhost:3389 -i mykey ubuntu@myip
Windows: Configure Putty-Connection.SSH.Tunnels
You can publish any port in OCI config and Ubuntu FW, not recommended for rdp :-)

Offline

#6 2021-08-03 13:27:58

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 12,534
Website

Re: Oracle OCI ARMv8.2 VM

If we use the external SQlite3 library, I have almost 100% green, and amazing performance for ARM - much faster than on Raspberry or mobile CPUs.
https://gist.github.com/synopse/60fe59d … b5d6294c39
Numbers are at the level of the Core i5 on my laptop.

Remains only problems at SOA level, which we still need to investigate.

Offline

#7 2021-08-03 17:08:27

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 12,534
Website

Re: Oracle OCI ARMv8.2 VM

I spend hours fighting against the Lazarus debugger, with no luck to discover what is wrong with processing EchoRecord.
Fighting is right term, because GDB is just crashing and crashing, on whatever Dwarf symbol level we use, and even on -O0.

If I replace the returned TServiceComplexCalculator.EchoRecord from the result to an "out" parameter, then there if no GPF any more.
So I guess we could just reject the use of such result on Aarch64 and requires an "out" parameter instead.

Offline

#8 2021-08-03 17:52:05

AOG
Member
Registered: 2014-02-24
Posts: 464

Re: Oracle OCI ARMv8.2 VM

As an in-between test, you could add the EchoRecord function into mORMot1.18 and see if it works with that version.
(skip this post if it is already there)

Last edited by AOG (2021-08-03 18:40:37)

Offline

#9 2021-08-03 18:38:22

AOG
Member
Registered: 2014-02-24
Posts: 464

Re: Oracle OCI ARMv8.2 VM

From the book:

Otherwise, the caller shall reserve a block of memory of sufficient size and alignment to hold the result. The
address of the memory block shall be passed as an additional argument to the function in x8. The callee may
modify the result memory block at any point during the execution of the subroutine (there is no requirement for
the callee to preserve the value stored in x8).

From the assembler:

TEST.SOA.CORE$_$TSERVICECOMPLEXCALCULATOR_$__$$_ECHORECORD$TCONSULTANAV$$TCONSULTANAV:
// [548] begin
	stp	x29,x30,[sp, #-16]!
	mov	x29,sp
// Var $self located in register x0
// Var $result located in register x8

It seems we have to take care of results passed in x8 !

Offline

#10 2021-08-04 07:55:24

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 12,534
Website

Re: Oracle OCI ARMv8.2 VM

What I don't understand is that https://github.com/ARM-software/abi-aa/ … r-passings states that any result > 16 bytes should move to x8 and not use regular registers.
But TServiceCustomAnswer is 24 bytes on AARCH64 and works in regular registers., whereas the documentation would rather put it into x8..
Whereas TConsultVav is 26 bytes and seems to expect to be in x8...

The worse is that if TConsultaNav is modified to take only 24 bytes... it also fails, whereas TServiceCustomAnswer has no problem... sad
And if I define it as such:

  TConsultaNav = packed record
      Header: RawUtf8;
      Content: RawByteString;
      Status: cardinal;
    //MaxRows, Row0, RowCount: int64;
    //IsSqlUpdateBack, EOF: boolean;
  end;

still 24 bytes but it is passed as registers! sad
I am lost - perhaps it is a FPC bug?

Offline

#11 2021-08-04 09:21:57

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 12,534
Website

Re: Oracle OCI ARMv8.2 VM

OK.

This is not a FPC bug, this is a FPC feature... mad

procedure tcpuparamanager.create_paraloc_info_intern(p : tabstractprocdef; side: tcallercallee; paras: tparalist; isvariadic: boolean);
      var
        hp: tparavarsym;
        i: longint;
      begin
        for i:=0 to paras.count-1 do
          begin
            hp:=tparavarsym(paras[i]);
            { hidden function result parameter is passed in X8 (doesn't have to
              be valid on return) according to the ABI

              -- don't follow the ABI for managed types, because
               a) they are passed in registers as parameters, so we should also
                  return them in a register to be ABI-compliant (which we can't
                  because the entire compiler is built around the idea that
                  they are returned by reference, for ref-counting performance
                  and Delphi-compatibility reasons)
               b) there are hacks in the system unit that expect that you can
                  call
                    function f: com_interface;
                  as
                    procedure p(out o: obj);
                  That can only work in case we do not use x8 to return them
                  from the function, but the regular first parameter register.

              As the ABI says this behaviour is ok for C++ classes with a
              non-trivial copy constructor or destructor, it seems reasonable
              for us to do this for managed types as well.}

At least it is clearly documented as such.

Offline

#12 2021-08-04 09:31:48

AOG
Member
Registered: 2014-02-24
Posts: 464

Re: Oracle OCI ARMv8.2 VM

Nice find. This is good to know ! Lets try to use this "feature" ... smile

Offline

#13 2021-08-04 09:50:14

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 12,534
Website

Re: Oracle OCI ARMv8.2 VM

Note that Delphi has another way of processing parameters:

    if IsManaged(FReturnType) or ((FReturnType^.Kind in [tkRecord, tkMRecord]) and
      (GetTypeData(FReturnType)^.RecSize > 16)) then
    begin
      FResultLoc := TParamLoc.Create(FReturnType, True, False, True);
// In this case, ARM64 will use X8
      FResultLoc.FOffset := $10000008;
    end;

So it uses x8 every time for managed parameters, whereas FPC never for managed parameters...

Offline

#14 2021-08-06 13:37:04

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 12,534
Website

Re: Oracle OCI ARMv8.2 VM

I have made a lot of enhancements to the AARCH64 support, on the Ampere/Oracle server.
Now tests all pass with static linked SQlite3.
Please see the regression tests console output: https://gist.github.com/synopse/256190a … ed99f07da6

I have included optimized ARMv8 SIMD asm for crc32c, aes and sha256.
Numbers are even better than our optimized Intel/AMD SSE4.2/AES-NI code running on my Core i5 CPU: 20GB/s for crc32c, more than 1GB/s for AES, 1.5GB/s for SHA-256.
This Ampere CPU is clearly something, in respect to other ARM CPUs I tested.
The good news is that those ARMv8 optimizations should benefit on other CPUs, e.g. on the Android platform or Apple M1 laptops.

Note that I still need to publish the associated static .o files.
They will include the latest SQlite 3 3.36.0 library on all targets.

Offline

#15 2021-08-17 14:32:25

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 12,534
Website

Re: Oracle OCI ARMv8.2 VM

I just wrote a blog article about this experiment, and how we were pleased with this Ampere CPU and the Oracle Cloud platform.

Any feedback about https://blog.synopse.info/?post/2021/08 … AARM64-CPU
is welcome on this forum thread.

Offline

#16 2021-08-17 15:57:40

mdbs99
Member
From: Rio de Janeiro, Brazil
Registered: 2018-01-20
Posts: 127
Website

Re: Oracle OCI ARMv8.2 VM

Congratulations on achieving this!

Offline

#17 2021-08-19 04:10:31

edwinsn
Member
Registered: 2010-07-02
Posts: 1,118

Re: Oracle OCI ARMv8.2 VM

Great finding and Great job! However, my visa credit card failed to register...


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#18 2021-08-19 06:15:12

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 12,534
Website

Re: Oracle OCI ARMv8.2 VM

I had to try two different cards until it worked from France...

They seem to have some payment issues. Perhaps Oracle has so much money, and their boss boat is so big they don't need any more? wink

Offline

#19 2021-08-19 06:40:35

edwinsn
Member
Registered: 2010-07-02
Posts: 1,118

Re: Oracle OCI ARMv8.2 VM

And that's why I offered to help spending their money by consuming their always-free VM wink


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

Board footer

Powered by FluxBB