[clang] [Clang] Do not emit intrinsic math functions on GPU targets (PR #98209)

2024-08-06 Thread Matt Arsenault via cfe-commits
arsenm wrote: > Interesting, the important bit is that this is done before the LTO link so we > know which functions to pull in. Unfortunately I don't think there's a good > location that actually states which math calls are supported, but I could > probably make a script that goes through eac

[clang] [Clang] Do not emit intrinsic math functions on GPU targets (PR #98209)

2024-08-05 Thread Artem Belevich via cfe-commits
Artem-B wrote: Given that the prevalent compilation for CUDA has no standard library whatsoever, preserving libcalls may break some existing users that may be relying on library call lowering to an intrinsic that *is* implemented by the back-end. Perhaps this "no library call to intrinsic con

[clang] [Clang] Do not emit intrinsic math functions on GPU targets (PR #98209)

2024-07-10 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/98209 >From 605e9e78c1cba3b1947a538c566ffedbb9525be0 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Wed, 10 Jul 2024 09:39:44 -0500 Subject: [PATCH 1/2] [Clang] Correctly enable the f16 type for offloading Summary:

[clang] [Clang] Do not emit intrinsic math functions on GPU targets (PR #98209)

2024-07-10 Thread Joseph Huber via cfe-commits
jhuber6 wrote: > This is going to break the library build. We use the __builtin functions to > access the intrinsic in the cases where the llvm intrinsic lowering provides > the implementation of the function. In a more sensible world, the library > would not provide the implementations of fun

[clang] [Clang] Do not emit intrinsic math functions on GPU targets (PR #98209)

2024-07-10 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm edited https://github.com/llvm/llvm-project/pull/98209 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Do not emit intrinsic math functions on GPU targets (PR #98209)

2024-07-10 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm commented: This is going to break the library build. We use the __builtin functions to access the intrinsic in the cases where the llvm intrinsic lowering provides the implementation of the function. In a more sensible world, the library would not provide the implemen

[clang] [Clang] Do not emit intrinsic math functions on GPU targets (PR #98209)

2024-07-10 Thread Matt Arsenault via cfe-commits
@@ -0,0 +1,51 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa %s -emit-llvm -o - | FileCheck %s --check-prefix AMDGPU +// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda %s -emit-ll

[clang] [Clang] Do not emit intrinsic math functions on GPU targets (PR #98209)

2024-07-09 Thread Joseph Huber via cfe-commits
https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/98209 Summary: Currently, the GPU gets its math by using wrapper headers that eagerly replace libcalls with calls to the vendor's math library. e.g. ``` // __clang_cuda_math.h [[gnu::always_inline]] double sin(double __

[clang] [Clang] Do not emit intrinsic math functions on GPU targets (PR #98209)

2024-07-09 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang @llvm/pr-subscribers-clang-codegen Author: Joseph Huber (jhuber6) Changes Summary: Currently, the GPU gets its math by using wrapper headers that eagerly replace libcalls with calls to the vendor's math library. e.g. ``` // __clang_cuda_math.h [[gn