-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Export -march=native
for Clang and prevent it from being included during cross compilation.
#2416
Export -march=native
for Clang and prevent it from being included during cross compilation.
#2416
Conversation
Hey I'm sorry I'm confused. Am I supposed to be testing this as-is or waiting for a rebase now that #2100 is merged? I was waiting for the rebase but now I'm not sure...it's 3:15am for me right now, got plans in the morning but i should be able to check this out tomorrow afternoon (~12-16 hrs from now). |
Sorry for not being clear. The rebase merge comment was more for Sergey in case he wanted to merge this following #2100, since it includes commits from that PR. Now that #2100 is merged, I'll do the rebase manually. Regardless of that and for future reference, you can always test it as is. The rebasing operations are usually just to have a clean history before the merge commits. |
6fbe8a6
to
54b90da
Compare
Looks good to me!!! Building PCL Itself(at very endish there's a
AKA FWIW, it shouldn't matter too much, but this was with the following configuration: $ cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/pcl/clang/6.0.1 -DWITH_CUDA=OFF -DWITH_VTK=OFF Compilers verified:
Using PCL From CMakeI didn't actually create / test a project yet, but it should work out just fine. sven:/opt/pcl> grep march gcc/7.3.1/share/pcl-1.8/PCLConfig.cmake
gcc/7.3.1/share/pcl-1.8/PCLConfig.cmake:437:list(APPEND PCL_COMPILE_OPTIONS -march=native;-msse4.2;-mfpmath=sse)
sven:/opt/pcl> grep march clang/6.0.1/share/pcl-1.8/PCLConfig.cmake
clang/6.0.1/share/pcl-1.8/PCLConfig.cmake:437:list(APPEND PCL_COMPILE_OPTIONS -march=native;-msse4.2;-mfpmath=sse)
sven:/opt/pcl> grep march clang/5.0.0/share/pcl-1.8/PCLConfig.cmake
clang/5.0.0/share/pcl-1.8/PCLConfig.cmake:437:list(APPEND PCL_COMPILE_OPTIONS -march=native;-msse4.2;-mfpmath=sse) AKA this should definitely be working as expected. I am fixing compilation issues with intel right now, fixed the deprecated macros, working on |
Honestly, I don't think we need to check for GCC version being greater than 4.2. It is more than a decade old! And the oldest active Ubuntu LTS (which is 12.04) has 4.8. Thus I would propose to drop versions testing and reduce the script to: if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG)
list(APPEND SSE_FLAGS "-march=native")
message(STATUS "Using CPU native flags for SSE optimization: ${SSE_FLAGS}")
endif() |
👍 I'll modify it tonight. |
In that event, I will open an alternate PR. The Intel stuff is ummm...despicable. They have some really inconvenient / arbitrary compiler flag rules. In addition to fixing intel compilation, I also added AVX and AVX2 checks. Posting so you know it's inbound, I'll remove the GCC 4.2 check in that PR. I'm just waiting to check on all the compilers again to make sure it's legit (intel's compiler is actually really slow...). I think you all will be pleased with the result though, it looks like a big diff but really not IMO. I should have participated in #2100 but I was trying to not get sucked in lol. |
I suppose you are talking about those |
Yup.
Only a very fuzzy picture. Here's how I understand the gcc docs, inlining some for convenience with some emphasis
In contrast, at the bottom the giant listing of all the possible
So while you may think that To be clear, I'm not an expert, and definitely not 100%. I think adding On the other hand, now that I take a second look, these also need to be guarded by |
Sorry for double response. I forgot the most important. There's no After retesting the Linux ones I will test visual studio and this specific module, but I won't actually be testing building PCL itself on Windows. |
Thanks for the post, interesting reading. Did you also check comments? This one provides a very reasonable explanation why the oddities that the author talks about actually make sense. That said, I don't think this post is relevant to our discussion since it's about
GCC docs claim that using
Certainly.
I'm no Visual Studio user, but I think I've heard that |
Ok I proposed #2426 in a way that the changes to the file being discussed here can be blown away (kill the last commit) in favor of something less complex. Yeah I choose to pretend I will test and see what's going on with Windows. Apparently it used to be Maybe the best approach here is to have @SergioRAgostinho finish of this PR with the elimination of ancient checks #2416 (comment) I could then open a different PR with just the first two commits there so that Intel officially works in the next release, and more time can be spent deciding wtf is actually going on with these darn flags. I'm stepping away for this for at least 24 hours because I'm starting to get too turned around. I will test Windows tomorrow. Sorry for stream-of-consciousness-posting here.......I'm completely frazzled |
Thanks for all the effort. I feel like merging this and then Intel parts of your PR would be the best plan for this release. After that we can think about all the questions that have popped up and decide on the plan. Your |
Sounds good. I'll open a new PR with those two commits after this merges 👍 I'll take a closer look at theirs, it's scary. But I really need to solve this once and for all for my own library so PCL will benefit too (I stole a lot of code from here so I'm paying down my debts lol). |
Some of their stuff may be too advanced (for example, we don't have runtime dispatching). But we can certainly get inspired and borrow some functions/snippets.
Very welcome :) |
It feels like this one was superseeded by #2426 correct? |
No:
|
Ok. Is there anything preventing this one from being merged? |
Yes:
|
during cross compilation.
54b90da
to
c71d2ce
Compare
That should be it I believe. Travis seems to have died. |
Travis is alright, but GitHub does not show it for some reason. |
@SergioRAgostinho sorry for adding all the noise / making it confusing... @taketwo I cherry-picked the two fixes needed for Intel unrelated to vectorization stuff in #2432 . |
Closes: #2256
Tried it on OS X and its adding the flag and the flag is being passed to the downstream target (I applied it after #2100). I also ran #2013 and it seems fine.
Rebase Merge after #2100 i.e., just consider the last commit.