-
Notifications
You must be signed in to change notification settings - Fork 788
[SYCL] Fix compilation fail on Windows #6257
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
Apparently, std::max(smth) cannot be used...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently, std::max(smth) cannot be used...
I see a lot of std::max(smth) uses in the project. Could you clarify the problem with using std::max here?
I believe it depends on what headers are included prior to this specific include by the customer's code. It seems that this particular test has some "bad" system include resulting in the following after the preprocessor:
|
@@ -117,7 +117,8 @@ class usm_allocator { | |||
|
|||
private: | |||
constexpr size_t getAlignment() const { | |||
return std::max(alignof(T), Alignment); | |||
using std::max; // Cause of MS Windows' macro... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any quick note how this resolves the build issue? should we move the solution to a common header file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: e7d4537
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: e7d4537
Hmm, why is that "fix" not enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few ways to handle this problem.
I suppose the issue can be exposed if someone explicitly include this header and re-define max
symbol with a macro.
e7d4537 shows one of the approaches to avoid this problem. Codeplay folks applied a bit different solution in the barrier
extension header - 2e3f61e.
BTW, I see a few more uses of std::max
in sycl/include/CL/sycl/usm.hpp
which probably should be updated as well. I wonder how these are passing sycl/test/basic_tests/min_max_test.cpp
test. Maybe -fsycl-device-only
has something to do with it....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'll be able to remove the using
directive here and it would still work. Awaiting local build. Also, I don't need the std::max
, a max
would suffice just as well. And I'd expect that we'll have either a macro or sycl::max
inside current scope at this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'll be able to remove the
using
directive here and it would still work.
This reverts the change. So, how did you manage to get the compilation fail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll remove the explicit std::
, it will be simply return max(...)
.
I believe the failure in the "Build + LIT" task is unrelated to this PR and should be ignored. Also: #6243 (review) |
Restarted testing after problematic commit was reverted. |
Ready to merge I believe. |
Apparently, std::max(smth) cannot be used...