Recent

Author Topic: Does FPC support x32 architecture?  (Read 7671 times)

abou.almontacir

  • New member
  • *
  • Posts: 7
Does FPC support x32 architecture?
« on: October 23, 2021, 08:02:01 pm »
Hi All,

On Debian there are 3 possible architectures for Intel based computers:
x86_64: 64 bits recent processors.
i386/i686: 32 bit processors
x32: a system with a 64 bits processor but with small memory that makes sens to use 64 bit registers for computation but not for addressing.
More information about x32 architecture can be found here.

My question is: does FPC support this kind of operating systems?

Thanks in advance.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Does FPC support x32 architecture?
« Reply #1 on: October 23, 2021, 10:06:05 pm »
I've not seen mention of that before despite being a Debian user, and in view of its reference to "Jessie" (released in 2015) would question whether it really is a live project.

I'd comment also that SPARC for a long time existed in an approximately comparable state (64-bit kernel but 32-bit userland) and that nobody was happy about it.

I'd also comment that UML existed in both 64- and 32-bit versions, and that (unless something has changed comparatively recently) it wasn't possible to have a 64-bit host and 32-bit guest.

All of which suggests that mixed models are not looked on favourably, I would speculate that the pitch was queered by x86.

But I still think it's a good question...

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Does FPC support x32 architecture?
« Reply #2 on: October 24, 2021, 02:09:21 am »
Coming as I do from a scientific computing background, where huge contracts where made or lost on very fine performance measures, that particular approach was never mentioned. Even on systems like BlueGene where compute nodes (hmm, power chips) run a heavily modified version of linux in a very memory constrained env.

So, I sort of suggest that maybe the benefits of this approach did not quite deliver ?

Davo

Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

abou.almontacir

  • New member
  • *
  • Posts: 7
Re: Does FPC support x32 architecture?
« Reply #3 on: October 24, 2021, 12:49:01 pm »
I think using 32 bits addressing on systems with less than 4GB memory while using 64 bits capabilities for the accelerating computation makes sens especially for some embedded applications where we will try to avoid using very big memories and for some low cost laptops.
The idea is that code will be smaller and maybe some memory operation will go faster. So it is not completely none sense.

I quote the link I posted:
X32 is an ABI for amd64/x86_64 CPUs using 32-bit integers, longs and pointers. The purpose is to combine the smaller memory and cache footprint from 32-bit data types with the larger register set of x86_64.

There are three principal use cases:


  • vserver hosting (memory bound)
  • netbooks/tablets (low memory, want performance)
  • scientific tasks (want every % of performance)
Compared to amd64, x32 offers significant memory savings, often on the order of 30%, and modest efficiency gains. The 64-bit registers can make computation more efficient. Since 8 additional registers available there is less pressure compared to i386/i686.

Compared to i386, speed increases are more pronounced, especially in code that's under register pressure or operates on 64-bit or floating-point variables. It also avoids i386's penalty for PIC code, where EBX is essentially reserved for the Global Offset Table (GOT).

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Does FPC support x32 architecture?
« Reply #4 on: October 24, 2021, 02:00:40 pm »
There are plenty of things which are excellent ideas, but don't make it into the kernel or major distreaux... or once there, fail to endure.

FatELF is one particular example, which failed because of a combination of technical and political issues in the (GNU-administered) toolchain and the Linux kernel... I forget most of the detail by now.

I note that x32 does have a Wp page, but I think the really crucial thing is the posting (and subsequent discussion) at https://lkml.org/lkml/2018/12/10/1145 . Via a comment from the maintainer (JPAG, who ISTR is another HPC buff) I see https://popcon.debian.org/stat/sub-x32.png which suggests that x32 currently has fewer than 1,000 users... scaling that by the overall popularity of FPC in the wider Linux context I'd speculate that only one pascal user is interested :-)

As I've said though: it's an interesting question. I wonder whether there are any other architectures which similarly provide a split word/address size ** , and whether you would be able to make a good case to the FPC core developers for its being to the advantage of the project if they were supported?

** Leaving aside IBM "big iron", where all discussions of support got bogged down in the merits of EBCDIC over ASCII, or in modern development tools' deficiencies when asked to do something simple like providing a cross-reference listing.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Does FPC support x32 architecture?
« Reply #5 on: October 24, 2021, 03:08:59 pm »
My question is: does FPC support this kind of operating systems?

Afaik no. It was discussed, and by then it was already clear that take up was not large, and more and more new Linux distros already did x86_64 by default. If distros had advocated x32 more, it would have been different.

Of course if anybody had willing to do the work that would be different, but the primary candidate, Florian,  was IIRC not interested.


FPK

  • Full Member
  • ***
  • Posts: 118
Re: Does FPC support x32 architecture?
« Reply #6 on: October 24, 2021, 06:11:23 pm »
Of course if anybody had willing to do the work that would be different, but the primary candidate, Florian,  was IIRC not interested.

I have a few patches for it lying around (far from working) but as x32 never gained really popularity, I never continued to work on it.

abou.almontacir

  • New member
  • *
  • Posts: 7
Re: Does FPC support x32 architecture?
« Reply #7 on: October 25, 2021, 09:25:25 am »
Quote
I have a few patches for it lying around (far from working) but as x32 never gained really popularity, I never continued to work on it.
Can these patches be put in a git branch? Then maybe someone can take it and try to make things working.

FPK

  • Full Member
  • ***
  • Posts: 118
Re: Does FPC support x32 architecture?
« Reply #8 on: October 25, 2021, 09:09:53 pm »
Can these patches be put in a git branch? Then maybe someone can take it and try to make things working.

https://gitlab.com/freepascal.org/fpc/source/-/commits/x32

But be aware: far from usable and based on really old sources, so I doubt it is of much use ...

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Does FPC support x32 architecture?
« Reply #9 on: October 25, 2021, 09:41:10 pm »
But be aware: far from usable and based on really old sources, so I doubt it is of much use ...

Judging by the date that was the rather massive 2.7.1 development venison?

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018