Author Topic: What µC are you preffering  (Read 31000 times)

0 Members and 1 Guest are viewing this topic.

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4036
  • Country: nz
Re: What µC are you preffering
« Reply #175 on: March 30, 2021, 11:08:35 pm »
What I found interesting was how very much faster the M7 is compared to the A7 in the Pi 2.

The Pi2 has a Cortex-A53, which is in the ARMv7 family. "A7" would not be quite correct. Just nitpicking though.

I can assure you that *my* Pi 2, purchased in February 2015 when that was the best Pi available, has a 900 MHz Cortex A7.

After the Pi 3 was released in February 2016, a new Pi 2 v1.2 with derated A53 was released in October 2016.

I have no idea why anyone would buy an A53 Pi 2 as the price is the same as the faster Pi 3 which was released 8 months earlier.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14475
  • Country: fr
Re: What µC are you preffering
« Reply #176 on: March 30, 2021, 11:28:34 pm »
What I found interesting was how very much faster the M7 is compared to the A7 in the Pi 2.

The Pi2 has a Cortex-A53, which is in the ARMv7 family. "A7" would not be quite correct. Just nitpicking though.

I can assure you that *my* Pi 2, purchased in February 2015 when that was the best Pi available, has a 900 MHz Cortex A7.

After the Pi 3 was released in February 2016, a new Pi 2 v1.2 with derated A53 was released in October 2016.

I have no idea why anyone would buy an A53 Pi 2 as the price is the same as the faster Pi 3 which was released 8 months earlier.

I'm not ultra familiar with all the Cortex-A series, so I had to check a little. So here it is:

- The Cortex-A7 is a 32-bit processor, the last of the aarch32 series as far as I've understood. Armv7 architecture.
- The Cortex-A53 is a 64-bit processor, aarch64. Armv8 architecture.

As to the Pi2, I must have been confused with the two versions. The Coremark score I linked to above is for the version with a Cortex-A7 as far as I can tell. And yes, the M7 is much faster per MHz.

 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4036
  • Country: nz
Re: What µC are you preffering
« Reply #177 on: March 31, 2021, 12:29:26 am »
What I found interesting was how very much faster the M7 is compared to the A7 in the Pi 2.

The Pi2 has a Cortex-A53, which is in the ARMv7 family. "A7" would not be quite correct. Just nitpicking though.

I can assure you that *my* Pi 2, purchased in February 2015 when that was the best Pi available, has a 900 MHz Cortex A7.

After the Pi 3 was released in February 2016, a new Pi 2 v1.2 with derated A53 was released in October 2016.

I have no idea why anyone would buy an A53 Pi 2 as the price is the same as the faster Pi 3 which was released 8 months earlier.

I'm not ultra familiar with all the Cortex-A series, so I had to check a little. So here it is:

- The Cortex-A7 is a 32-bit processor, the last of the aarch32 series as far as I've understood. Armv7 architecture.

Yes, of course. Just like the M7.

The Cortex A15 is a much more powerful out-of-order 32 bit CPU, found in things such as the Odroid XU3/4 (Samsung Exynos 5422) and the Apple A6 (iPhone 5 -- apparently a fairly tweaked A15, not standard).

Quote
- The Cortex-A53 is a 64-bit processor, aarch64. Armv8 architecture.

When used in a Raspberry Pi, the A53 is used only in 32 bit mode. In fact the Raspbian operating system and applications use only the 32 bit fixed-length ARMv6 instruction set, for compatibility with the original Raspberry Pi and Pi Zero.

It is only in the last year, approximately, that an experimental 64 bit ARMv8-A Raspbian has been available even though Raspberry Pis for the last five years have had 64 bit-capable CPUs.

They seem to have skipped using the ARMv7-A (i.e. Thumb2) instruction set entirely.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14475
  • Country: fr
Re: What µC are you preffering
« Reply #178 on: March 31, 2021, 01:04:33 am »
When used in a Raspberry Pi, the A53 is used only in 32 bit mode. In fact the Raspbian operating system and applications use only the 32 bit fixed-length ARMv6 instruction set, for compatibility with the original Raspberry Pi and Pi Zero.

It is only in the last year, approximately, that an experimental 64 bit ARMv8-A Raspbian has been available even though Raspberry Pis for the last five years have had 64 bit-capable CPUs.

I think we're getting off-topic... but just to say, for RPi's, my distribution of choice has been ArchLinux ARM for years: https://archlinuxarm.org/
A 64-bit version has been available for several years now. Never had any issue.

As to again the A7 and M7, they may both have a common ancestor, but the architecture is slightly different: Armv7-A for the A7, Armv7E-M for the M7.
The A7 is a 8-stage pipeline. Not sure if it's superscalar (if you happen to know?)
The M7 is a 6-stage pipeline, superscalar.
As we can again see from benchmarks, their raw performance is quite different.
« Last Edit: March 31, 2021, 01:17:37 am by SiliconWizard »
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: What µC are you preffering
« Reply #179 on: March 31, 2021, 02:14:14 am »
Quote
yes, the M7 is much faster per MHz.
Well, I'd expect the external memory to be slower, right?
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4036
  • Country: nz
Re: What µC are you preffering
« Reply #180 on: March 31, 2021, 02:16:45 am »
I found instructions for installing 64 bit Arch on the Pi 3 from November 17 2018, about 2.4 years ago. The Pi 3 has been out for five years.

That's great you've been using 64 bit Arch for a couple of years. I've only ever run 64 bit Ubuntu on my Pi 4 too.

Almost three years from the hardware coming out to getting 64 bit OS support from 3rd parties seems rather slow to me.

The official Raspberry Pi OS 64 bit version is still now in beta. In the latest snapshot in November things such as accelerated video still don't work. It's not even easy to find -- as far as I can tell the way to find it is basically this thread on the forums:

https://www.raspberrypi.org/forums/viewtopic.php?t=275370

More than five years after 64 bit Pi hardware came out, I find this ... surprising ... disappointing ... rather poor form ...
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4036
  • Country: nz
Re: What µC are you preffering
« Reply #181 on: March 31, 2021, 02:18:09 am »
Quote
yes, the M7 is much faster per MHz.
Well, I'd expect the external memory to be slower, right?

The benchmark I'm using uses 8000 + epsilon bytes of RAM. It fits into a Mega2560, and into the L1 cache (i.e. static RAM) of pretty much anything, including the Cortex A7.

Coremark and Dhrystone will also fit into the L1 caches.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14475
  • Country: fr
Re: What µC are you preffering
« Reply #182 on: March 31, 2021, 05:16:28 pm »
More than five years after 64 bit Pi hardware came out, I find this ... surprising ... disappointing ... rather poor form ...

I think this has been discussed on a regular basis, but software support on most of those SBCs is lacking, and usually after a couple years, the vendors release a new model, and stop improving the support for the older ones. So you're screwed. The RPi foundation is not the worst out there for that, it's actually not all bad, but it's still lacking. And again the fact those boards use SOCs the documentation of which is very hard to get just prevents effective contributions.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: What µC are you preffering
« Reply #183 on: March 31, 2021, 09:25:03 pm »
Quote
I found instructions for installing 64 bit Arch on the Pi 3 from November 17 2018, about 2.4 years ago. The Pi 3 has been out for five years.
Whatever.  I thought the driving factor behind 64bits was support for more than 4G of address space, so I don't see a lot of motivation (or need) for porting a 64bit OS to hardware with 1GB of RAM...
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4036
  • Country: nz
Re: What µC are you preffering
« Reply #184 on: March 31, 2021, 11:51:14 pm »
Quote
I found instructions for installing 64 bit Arch on the Pi 3 from November 17 2018, about 2.4 years ago. The Pi 3 has been out for five years.
Whatever.  I thought the driving factor behind 64bits was support for more than 4G of address space, so I don't see a lot of motivation (or need) for porting a 64bit OS to hardware with 1GB of RAM...

In ARM and x86 land the 64 bit ISAs also have twice the number of registers -- and more than twice the *usable* registers as things such as PC and SP and FP and LR taker a fixed overhead out of the registers (and on arm64 the PC isn't in a general register at all)

Even when the current hardware has less than 4 GB, you may want to get a head start on writing software that will run on systems with more than 4 GB. Raspberry Pis are now available with 8 GB RAM -- and the supported OS is still 32 bit.

The A53 in the Pi 3 runs 64 bit code about 20% faster than 32 bit code.

There are a ton of reasons.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14475
  • Country: fr
Re: What µC are you preffering
« Reply #185 on: April 01, 2021, 12:51:38 am »
Quote
I found instructions for installing 64 bit Arch on the Pi 3 from November 17 2018, about 2.4 years ago. The Pi 3 has been out for five years.
Whatever.  I thought the driving factor behind 64bits was support for more than 4G of address space, so I don't see a lot of motivation (or need) for porting a 64bit OS to hardware with 1GB of RAM...

In ARM and x86 land the 64 bit ISAs also have twice the number of registers -- and more than twice the *usable* registers as things such as PC and SP and FP and LR taker a fixed overhead out of the registers (and on arm64 the PC isn't in a general register at all)

Even when the current hardware has less than 4 GB, you may want to get a head start on writing software that will run on systems with more than 4 GB. Raspberry Pis are now available with 8 GB RAM -- and the supported OS is still 32 bit.

The A53 in the Pi 3 runs 64 bit code about 20% faster than 32 bit code.

There are a ton of reasons.

Yep, yep!
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26906
  • Country: nl
    • NCT Developments
Re: What µC are you preffering
« Reply #186 on: April 01, 2021, 09:25:52 am »
The A53 in the Pi 3 runs 64 bit code about 20% faster than 32 bit code.
This seems odd to me. It is likely that the instruction set in 64 bit mode is optimised better compared to an older 32 bit instruction set. Also keep in mind that on 64bit ARM an integer in C is still 32 bit!
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4036
  • Country: nz
Re: What µC are you preffering
« Reply #187 on: April 01, 2021, 08:47:06 pm »
The A53 in the Pi 3 runs 64 bit code about 20% faster than 32 bit code.
This seems odd to me. It is likely that the instruction set in 64 bit mode is optimised better compared to an older 32 bit instruction set. Also keep in mind that on 64bit ARM an integer in C is still 32 bit!

With the exception of PUSH and POP (or LDM/STM) with more than two registers, A64 programs tend to use fewer instructions than A32 or T32 programs. The code size between A32 and A64 is often not much different, with A32 smaller in function entry and exit code, but A64 smaller in loops (and so executing fewer instructions overall if the loops iterate a few times).

It's certainly possible that some 64 bit CPU core might implement 32 bit instructions less efficiently due to the pipeline being optimized for only what the 64 bit instruction set needs. For example it's very likely that PUSH/POP/LDM/STM might execute at 1 clock cycle per register (as in fact 32 bit cores do), while 64 bit LDP/STP run at 1 clock cycle per *pair *of registers. It's even possible a 64 bit core might take a clock cycle for every register, whether it is included in the mask or not, at least until the mask becomes 0. As A64 doesn't have/need predication, it's possible A32 predicated instructions and T32 IT* instructions might be executed in the pipeline as a conditional branch for every predicated instruction. I can't recall off-hand whether every A32 addressing mode is also present in A64. If not then some might be split into 2 uops on some 64 bit cores.

From the ARMv8-A manual:

"ARMv8-A deprecates some uses of the T32 IT instruction. All uses of IT that apply to instructions other than a single
subsequent 16-bit instruction from a restricted set are deprecated, as are explicit references to the PC within that
single 16-bit instruction. This permits the non-deprecated forms of IT and subsequent instructions to be treated as a
single 32-bit conditional instruction."

To me this suggests ARM intends the execution pipeline (on cores that support both 32 bit and 64 bit) to efficiently handle this restricted set of uses of IT, but other uses may be lower performance or even, after some time, not supported at all.

As far as I can tell, the A53 core executes 32 bit code as efficiently as possible (not worse than an A7, for example). But I think STP/LDP in function entry/exit code are faster than PUSH/POP (even if they are bigger code), and A64 executes fewer instructions in a number of other situations.


The size of a C integer depends on what OS / ABI / compiler you are using. It's true that most 64 bit systems have settled on an "LP64" model (Long and Pointer are 64 bits, Int remains 32) with fewer adopting ILP64 and Windows using LLP64 (Both int and long are 32 bits, you need to cast pointers ti use long long for pointer arithmetic).

There are also ILP32 environments on 64 bit instruction sets which allows you to make use of more registers and a more modern instruction set on x86 and ARM 64 bit without increasing memory usage of data structures containing pointers, if 4 GB is enough for a single program. The x32 ABI on Linux is an example. The arm64 processor in the Apple Watch is used with an ILP32 ABI also.

The hardware doesn't care.

As long as you use types such as size_t, ptrdiff_t, uintptr_t in your C code then the programmer also doesn't care whether a pointer needs to be cast to int, long, or long long.

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf