-
Notifications
You must be signed in to change notification settings - Fork 986
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
Pivoting on target-cpu/arch #847
Comments
I have no previous experience managing those alternative architectures, but, why they are not just additional I'm not sure either about the Any community feedback would be great. |
If there is no conditional logic based on arch, and we only support the
extra instructions in 64-bit mode, then 'arch' would be fine. But do we
want to exclude 32-bit pointer-sized code optimized for these platforms?
|
These instructions sets are actually available for both x86 and x86_64 architectures. I think I'm bumping up against this pretty hard with libjpeg-turbo. It's 2-3x faster when compiled for haswell vs baseline x86_64, but recompiling from source pushes Travis over the edge and hits the 45-minute timeout. |
I would like to push this for the 0.29, some other user has required the same thing and it's time to establish a convention to follow. Initially only the base settings, later we can think about the build helpers to inject some needed flag and some detection of the CPU microarchitecture (https://pypi.python.org/pypi/cpuid @fpelliccioni) to warn if a bad setting is detected. So @memsharded, lets work on it.
I don't like to repeat the microarchitectures, but I don't see a better approach. |
I'd also suggest that we may want to support 'native', i.e, whichever features are supported on the build machine. This value would need to disable build caching, though - all packages would need to be built from source. Also, we may want to consider matching the gcc/llvm names as closely as possible. For GCC < 5 we'll have to map a few anyway, though. |
Generations are also not very specific, and may not work on mobile or low-end editions. I started with I'm not sure there's much value in including |
For LLVM:
I forget how to list the values for GCC. |
For arm we are shipping a couple of different architectures right now:
I think it makes sense for the armv7 platform to contain: On some platforms we also need to set the the specific FPU like this: |
I was thinking about it, here I leave some of my conclusions: A. Relying on micro-architecture is a breakthrough, but ... what if I do
B. Some Intel micro-architectures have the same extensions as others. For I think, in both cases, what really matters is what sets of instructions For example:
In this way, the micro-architecture no longer matters, but what really I think Conan packages can have a setting to determine which extensions
extensions have to be assigned after the binary was compiled, I imagine,
On the client side, when Conan looks for a package, it can identify which I have a demo of the tool that analyzes the executables, if the idea is of |
My questions would be (a) how do we map these to, say, MSVC that only supports AVX and AVX2, and infers other instruction support based on those? (b) is set math cost-prohibitive for conan? (c) does the implementation cost of full instruction support outweigh the benefit? I would see nehalem/sandybridge/haswell/skylake/native as quite a bit simpler to implement and test. Permutations make things harder. (d) don't we still have to specify either an instruction group or processor generation when publishing pre-compiled binaries for other's use? |
@fpelliccioni The tool you describe is exactly what I've been looking for to validate my binaries. With so many compilers involved in a build it can be very difficult to ensure that an unsupported instruction didn't sneak in somewhere. |
Some comments: @fpelliccioni About:
Yes, but if you know that your library is built exactly for those different microarchitectures, you can control it in the About the instructions set, I understand it's what really matters but yeah, as you can support many of them it makes unmaintainable and crazy for the user. The combination is quite infinite. So it looks it couldn't be a setting. About detecting the setting after building the library is kind of chicken-egg problem, now it's working like: you declare the settings => conan builds the library and calculating a package ID. You are proposing the opposite, the settings are determined by the built library. It affects to the core model of conan, and it's not possible to do it, in my opinion. |
Detection is not possible when cross-compiling either. |
Hi all, Given the previous experience modeling the standard of the language (still WIP), I have some observations, the main question is: Should we model this with options?
|
I vote to strike 'native' from this feature request. It's orthogonal. I would suggest that whichever method is selected, that it is inherited by the tree, such that sub-dependencies are built with the same ISA by default |
Yes, exactly that. The only things that affect a package ID are the settings, the options and the requirements of the package. |
I've been reading, re-reading, and triple-re-reading this thread. I tried looking at the referenced PR (#2042) but only understood a little of it. As always, so much more complex than I initially imagined it would be. I think we all agree that the theoretical best solution is to make Conan aware of specific instruction sets. However, @lasote might be right when he said
But the other solutions are not ideal either. I would push for removal of the 1.1 milestone target and leave it blank. With no promise of a deadline, we can then all work together to come up with some kind of a solution (even if it's a major breaking API and doesn't come out until Conan v2 or v3) that minimizes the burden on the 90% of users that don't care but allows the 10% of us that do care very much to specify exactly which instruction sets should be enabled. The C/C++ world still does not have a top-notch package manager solution, and I don't think any solution which fails to properly tackle this specific problem will ever gain the kind of popularity that Maven, NPM, and Pip have gathered. So, before Conan tries to take over the world, I think it should solve this problem in the absolute best possible way. Solving this problem won't be easy. I think it will require that Conan is capable of mapping instruction sets to compiler flags. This will take a lot of research to provide by default a useful portion of this mapping for as many different compilers and instruction sets as possible. The mapping will also need to be user-extendable, just like the rest of I think the burden on the end-user could be eased by providing optional "families", such as It may be worth adding a boolean to the profile that says "I will accept binaries that are compatible with my CPU but do not fully utilize all of its features," or "I want to recompile any package that does not fully utilize my CPU." This would also require having a list of conflicting instruction sets or families (to prevent trying to cross-link 32- and 64-bit binaries). |
Having something like |
Yeah, I think supporting the various CPU architectures out there is absolutely necessary for Conan to adequately cover binary compatibility. It seems like there should be sub-settings to cover the intricacies of specific architectures, like the FPU for |
I also needed to add things to my arm-none-eabi-gcc:
version: ["8.3"]
cpu: ["cortex-m7"]
fpu: ["fpv5-sp-d16"]
float-abi: ["soft", "softfp", "hard"] I don't really know if I would like it if there was a more comprehensive solution for handling of the floating point here on arm, as I need to be diligent to ensure that I set the settings in accordance with the compiler flags. As you can see, I have been careful to name the settings exactly as the compiler flags to avoid problems and simplify my profile file. In general, it seems like every capability or option on a CPU should probably have its own Conan setting if this is to be managed. |
@vadixidav That looks a lot like what I've been thinking, though I've been leaning towards putting it under A rough example taking from yours might look as follows. arch:
thumbv7em:
fpu: [None, "fpv5-sp-d16"]
float-abi: ["soft", "softfp", "hard"] This is going to get tricky pretty quickly for validating architecture options don't conflict, like selecting |
I have also stumbled over this... Here are my thoughts: In order to keep the maintenance burden on a sensible level, I think as much responsibility as possible should be shifted to the user. I see two possible solutions:
Another issue in general is how the architecture / vectorization options are handled in the library itself - some libraries only provide very limited architecture options, because there is complex logic (conditional inclusion of headers, conditional setting of constants that tune the calculation, etc). Many times this is also simply handled using |
I agree with @robinchrist. |
|
We have a couple common generations of CPU above the baseline x86_64 instruction - namely sandybridge and haswell, with AVX and AVX2/BMI/BMI2 respectively.
LLVM-backed languages and GGC 4.9+ all support "x86-64, sandybridge, haswell, native" for the -march/--target-cpu parameters. GCC 4.8 uses alternate identifiers
corei7-avx
andcore-avx2
for those platforms.These map nicely to MSVC /arch:AVX and /arch:AVX2, which is as granular as MSVC goes.
For now I'm using an extra field in
.conan/settings.yml
:target_cpu: [x86, x86-64, nehalem, sandybridge, haswell, native]
, but I need to move this down into the packages I consume as well, if I want to pivot on sandybridge/haswell support.Has this come up before? Any convention to adopt?
The text was updated successfully, but these errors were encountered: