Re: [cfe-users] Usage of CLang CUDA target with MinGW stdlib

2018-11-07 Thread Artem Belevich via cfe-users
This may be same/similar to https://bugs.llvm.org/show_bug.cgi?id=38811

Basically, there's no owner for CUDA support on windows. Someone needs to
figure out why/how CUDA includes behave differently under mingw and figure
out how to work around that in the CUDA wrapper headers in clang.


On Fri, Nov 2, 2018 at 2:23 PM KOLANICH via cfe-users <
cfe-users@lists.llvm.org> wrote:

> Hello everybody.
>
> Could anyone clarify how to use this cuda target (-std=c++11 -x cuda) with
> MinGW stdlib?
>
> I mean I get errors
>
> \LLVM-7.0.0-win32\lib\clang\7.0.0\include\cuda_wrappers\new:41:12:
> error: use of undeclared identifier 'malloc' return ::malloc(size);
> \LLVM-7.0.0-win32\lib\clang\7.0.0\include\cuda_wrappers\new:58:7:
> error: no type named 'free' in the global namespace ::free(ptr);
>
> and I wonder what I should do to fix them.
> ___
> cfe-users mailing list
> cfe-users@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
>


-- 
--Artem Belevich
___
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users


Re: [cfe-users] Usage of CLang CUDA target with MinGW stdlib

2018-11-09 Thread Artem Belevich via cfe-users
+cc cfe-users back;

On Thu, Nov 8, 2018 at 10:20 PM KOLANICH  wrote:

> 2018 11 7 23:25:38 UTC, Artem Belevich  пишет:
> >This may be same/similar to https://bugs.llvm.org/show_bug.cgi?id=38811
> >
> >Basically, there's no owner for CUDA support on windows. Someone needs
> >to
> >figure out why/how CUDA includes behave differently under mingw and
> >figure
> >out how to work around that in the CUDA wrapper headers in clang.
> >
> >
> >On Fri, Nov 2, 2018 at 2:23 PM KOLANICH via cfe-users <
> >cfe-users@lists.llvm.org> wrote:
> >
> >> Hello everybody.
> >>
> >> Could anyone clarify how to use this cuda target (-std=c++11 -x cuda)
> >with
> >> MinGW stdlib?
> >>
> >> I mean I get errors
> >>
> >>
>
> >\LLVM-7.0.0-win32\lib\clang\7.0.0\include\cuda_wrappers\new:41:12:
> >> error: use of undeclared identifier 'malloc' return ::malloc(size);
> >>
>
> >\LLVM-7.0.0-win32\lib\clang\7.0.0\include\cuda_wrappers\new:58:7:
> >> error: no type named 'free' in the global namespace ::free(ptr);
> >>
> >> and I wonder what I should do to fix them.
> >> ___
> >> cfe-users mailing list
> >> cfe-users@lists.llvm.org
> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
> >>
>
> Thank you for the suggestion. But this doesn't clarify the strange syntax
> used in the mentioned lines.


You need to look at the preprocessed output in order to see what is it that
clang is complaining about.


> I googled a bit and haven't found anything clarifying, but there are some
> hints suggesting that it may be specific to Visual Studio.
>

It's quite likely. Clang's wrappers for C++ standard library are fairly
specific to particular library. AFAICT we never even tried to make it work
with whatever VC uses.


>
> P.S. I don't use CUDA headers

You actually do. With  "-x cuda" clang pre-includes ton of CUDA headers
(same as nvcc) and adds extra include search paths.
If you do not want to pre-include any CUDA headers, then you need to pass
-nocudainc option.



> - I have AMD GPU and there is a CUDA impl for any OpenCL-capable device
> having own headers, which may be far more compatible that the ones provided
> by CUDA.


Interesting. Can you tell me more about this CUDA-over-OpenCL project?


> The problem I encounter in the headers shipped with CLang, it seems they
> depend on something missing in MinGW headers.
>

Those headers are only intended to make clang work with NVIDIA's CUDA SDK
on linux. MinGW + a project that provides alternative CUDA headers is
unlikely to work as is. -nocudainc should get clang's headers out of your
way, but it will be up to you to provide the equivalent.

Good luck,
-- 
--Artem Belevich
___
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users


Re: [cfe-users] Usage of CLang CUDA target with MinGW stdlib

2018-11-09 Thread Artem Belevich via cfe-users
On Fri, Nov 9, 2018 at 11:31 AM KOLANICH  wrote:

> > -nocudainc should get clang's headers out of your
> >way, but it will be up to you to provide the equivalent.
>
> Yes, corriander provides replacements for NVidia headers. But the problem
> is in the header shipped with CLang.
>

The problem is that you ended up including the headers (that do ship with
clang) that were not intended to be used in your case. -nocudainc is there
specifically to *not* use those headers. If you use -nocudainc, Clang's
cuda-specific wrappers will not be in the header include path and clang
will include  from whatever standard C++ library you have installed.

-- 
--Artem Belevich
___
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users