-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Added support for ClangCL #5858
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
Conversation
If Halide on Windows requires a larger stack size to not crash, then yes, I believe it should because it is therefore a usage requirement. |
From Gitter:
Would you mind posting this as a comment so we can see? |
You should sync to master to retry the bots. |
I've been playing around with a few different ways of communicating our stack size requirement to our users. Here are my take-aways.
To do this effectively in CMake, we will need a custom property:
We will then need to tell CMake how this custom property works when we attach it to the Halide target.
We will need to add an example to
Previously, I'm not sure users could override this, or maybe they could only with a I have a few TODOs here (I will update the above solution if these TODOs change my understanding of things):
|
Why delete the pragma (instead of wrapping it in an ifndef that detects clang)? |
Because clang does need a higher stack size too (actually pretty identical values to the MSVC compiler). But clang does not accept the same pragma. You would effectively be maintaining two parallel solutions, where the Clang-solution would work for MSVC too, but not vice versa. |
@alexreinking You are progressing really nicely here! I'm terribly busy before easter and will be away afterwards for a week, so please feel free to take over and edit this PR to your liking, or start over in a new PR and drop this one here. I'm not keen on my authorship. I place all my changes from this PR under the public domain, to be used by you or anyone in their own PRs, or to edit this PR in any way you see fit. |
The reason to keep the pragma (in addition to the cmake changes) would be to support people including Halide.h from vanilla msvc projects, or gyp-generated msvc projects. |
That makes perfect sense, I agree. Its hard for me to suggest a best approach, since I can see that @alexreinking has gone to some lengths to support setting the stack size transitively via cmake. What I can say is that the clang compiler has many benefits over the standard MSVC compiler, so maybe its worthwhile to support it (at least in the longer run). But that's just my two cents... |
We don't support vanilla VS or Gyp as a first party build system. We don't test those scenarios, so they're liable to break at any point. Those users are welcome to submit and maintain integration tests for those build systems if they expect reliable support from upstream (especially gyp). Furthermore, I'm not convinced the pragma is the right solution anyway. It adds linker flags in the order they are encountered with later ones taking precedence. For example:
would override a (potentially larger) stack size set via pragma in |
I'd be willing to bet money that the majority of our windows users don't use cmake. We shouldn't casually and intentionally break non-cmake usage. Edit: I'm talking about users of a precompiled libHalide/Halide.h, not people building Halide itself. |
Awesome!
This looks like a nice and clean solution and covers the case that users can easily override the setting with higher values (that the current implementation with the
This sounds very reasonable! |
Discussion on the gitter is converging to just spawning a thread or fiber with a larger stack to do lowering on, and not touching the build system at all (either via pragmas or cmake stuff). |
...please tell me there aren't still people using gyp :-/ |
Stack size linker requirement obviated by #5873 |
Closing in favor of #5876 (no edit access here, unfortunately). |
This PR makes minor changes to the build in order to support ClangCl on VS. The required change is mostly about the stack size. Currently MSVC requires a higher stack size, and this setting was in
Util.h
. However clang does not support thepragma
. Therefore this PR sets the same flag via CMake compiler options for the executables built by this project. The flag is currently not passed transitively to downstream projects. And it is not discriminating between executables in the Halide project - all executables get the higher stack size. This seems to be correct at least fortutorial
,test
andbenchmark
executables.To be discussed: