Skip to content
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

Visual Studio doesn't like TRISYCL_WEAK_ATTRIB_PREFIX a.k.a. __declspec(selectany) in front of function declarations #275

Open
Lotte1990 opened this issue Jun 9, 2020 · 4 comments

Comments

@Lotte1990
Copy link

Visual Studio doesn't like TRISYCL_WEAK_ATTRIB_PREFIX a.k.a. __declspec(selectany) in front of function declarations. Apparently this is only for initialized global data. @keryell Since C++17 has been around for a while now it is maybe possible to switch to C++17 inline as mentioned by the documentation for TRISYCL_WEAK_ATTRIB_PREFIX?

See also #269

@j-stephan
Copy link
Member

j-stephan commented Jun 10, 2020

Reference link

I hope I'll have some free time this evening so I can play around with godbolt and various inlining possibilities...

@keryell keryell added the bug label Jun 10, 2020
@j-stephan
Copy link
Member

After doing some research I've come to the conclusion that this will be harder than I thought.

Visual Studio officially doesn't support weak linking of functions. __declspec(selectany) only works with variables.

We could use an undocumented linker pragma (alternatename) as shown here (both files are relevant) but we'd need to come up with a Macro-way of obtaining the mangled names. And since all of this is undocumented it is probably not too future-proof.

@keryell @MathiasMagnus What do you think about this? Currently I'm in favour of ditching the Windows weak symbols for now and just annotate the functions with [[gnu::weak]]. We don't have a device compiler on Win32 anyway, right?

@keryell
Copy link
Member

keryell commented Jun 12, 2020

Thank you for the research!
There is a simpler solution: do not use this code with VisualStudio because anyway ComputeCpp and Intel DPC++ are already product-quality solutions while this is just an untested triSYCL device compiler path on Windows. :-)
So the solution would be to just #if out the device-compiler related part of the run time that would require massive work to have working on Windows anyway and just keep triSYCL as is: as a pure CPU implementation on Windows.
Any disagreement?

@j-stephan
Copy link
Member

No disagreement from my side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
SYCL C++ library
Awaiting triage
Development

No branches or pull requests

3 participants