-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GNUmakefile fails to properly accommodate for AVX512f #753
Comments
|
Another alternative would be when you discover |
|
Thanks @mouse07410. This looks like it could be a Clang issue. I'm still having trouble understanding why you need more than Other projects are experiencing it:
It looks like the other projects switch to GCC and avoid the problem with Clang. Looking at LLVM bug tracker it does not look like the issue has been reported: Can you reduce the problem to a simple reproducer and report it to the LLVM folks? They may have some recommendations. (The other projects I looked at lack a reproducer, too). A reproducer would be especially helpful because we can add it to our I think we have to be careful about |
|
This is not exactly Clang issue because native clang compile‘s fine on that platform. the issue is when Macports needs to involve integrated assembler from native clang |
OK, thanks. I believe that makes it a GCC issue. Related, I wonder why the other projects had the issue when compiling with Clang, but not GCC. In the other bug reports GCC was the fix (and not the problem). What do you see when you examine the And then: Finally, check around line 11397. You should see a |
|
According to the Intel Intrinsics Guide, Is it possible you are missing one of your manual flags? Looking at GCC's x86 Options there is a |
I think not. Especially since it all compiles (and runs!) nicely under the native Clang toolchain (with the same flags, of course). And contrary to what the Guide might say, it works on my machine without
Different platforms, different compilers, different flags -> different causes for an issue that might look somewhat similar. Like in medicine - you wouldn't believe how many possible causes a simple headache can have. ;-)
I don't buy this logic. The place I'm proposing to add this is here: It is infeasible to impossible that a distro builder would build on MacOS using Macports-based GCC calling integrated assembler, but would need something different. This is a very localized problem, and a very localized fix. On the other hand, if you see any fault in my logic - here's the time and place to present it. ;-) |
|
When I go to the Intrinsic Guide it says Now, turning back to your issue, you are using I think we need to get the LLVM folks a reproducer so they can clear this before other folks experience it. |
|
A quick test on my old MacBook without AVX2: And then: So this is a good sign. I can duplicate the issue even though I can't test the hardware caps. |
No, the Integrated Assembler rejects it only when it was not given the
I don't think you duplicated my issue - because in your case the appropriate flag was passed to the Integrated Assembler. I wonder what version of Clang/Xcode you have on that old MacBook. When I use Xcode-10.1, then it works correctly on the latest hardware with AVX512f, on the fairly modern hardware with AVX2 and SHANI but no AVX512, and on the older MacBook Air with only AVX2. Here are the machines (all run-ing Mojave or High Sierra, all using Xcode-10.1 and Macports GCC8 (output of I'd like you try the following with GNUmakefile that includes Because I suspect that provided CXXFLAGS should match the CPU the build is running on (and if it doesn't - that's what P.S. Note, that with Macports Clang the problem doesn't manifest itself - only with Macports GCC. |
OK, now open in the LLVM bug tracker: Issue 39875, Error: instruction requires: AVX-512 ISA when using -mavx512f. It looks like the is a LLVM bug. I guess we need to ping MacPorts next and ask them to pick up the patch. |
The issue was cleared in Clang 7.0: Can you update to Clang 7.0 through Macports or use our Clang 7.0 build script? If not, I think the way to go here is dynamically test for the need to add the extra options. Fortunately we have that now, so there's no need to shell out for Clang version numbers. I'll upload the test program for you. |
|
My Macports Clang had been 7.0 for quite a while. The problem is - Macports Clang has other issues, for example it fails to compile Botan with Boost... So it cannot replace the Xcode Clang as the default compiler for the platform. |
|
A quick status.. I can compile the library with GCC 5/6/7 using MacPorts GCC. However, I need Clang 7.0 when using your
Oh man, my gear is old. The Macbook is a Core2 Duo from 2011 or 2012 running 10.8.5. When I attempt to duplicate your environment and issues I use MacPorts:
Well, there's several bug reports from the We could not simply drop Finding the appropriate option and activating an ISA hit its limits on ARM, Aarch64 and PowerPC so we recently switched to the dynamic feature detection cut-in last week. In reality it hit the limit a long time ago. And it was also broke for x86_64 on distros like OpenBSD and old distros like Fedora 15 but you probably missed it. |
|
Now that we have a reproducer, an upstream bug report, the cause and a fix, I think you should file a bug report in Apple's RADAR. Apple needs to be informed of things that need to be fixed. If you have the time, open another report at Open RADAR. Open RADAR tries to make Apple bugs transparent. You just copy/paste the details from RADAR to Open RADAR. |
I'm pretty sure that you could bring the OS up to probably 10.12, if not 10.13 - and correspondingly, Xcode to at least 9.4.1, if not 10.1. Unfortunately, your workaround fixes one thing but breaks another - it makes it impossible to compile Botan with Boost:
So, on one hand, some features on the native computer are not detected/treated properly. On the other hand, some people want to build Crypto++ on one computer, and then deploy it to other that may have different CPU features (I fail to see how improving detection on the build machine is going to help them). IMHO, the solution is - to allow the builder (not the makefile) to explicitly set what CPU features exactly to compile in. I should be able to compile for AVX2 on an older box, if I choose so. Similarly, I should be able to compile without AVX2 on the latest box, if my target environment is old. |
Well, I'm not sure what is happening with Botan or Boost. Botan seems to build OK with the following and pass its self tests: The problems you seem to be having are with Boost. You should file a bug report with Boost to get it fixed. I don't mind trying to play well with other libraries, but keep in mind that neither library is our responsibility. But I also fail to see how we are not playing well with others. The best I can tell we are in our own sandbox and there's no one to play with.
Yeah, that was 5.6.x and earlier. At 6.0 we changed to BASE+SIMD and In fact I recommend using
Yes, absolutely. You have complete control over If you want AVX2 on a machine with a compiler that supports it, then you don't have to do anything. Or, you can manually add You don't seem to have any problems exercising |
I'm having trouble getting Macports GCC (which is the only usable GCC on MacOS, because Xcode GCC isn't worth much) to pass the architecture/CPU flags to the native (Xcode) Integrated Assembler. My solution is adding architecture-specific flags to Macports GCC invocation if detected. I think that since it's properly guarded (aka done only for Apple MacOS Macports GCC), it won't affect those who complained about, e.g., I would also prefer to revert to my prior way of dealing with the flags, when for each discovered feature, the appropriate
The problem is, as I said above, that between Macports GCC and Integrated Assembler, something gets lost, so it has to be accompanied by |
Yeah, I have never quite understood this. Maybe its an Apple Clang thing. I don't know how to write a for-each in GNUmake to convert each
This is what I don't really understand. There's a buggy toolchain out there that only you use. You literally add 17 compiler options but you are moaning about adding number 18. I reduced it to a minimal test case for you, I filed the LLVM bug report for you, I checked-in the test program for you. If you want it then you need to finish it. You need to write the feature test and add the option if necessary. Otherwise, file a bug report with Apple and wait for them to push a fix to their devs. |
I wouldn't call Macports GCC or Xcode Clang something "that only I use". Though I admit that it's rare when one needs to compile something with the modern GCC (therefore Macports instead of Xcode), but that compiled package contains assembly code that requires using Integrated Assembler from Xcode (because GAS hasn't been maintained for more than a decade). Yes, there's something wrong with how the two toolchains interact. However, it is easy for each of them to point finger at the other one (probably harder for Macports GCC, but still, unless I can demonstrate that it's GCC that doesn't pass something, rather than Clang not receiving something passed to it, I've no evidence to fix the blame to one of the two).
The problem is - my "17 compiler options" work on all of my compilers, from Xcode and Macports. To address this issue by adding 18th option, I'd break all the other compilers to save Macports GCC build of Crypto++ (because Macports GCC is the only compiler that needs the extra option
That's not a bad idea. P.S. Assembly does get tricky - FYI: newhopecrypto/newhope#1 |
AVX512-anything implies AVX512F. F = foundation, and includes support for the EVEX encoding that all AVX512 instructions use. VL = Vector Length - 128 and 256-bit versions of any other AVX512 instruction (using an EVEX encoding, not AVX1/2 VEX, for instructions like Enabling AVX512VL implies enabling AVX512F. |
|
We'll revisit if a testing machine becomes available. |
MacOS 10.14.1 Mojave. Xcode-10.1. Current master.
Problem: no appropriate tests for AVX512 extended instruction set.
Symptoms:
Proposed solution: add
-mavx512fwhen appropriate, and for Macports GCC - add-Wa,-mavx512ftoo (somehow this is not picked by default). Like this:The text was updated successfully, but these errors were encountered: