[PATCH] D115283: [AMDGPU] Set "amdgpu_hostcall" module flag if an AMDGPU function has calls to device lib functions that use hostcalls.

2022-01-31 Thread Sameer Sahasrabuddhe via Phabricator via cfe-commits
sameerds added inline comments. Comment at: clang/lib/CodeGen/TargetInfo.cpp:9434 + if (Callee && + (Callee->getName() == "__ockl_call_host_function" || + Callee->getName() == "__ockl_fprintf_stderr_begin")) { Just to confirm what others have

[PATCH] D115283: [AMDGPU] Set "amdgpu_hostcall" module flag if an AMDGPU function has calls to device lib functions that use hostcalls.

2022-01-21 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment. The asm variable used by rocm aomp is zero overhead, needs no compiler support and works exactly as one would wish under inlining or code elimination. The main argument against that approach seems to be it's an abi break, much like this patch was, and that it

[PATCH] D115283: [AMDGPU] Set "amdgpu_hostcall" module flag if an AMDGPU function has calls to device lib functions that use hostcalls.

2022-01-21 Thread Jeff Sandoval via Phabricator via cfe-commits
sandoval added a comment. I don't see a clear explain the motivation for this change - can you confirm my understanding or provide clarification? It looks like the issue is that D110337 caused a regression for cases when user code directly calls a device

[PATCH] D115283: [AMDGPU] Set "amdgpu_hostcall" module flag if an AMDGPU function has calls to device lib functions that use hostcalls.

2021-12-09 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. In D115283#3183034 , @JonChesterfield wrote: > In D115283#3182879 , @yaxunl wrote: > >> In D115283#3181128 , >> @JonChesterfield wrote: >> >>>

[PATCH] D115283: [AMDGPU] Set "amdgpu_hostcall" module flag if an AMDGPU function has calls to device lib functions that use hostcalls.

2021-12-09 Thread Daniil Fukalov via Phabricator via cfe-commits
dfukalov added inline comments. Comment at: clang/test/CodeGenHIP/amdgpu_hostcall.cpp:2-6 +// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -x hip -emit-llvm -fcuda-is-device -DFN_HOSTCALL \ +// RUN: -o - %s | FileCheck --enable-var-scope %s + +// RUN: %clang_cc1 -triple

[PATCH] D115283: [AMDGPU] Set "amdgpu_hostcall" module flag if an AMDGPU function has calls to device lib functions that use hostcalls.

2021-12-09 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment. In D115283#3182879 , @yaxunl wrote: > In D115283#3181128 , > @JonChesterfield wrote: > >> Not exactly that. The weak symbol isn't the function name, as that gets >> renamed or

[PATCH] D115283: [AMDGPU] Set "amdgpu_hostcall" module flag if an AMDGPU function has calls to device lib functions that use hostcalls.

2021-12-09 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. In D115283#3181109 , @kpyzhov wrote: > In D115283#3180836 , @yaxunl wrote: > >> If we only need to check whether `__ockl_hostcall_internal` exists in the >> final module in LLVM codegen

[PATCH] D115283: [AMDGPU] Set "amdgpu_hostcall" module flag if an AMDGPU function has calls to device lib functions that use hostcalls.

2021-12-09 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. In D115283#3181128 , @JonChesterfield wrote: > Not exactly that. The weak symbol isn't the function name, as that gets > renamed or inlined. We discussed this before. As code object ABI use runtime metadata to represent

[PATCH] D115283: [AMDGPU] Set "amdgpu_hostcall" module flag if an AMDGPU function has calls to device lib functions that use hostcalls.

2021-12-08 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment. Not exactly that. The weak symbol isn't the function name, as that gets renamed or inlined. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115283/new/ https://reviews.llvm.org/D115283

[PATCH] D115283: [AMDGPU] Set "amdgpu_hostcall" module flag if an AMDGPU function has calls to device lib functions that use hostcalls.

2021-12-08 Thread Konstantin Pyzhov via Phabricator via cfe-commits
kpyzhov added a comment. In D115283#3180836 , @yaxunl wrote: > If we only need to check whether `__ockl_hostcall_internal` exists in the > final module in LLVM codegen to determine whether we need the hostcall > metadata, probably we don't even need a

[PATCH] D115283: [AMDGPU] Set "amdgpu_hostcall" module flag if an AMDGPU function has calls to device lib functions that use hostcalls.

2021-12-08 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment. Openmp defines a weak symbol in the hostcall_invoke function. Optimisation and deadstripping friendly, no compiler support necessary. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115283/new/

[PATCH] D115283: [AMDGPU] Set "amdgpu_hostcall" module flag if an AMDGPU function has calls to device lib functions that use hostcalls.

2021-12-08 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. If we only need to check whether `__ockl_hostcall_internal` exists in the final module in LLVM codegen to determine whether we need the hostcall metadata, probably we don't even need a function attribute or even module flag. Repository: rG LLVM Github Monorepo

[PATCH] D115283: [AMDGPU] Set "amdgpu_hostcall" module flag if an AMDGPU function has calls to device lib functions that use hostcalls.

2021-12-08 Thread Konstantin Pyzhov via Phabricator via cfe-commits
kpyzhov added inline comments. Comment at: clang/test/CodeGenHIP/amdgpu_hostcall.cpp:2-6 +// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -x hip -emit-llvm -fcuda-is-device -DFN_HOSTCALL \ +// RUN: -o - %s | FileCheck --enable-var-scope %s + +// RUN: %clang_cc1 -triple

[PATCH] D115283: [AMDGPU] Set "amdgpu_hostcall" module flag if an AMDGPU function has calls to device lib functions that use hostcalls.

2021-12-08 Thread Konstantin Pyzhov via Phabricator via cfe-commits
kpyzhov added a comment. In D115283#3179651 , @yaxunl wrote: > One drawback of this approach is that it does not work for LLVM modules > generated from assembly or programmatically e.g. Tensorflow XLA. > > Another drawback is that if

[PATCH] D115283: [AMDGPU] Set "amdgpu_hostcall" module flag if an AMDGPU function has calls to device lib functions that use hostcalls.

2021-12-08 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. One drawback of this approach is that it does not work for LLVM modules generated from assembly or programmatically e.g. Tensorflow XLA. Another drawback is that if `__ockl_call_host_function` or `__ockl_fprintf_stderr_begin` are eliminated by optimizer, the module flag

[PATCH] D115283: [AMDGPU] Set "amdgpu_hostcall" module flag if an AMDGPU function has calls to device lib functions that use hostcalls.

2021-12-08 Thread Daniil Fukalov via Phabricator via cfe-commits
dfukalov added inline comments. Comment at: clang/test/CodeGenHIP/amdgpu_hostcall.cpp:2-6 +// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -x hip -emit-llvm -fcuda-is-device -DFN_HOSTCALL \ +// RUN: -o - %s | FileCheck --enable-var-scope %s + +// RUN: %clang_cc1 -triple

[PATCH] D115283: [AMDGPU] Set "amdgpu_hostcall" module flag if an AMDGPU function has calls to device lib functions that use hostcalls.

2021-12-07 Thread Konstantin Pyzhov via Phabricator via cfe-commits
kpyzhov updated this revision to Diff 392577. Herald added subscribers: kerbowa, nhaehnle, jvesely. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115283/new/ https://reviews.llvm.org/D115283 Files: clang/lib/CodeGen/TargetInfo.cpp

[PATCH] D115283: [AMDGPU] Set "amdgpu_hostcall" module flag if an AMDGPU function has calls to device lib functions that use hostcalls.

2021-12-07 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added inline comments. Comment at: clang/lib/CodeGen/TargetInfo.cpp:9425 +void AMDGPUTargetCodeGenInfo::checkFunctionCallABI(CodeGenModule , + SourceLocation CallLoc, Doesn't seem to check

[PATCH] D115283: [AMDGPU] Set "amdgpu_hostcall" module flag if an AMDGPU function has calls to device lib functions that use hostcalls.

2021-12-07 Thread Konstantin Pyzhov via Phabricator via cfe-commits
kpyzhov added a comment. In D115283#3177615 , @dfukalov wrote: > Needs a test. Yes, good point, thanks! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115283/new/ https://reviews.llvm.org/D115283

[PATCH] D115283: [AMDGPU] Set "amdgpu_hostcall" module flag if an AMDGPU function has calls to device lib functions that use hostcalls.

2021-12-07 Thread Daniil Fukalov via Phabricator via cfe-commits
dfukalov added a comment. Needs a test. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115283/new/ https://reviews.llvm.org/D115283 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D115283: [AMDGPU] Set "amdgpu_hostcall" module flag if an AMDGPU function has calls to device lib functions that use hostcalls.

2021-12-07 Thread Konstantin Pyzhov via Phabricator via cfe-commits
kpyzhov created this revision. kpyzhov added a reviewer: yaxunl. kpyzhov added a project: AMDGPU. Herald added subscribers: t-tye, tpr, dstuttard, kzhuravl. kpyzhov requested review of this revision. Herald added subscribers: cfe-commits, wdng. Herald added a project: clang. Repository: rG LLVM