https://github.com/jhuber6 approved this pull request.

Accepting this with Fortran makes sense. This option basically controls whether 
or not the GPU toolchain will implicitly include the `libcgpu.a` static library 
via `-lcgpu`. It defaults to on if it finds the `libc` wrapper headers in the 
`clang` resource directory, 
`lib/clang/18/include/llvm_libc_wrappers/llvm-libc-decls`. I'm assuming that 
Fortran doesn't have this?

It's supposed to wrap around the C standard headers so the compiler knows that 
we have certain `libc` functions on the GPU. However, OpenMP will pretty much 
just assume anything referenced on the GPU is implicitly on the device so it 
will likely work for most functions without the wrapper headers. The important 
exception is `stdout` and  friends. Because this is a global, OpenMP by default 
will try to map the host value rather than use the one present in `libcgpu` so 
we need to declare it on the GPU so it avoids the implicit map.

I'd be very interested in troubleshooting anything to get this working on 
Fortran.

https://github.com/llvm/llvm-project/pull/77135
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to