[PATCH] D61399: [OpenMP][Clang] Support for target math functions
Alexey Bataev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri May 3 11:08:42 PDT 2019
ABataev added a comment.
In D61399#1490189 <https://reviews.llvm.org/D61399#1490189>, @hfinkel wrote:
> > Still, I think we need to prvide the default implementation of those non-standard functions (they can be very simple, maybe reporting error is going to be enough), which can be overriden by user.
>
> I appreciate your motivation, and I agree with you to some extent. I don't object to having generic versions of useful math functions, but I don't think they should be required. It's not reasonable to make someone add generic versions of every function which happens to appear in a system/target-specific math.h header. NVPTX won't be the only target that has target-optimized functions that get pulled in, even from our own headers, but system headers also have differences anyway depending on what preprocessor macros are defined. In the end, people can write portable code if they stick to what's in the standard, and we should make it reasonably easy for them to step outside of the standard to do what they need to do when the standard subset of available functionality doesn't meet their needs for whatever reason. This is what we do for C/C++, where we provide intrinsics and other system functions for those who can't write their code only using the facilities that C/C++ provide.
>
> In any case, I think that we can figure out how to add generic versions of non-standard math functions in a separate thread. I think that we should move forward with this and then make progress on generic versions separately. It's also possible that we want to fold this discussion into the discussion on an LLVM math library (we've talked about this for some time in the context of vector math libraries, and I'd not thought about accelerators in this context, but maybe this is all related).
It is up to you. I don't have strong objections if you think this will work as required. Just the tests must be fixed, especially codegen tests.
================
Comment at: test/CodeGen/nvptx_device_cmath_functions.c:1
+// Test calling of device math functions.
+///==========================================================================///
----------------
1. Provide tests for C++ too.
2. Do not use driver to generate the code, use frontend.
3. Do not include real system header files. Use some stubs instead.
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61399/new/
https://reviews.llvm.org/D61399
More information about the cfe-commits
mailing list