Linux x32 ABI Not Catching Wind
jones_supa writes "The x32 ABI for Linux allows the OS to take full advantage of an x86-64 CPU while using 32-bit pointers and thus avoiding the overhead of 64-bit pointers. Though the x32 ABI limits the program to a virtual address space of 4GB, it also decreases the memory footprint of the program and in some cases can allow it to run faster. The ABI has been talked about since 2011 and there's been mainline support since 2012. x32 support within other programs has also trickled in. Despite this, there still seems to be no widespread interest. x32 support landed in Ubuntu 13.04, but no software packages were released. In 2012 we also saw some x32 support out of Gentoo and some Debian x32 packages. Besides the kernel support, we also saw last year the support for the x32 Linux ABI land in Glibc 2.16 and GDB 7.5. The only Linux x32 ABI news Phoronix had to report on in 2013 was of Google wanting mainline LLVM x32 support and other LLVM project x32 patches. The GCC 4.8.0 release this year also improved the situation for x32. Some people don't see the ABI as being worthwhile when it still requires 64-bit processors and the performance benefits aren't very convincing for all workloads to make maintaining an extra ABI worthwhile. Would you find the x32 ABI useful?"
no
With memory being dirt cheap I ask: Who cares?
Knowledge is power. Knowledge shared is power lost.
No.
no. time will fairly quickly diminish the value as 64 bit cpus get faster.
If I wanted to divide my nice big memory space into 32-bit address spaces, I'd dig my totally bitchin' PAE-enabled Pentium Pro rig out of the basement, assuming the rats haven't eaten it...
There's your answer. If I'm writing a program that won't need over 2GB, the decision is obvious: target x86. How many developers even know about x32? Of those, how many need what it offers? That little fraction will be the number of users.
Gentoo isn't popular anymore. People don't feel the need to mess with compiler flags to try and squeeze 0.3% more performance out of the compiled program.
I do not see many cases where this would be useful. If we have a 64-bit processor and a 64-bit operating system then it seems the only benefit to running a 32-bit binary is it uses a slightly smaller amount of memory. Chances are that is a very small difference in memory used. Maybe the program loads a little faster, but is it a measurable, consistent amount? For most practical use case scenarios it does not look like this technology would be useful enough to justify compiling a new package. Now, if the process worked with 64-bit binaries and could automatically (and safely) decrease pointer size on 64-bit binaries then it might be worth while. But I'm not going to re-build an application just for smaller pointers.
Dumb idea, we went 64 bit for a reason.
It has value for embedded cost-sensitive systems, of which there are many.
If it came out a few years earlier, it would have been more prevalent.
The maintainer(s) find it interesting, and they're developing it on their own dime... so I don't get the hate in some of these first few posts. No one's forcing you to use it, or even to think about it when you're coding something else.
If it's useful to someone, that's all that matters.
#DeleteChrome
x32 at least has some merit, unlike your grasp of the history of computing. (Just not very much and probably not worth the trouble; you can probably relate.)
The company I work for compiles almost all programms with 32 bits on x86-64 CPUs. It's not only cheap RAM usage, it's also expensive cache which is wasted with 64 pointer and 64 bit int. Since 3 GB is much more than our programms are using, x86-64 would be foolish. I'm eager waiting for a x32 SuSE version.
I would not go that far since I'm sure a special case may exist, but that's exactly what it would be for. Hence the 'no massive wide scale adoption' or 'applications written for this' becomes an (what should be) obvious outcome.
If I'm custom Joe and see a workload that benefits from 32 vs. 64bit OS constraints I load a 32bit OS. The reason we went to larger memory however means those special cases are extremely rare today. They happen more because "we can't get new hardware" than by choice.
-The wise argue that there are few absolutes, the fool argues that there are no probabilities.
The idea makes sense in theory. Build binaries that are going to be smaller (32-bit binaries have smaller pointers compared with 64-bit) and faster (because the code is smaller, in theory cache should be used more efficiently and accesses to external memory should be reduced).
But I suspect the problem is that the benefits simply outweigh the inconvenience of having to run with an entirely separate ABI. I doubt the average significant C program spends a lot of time doing direct addressing, and as such I suspect the size benefits of using 32-bit pointers is overstated.
Seriously and no humor. I'm extremely excited about x32. I've been eagerly awaiting an install I can just "plonk" in and run with both for debian and "hopefully" one day NetBSD and OpenBSD where memory constrained devices are oft present and speed is always appreciated.
No.. seriously. Get the distro rolling guys. I'm excited and know several others that are moderately interested in giving it a go. :)
*hugs* .. Appreciate your efforts!
It depends on the delta. There are still many 32bit problems out there, and there are plenty of cases where having extra performance helps. If you have enough of the right size problems you could even reduce the number of systems that you would need.
It looks like it could allow packing a single system tighter with less wasted resources.
Reducing the footprint of individual programs could also have some benefits from system performance / management, especially in tight resource situations.
One minor drawback is that you would need to structure your user execution and runtime environment to account for the additional executable format.
Pulling some of the architectural advantages of the 64bit architecture (number of registers, etc.) into 32bit land should be gravy. A lot of that will depend on exactly how they behave in 32bit mode.
much of left-wing thought is a kind of playing with fire by people who don't even know that fire is hot - George Orwell
Absolutely the stupidest idea in the history of computing. Utterly worthless.
No, Linux x32 ABI breaking wind is the stupidest idea in the history of computing.
debootstrap --arch=x32 unstable /path/to/chroot http://ftp.debian-ports.org/debian/
Requires an amd64 kernel compiled with CONFIG_X86_X32=y (every x32-capable kernel can also run 64 bit stuff).
The creatures outside looked from Alt-Right to Antifa; but already it was impossible to say which was which.
This could have a home on smart phones. A smaller memory footprint is *key* on smartphone apps.
I thought "embedded cost-sensitive systems" would be using ARM CPUs, not Intel or AMD x86-64 CPUs with 32-bit pointers.
There's plenty of applications around still without a 64 bit binary. From what I understand this layer just allows 32 bit programs to utilize some performance enhancing features of 64 bit architecture. It seems a genuinely good idea.
- Having smaller data structures is much better for the small 64-byte cache lines of modern CPUs.
- And sometimes it seems really a waste to use 8 bytes to do some addressing.. And you can't always use offsets, and then you'd still need a base pointer. I'm coding a behavior tree with continuations and function pointers, and those pointers take much space in the behavior tree stream and the evaluation stacks...
See Andrei Alexandrescu's (Facebook NYC talk on C++ performance) talk about performance and specifically using 32-bit data in 64-bit compiled C++.
regards,
x32 would have been nice as the first transition away from x86-32, but memory needs keep increasing, and we are far too used to full 64-bit spaces. In fact, it feels like we're finally over with the 32-64 bit transition, and people no longer worry about different kinds of x86 when buying new hardware. So introducing this alternative is a needless complication. As others have pointed out, it's too special a niche to warrant its own ABI.
Escher was the first MC and Giger invented the HR department.
you just have to realize, that left to their own devices, most people do really stupid shit for no good reason.
it's just the way linux is, kinda like forcing the greatest democracy in the world to be run by a bunch of immigrants in the U.S.
if you don't appreciate the joke the universe is playing on you, you are probably very befuddled by the whole thing.
My dad drives a Ford and your dad drives a Chevy. Your dad sucks.
Didn't we do this already? Like when we were twelve years old.
General question about x32 ABI: is the OS still can use more than 4GB RAM w/o penalties? IOW, is kernel still 64bit? Only userspace is x32? Or x32 and pure 64-bit can run alongside?
Anyway. Most performance-sensitive programs went 64-bit anyway - since RAM is cheap and there are bunch of faster but memory-hogging algorithms.
All hope abandon ye who enter here.
Wouldn't this require all common shared libraries (glib, mpi, etc.) to be recompiled for both x86-64 and x32? What am I missing here?
ABI = Application Brogramming Interface?
we went 64 bit for a reason.
We went to x86-64 for three reasons: 64-bit integer registers, more integer registers, and 64-bit pointers. Some applications need only the first two of these three, which is why x32 is supposed to exist.
Utterly pointless. Just use either i686 or x86_64. Not a shitty design that combines the disadvantages of both and is in no way better.
I could get into specifics but I shan't, because what you're blathering about has zero relevance for x32. It's not a replacement-to-be for the usual amd64 ABI, nobody is going to break amd64 to make x32 run. It's mostly a specialist tool for specific workloads (aside from being a hacker's playground, as are many things). Whether thinking it's useful as such is misguided or not, you're more so.
You've just misunderstood it. It is in essence a performance enhancement, and you would benefit from it simply from selecting x32 target (instead of x86-64) when compiling.
Signature intentionally left blank.
It's like the title to a cheesy novel.
It's no big surprise that takeup is low when developers are forced to make a conscious choice between x32 ABI and full 64-bit operation for their entire program. It's the wrong approach.
A far better approach would have been to enhance the 64-bit ABI to allow 32-bit pointers to be used wherever the compiler can guarantee that pointer operations will remain within the 32-bit range. There is no shortage of such situations even in pointer-flexible C, and it's even easier to find such small-range use in more tightly constrained languages. It's even possible to start off a pointer as x32 and then promote it to 64-bit on casts or wherever it is no longer possible to track where it's pointing --- that would make 32-bit pointers usable part of the time in almost all programs.
Done that way, there would be no complaints of lack of x32 adoption. Everyone would be using it and benefiting from it to the greatest extent possible in their programs, without losing access to the full 64-bit space.
The either-or choice of 32-bit or 64-bit ABIs was a mistake.
Think Atom processors running Android, or High-performance computing applications. Neither of these require a huge external ecosystem, but if you get a 30-40% boost in some workload, they are worth it. It's my understanding that small-cache Atoms benefit from this more than huge Xeons.
And I don't want another set of libraries in my system in addition to 64 bit and 32 bit emulation.
"Disadvantage" of x86 in x32 - size of code and data reduced to ~75% of x86_64 version due to narrower pointers
"Disadvantage" of x64 in x32 - extra 16 registers meaning less shuffling for temp vars between memory and CPU.
Are you sure you know what "disadvantage" means?
Eventually, I assume that all binaries which don't need 64-bit addressing (which will probably always be more than 90% of them) will switch to this ABI since having access to the extended register set without the overhead of all the bus bandwidth and cache space lost to store lots of zeroes is a HUGE win with zero cost.
Uh, no.
Really, no.
It's just not going to happen.
90+% of applications are not CPU-intensive, so they don't give a crap. 90% of the other applications that are CPU-intensive would benefit far more from removing pointer accesses than from making the pointers half the size. Only the remaining 1% are going to go through the hassle of dicking around with a complete second set of libraries on their system just so they can halve the size of their pointers.
There's simply no benefit at all from compiling the vast majority of desktop x86 applications in anything other than x86-64. Which is why no sane x86 distro is even going to consider using this kludge.
This sure feels a lot like a throwback to the old 16-bit DOS days, where you had small/medium/large memory models depending on the size of your code and data address spaces. We've already got 32-bit mode for supporting pure 32-bit apps and 64-bit mode for pure 64-bit; supporting yet a third ABI is just going to result in more bloat as all the runtime libraries need to be duplicated for yet another combination of code/data pointer size.
I hate to say this since I'm sure a lot of smart people put significant effort into this, but it seems like a solution in search of a problem. RAM is cheap, and the performance advantage of using 32-bit pointers is typically small.
I understand it is the same beast as the COMPAT_NETBSD32 option that has been available in NetBSD for 15 years now. It works amazingly well: one can throw a 64 bit kernel on a 32 bit userland and it just works, except for a few binaries that rely on ioctl(2) on some special device to cooperate with the kernel.
NetBSD even had a COMPAT_LINUX32 option for 7 years, which enables running a 32 bit Linux binary on a 64 bit NetBSD kernel. Of course the Linux ABI is a fast moving target, and one often misses the latest system call that a given Linux binary requires, but it is funny to see that Linux feature was supported on non Linux OS first.
This.
With a slight caveat that in that last one percent is probably the use case of DOM inside a browser page looks sufficiently like an irreducible thicket of tiny objects, and still wants all the speed that it can get, which is why Google is pushing x32 for Chrome plugins. Maybe it helps a bit for Javascript compilation too.
At least if your x32 is (a) sandboxed in a browser process and (b) generated by a JIT then the library duplication badness should be negligible and the result mostly invisible to the user.
For my own code, I wouldn't touch it with a bargepole. Storing pointers in memory? Madness...
-- Andrew
I will do anything for speed in my code. I am not impressed with the current generation's coding abilities or lack of appreciation for what careful design and hand optimization will do. There's too much "Oh, the hardware's plenty fast now" and "Why worry about memory? Mallocs never fail nowadays," and we've got slow bloatware bullshit everywhere as a result.
Dynamically generated jump tables full of function pointers written in C must give you nightmares :D
While it's possible to have a system with 16GB that could use only x32 (the kernel is still x86_64 under x32, so the kernel can see the 16GB), for instance running thousands of tasks using up to 4GB each just fine, plus the page cache is a kernel thing, so the I/O cache can always use all memory.
On the other hand, there are workloads that run on a 4GB system but that need x86_64 (mmaping of huge files for instance), and so boneheaded tasks reserve tons of never used RAM, it could actually use 1GB of RAM but reserve 8GB, the issue there really should be putting the coder in jail, but I digress.
But the vast majority of linux workloads today that use even a 8GB system would run just fine under x32. Like 95-98%.
And nobody is even suggesting a mainstream linux distro without x86_64 userland. I'm sugesting all standard tools using x32, but keeping the x86_64 shared libraries and compilers, so if you need you could use some apps with full 64bit capability. Just use x32 by default.
Plus it's a good way to remind lazy developers that no matter how cheap RAM is, you should be serious about being efficient (specially to the KDE developers) !
KDE functionality is great, but they really have no clue about efficiency (RAM and CPU).
i686 means slow-ass reduced register space and less optimizations (I highly doubt the latest Intel or AMD stuff gets optimized for i686 code anymore). x32 is designed for people who don't need >4GB but do need more cache locality.
So for me the answer is no. The whole thing reminds me of doing ARM assembler with thumb code mixed in. If you have a very specific usage for it then yes, it would certianly be useful - but it's going to be up to the people who need it to actually use and improve it. Everyone else has no need to care and the average developer shouldn't *need* to care or even be aware of it.
I can recompile and run 20 year old SunOS apps no problem with OpenSolaris. Try that with Linux?
Depends on what it's looking for, but in theory should work. 20 years? CLI or GUI based? Probably wants TCL/TK and/or Motiff if it's GUI, make sure they're installed. I'm willing to try, if you have source code that old...
Hairyfeet mentioned he tried linux and people kept calling back angry that their printer stopped working after an Ubuntu update.
I did not even know it existed? I will keep Linux on a VM I suppose but only CentOS as Redhat likes to make somewhat ABIs that do not break after each freaking update!
If you need stability then you should go with a stable OS. Fedora, OpenSuSE, and Ubuntu change too fast for enterprise use - which is what makes RHEL great.
With that said, I don't seem to have issues running some older software I have laying around for Linux. Oracle Database 8 installed on RHEL 5 when I tried it last, old version of Code Forge IDE ran in new Fedora Linux (think I installed it last on FC 16, designed for Red Hat Linux 5.x/6.x (old Red Hat, not RHEL). Similar results with Matlab. The software isn't broken by kernel changes - the libraries needed do change (static linked vs dynamic linked, makes a big difference in how long your software lasts) (stuff looking for a particular glib or libc seem to be the biggest offenders in Linux, from what I've seen). Windows has seen some issues with that over the years (dropping DOS libraries, dropping Win 16 from 64 bit Windows, etc).
Most UNIX operating systems do seem to maintain greater compatibility in userland, but I've issues on IRIX with stuff built for 5.x not working on my systems (Octanes running 6.5.x) - but it's the same deal - dynamically linked programs not being able to find their libraries.
I'm starting to think GNU is the problem with "GNU/Linux" these days.
Ulrich Drepper has some x32 benchmarks on his blog. The biggest difference is for the cacheline benchmark where x32 is the same speed as x86_32 but x86_64 is 75% of the speed.
In all the other benchmarks the difference is much smaller and there are some surprising results such as x32 being slower than x86_32 (nbench (FOURIER)) and slower by a large amount compared to x86_64 (PARSEC blackscholes SIMD)...
Binary packages such as vendor gfx drivers or Java are not available fir this arch. Why cast yourself onto a lost island?
Running 20 year old Linux binaries is certainly possible too - I think one or two of the kernel devs do it from time to time but it requires a kernel option that's not always enabled and old versions of libraries.
Desktops aren't the intended audience for x32. This stuff is for very specific scientific compute jobs that are pointer intensive (i.e., graphs etc). You won't see GNOME/KDE/whatever packages for this architecture.
The popularity of this arch won't manifest itself in general purpose software packages: most computation will be in one-off custom programs that are never released. That doesn't mean this architecture isn't popular, it just means you're using the wrong metric.
Odd ISA/ABI's are never ever really going to catch on. They just don't adhere to what people expect. /dev/null.
Xtensas ISA beeing just such an example. 3-byte ops. Smaller codesize, just enough room for all instruction ops in the RISC ISA.
The x32 is of the same sort, compromising flexibility for footprint (speed beeing an added bonus).
Most people will never care enough, just marginalizing the effort into
Won't this require a 2nd copy of the shared libraries in memory, which will negate the benefit of a slightly smaller binary?
It would be nice thing to have, very similar to Sparc Solaris with 64 bit kernel and most of userland 32 bit.
The things that require 64bit binaries are things that deserve their own virtual machines (Lucene's MMapDictionaries, PostgreSQL databases or memcached instances)
Unfortunately I would need well maintained environment, near the level of Ubuntu LTS or Debian, I suppose it is not going to happen.
AMD should have just dropped x87 from 64-bit mode and used the opcodes for something better.
how does "mandatory SSE2" play into open source where the compiler can detect SSE2 and compile for it?
Apart from Gentoo and FreeBSD users that use a "ports" style system, I guess it's more common to install binary packages from the distribution's repository than to compile source packages. Besides, not all applications can even be open source, especially games and video-on-demand players.
x86 was the stupidest idea in the history of computing. Intel made the 8086 ugly and confusing because they wanted to sell the iAPX 432. We're still paying for their decision.
You have obviously never worked with python code. There are distributions which include a significant number of tools written in python, and data structures in python consists mostly of pointers. There is significant benefit to be made from a python interpreter compiled for x32.
If x32 would be compatible with libraries compiled for either x86 or amd64, then we could do with only two sets of libraries and not three of them. I don't know if x32 is compatible with either. But I think it was properly designed from the start, then it would be.
With the proper 32 bit kernel you can address up to 64 MB of address space.
For those interested in x32, I wrote an article for Linux Weekly News last May. x32 ABI support by distributions may have some information on x32 you might not have been aware of.
In short, I found it easy to use the experimental x32 architecture for Debian, and there are certain scientific apps out there that might get significant benefit from it. Web application accelerators like Varnish might also have something to gain by using x32.
"For the Snark was a Boojum, you see." -From the Hunting of the Snark: An Agony in Eight Fits, by Lewis Carroll