News for hackers. Stuff that matters.
Re:X32 ABI by slacka on Wednesday October 09, 2013 @10:12PM (#6525284)
With a potential 32% boost in integer performance, I've been exited to try out X32 for years now. I was hoping this post meant I could finally use it. After re-reading the Wikipedia article, I was left wondering can my Ubuntu 12.04.3 run it? Where can I get the X32 software? According to Phoronix, no tier-one Linux distribution is shipping any official x32 images yet.[1]

With all the talk of 64bit CPU on the new iPhone 5s with only 1GB of RAM. I wonder if it will be subject to the 64bit memory address penalty, or if iOS is using something similar to X32?

[1] http://www.phoronix.com/scan.php?page=news_item&px=MTM1OTA

Re:X32 ABI by hdevalence on Wednesday October 09, 2013 @10:25PM (#6525327)
Note that the boost is only as dramatic for programs that make very heavy use of pointers. For instance, the benchmark that gets a 32% boost [1] requires "about 100 or 190 MB" of memory on 32/64 bit, respectively. If we call the memory used for pointers A and the memory for other data B, then this means that

    A + B = 100
    2A + B = 190
    => A = 90, B = 10
So if 90% of your memory usage is pointers, this is great. But I don't think that this is a typical workload. Otherwise, the performance advantage is not as clear.

Wikipedia notes that "On average x32 is 5–8% faster on the SPEC CPU integer benchmarks compared to x86-64 but it can as likely be much slower. There is no speed advantage over x86-64 in the SPEC CPU floating point benchmarks."

Perhaps the reason that no tier-one Linux distro ships with x32 images is that the additional complexity of supporting an additional ABI is not seen to be worth the modest performance increases.

[1]: http://www.spec.org/cpu2000/CINT2000/181.mcf/docs/181.mcf.ht...

Re:X32 ABI by aaronbee on Wednesday October 09, 2013 @10:44PM (#6525377)
Another relevant benchmark is x32 vs. x86. In a memory constrained environment you may be forced to use x86. x32 gives you the ability to get the performance benefits of x86-64 (possibly plus some) while staying in your memory constraints.
Re:X32 ABI by frozenport on Wednesday October 09, 2013 @10:28PM (#6525333)
30% performance boost in Java, which we know is lies built on pointers. Also maybe Scala.
Re:X32 ABI by sanxiyn on Wednesday October 09, 2013 @11:15PM (#6525454)
This is not true. Since this optimization helps Java so much, it is already implemented in HotSpot itself without changing ABI.

https://wiki.openjdk.java.net/display/HotSpot/CompressedOops

Re:X32 ABI by frozenport on Thursday October 10, 2013 @02:34AM (#6526027)
Does this break vectorization? Specifically, saxpy (Y=M*X+B) requires extra operations to dereference every element and won't let you insert an FMA instruction.
Re:X32 ABI by conradev on Wednesday October 09, 2013 @10:21PM (#6525314)
ARM64 has 64 bit pointers, so even though only 33 bits of those are being used for addressing memory, iOS still suffers the increased memory penalty[1].

[1] http://www.mikeash.com/pyblog/friday-qa-2013-09-27-arm64-and...

Re:X32 ABI by hdevalence on Wednesday October 09, 2013 @10:28PM (#6525336)
On the other hand, it's not like the bits of the pointer which are not used for addressing memory are necessarily wasted.

You can use them as tagged pointers [1], and I think that Apple's Obj-C runtime actually does this. (I don't know for sure, as it's not really something I'm interested in, but I think I saw an article about it. I could be wrong.)

[1]: https://en.wikipedia.org/wiki/Tagged_pointer

Re:X32 ABI by conradev on Wednesday October 09, 2013 @10:52PM (#6525399)
Yes, those bits are put to very good use! In ARM64, some bits are actually used to store the reference count for the object, making -retain/-release calls super fast.
Re:X32 ABI by asveikau on Wednesday October 09, 2013 @11:26PM (#6525486)
Any details on that posted somewhere?

The wackiest thing about that is... if there are multiple pointers to an object (kind of the point of reference counting) and the reference count is part of the pointer... well... I don't really see that working well at all. OTOH I could see there being some optimization that means some callers might not need to modify the global reference count, only the one in their reference.

Re:X32 ABI by twoodfin on Wednesday October 09, 2013 @11:31PM (#6525497)
If I'm not mistaken, those extra bits are pulled from the "isa" pointer, present in all objects and similar to a C++ vtable pointer. That is, they're in the object itself, not the pointers to it.

Mike Ash wrote an excellent summary:

http://www.mikeash.com/pyblog/friday-qa-2013-09-27-arm64-and...

Re:X32 ABI by asveikau on Wednesday October 09, 2013 @11:32PM (#6525501)
OK that makes a lot more sense. Thanks.
Re:X32 ABI by jevinskie on Thursday October 10, 2013 @02:23AM (#6525992)
There is nothing preventing you from using a 32-bit pointer ABI with AArch64.