[PATCH] D157738: [OpenMP] Emit offloading entries for indirect target variables

Ravi Narayanaswamy via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 14 14:58:27 PDT 2023


RaviNarayanaswamy added a comment.

In D157738#4586465 <https://reviews.llvm.org/D157738#4586465>, @JonChesterfield wrote:

>> calling device functions via their associated host pointer
>
> What does this mean? Defining a function foo such that the host and each individual target each have their own machine code for it, such that &foo on the host can be copied over to the target and then invoked to mean call the function on the local target with the same name?
>
> If so, calling through the pointer &foo on the GPU doing a logarithmic search through a table to choose a function address to branch to sounds like something that will codegen into very slow code. Does it do that search on every call?
>
> Is there an ambition to have &foo on the host and &foo on the (each) target return the same value, in the pointer equality sense?
>
> Searching the linked spec for indirect finds the following
>
>> If the indirect clause is present and invoked-by-fptr evaluates to true, any procedures that appear in a to clause on the directive may be called with an indirect device invocation. If the indirect clause is present and invoked-by-fptr does not evaluate to true, any procedures that appear in a to clause on the directive may not be called with an indirect device invocation. Unless otherwise specified by an indirect clause, procedures may not be called with an indirect device invocation.
>
> Which tells me that the indirect clause means procedures can be called with an indirect device invocation. Searching for the expression "indirect device invocation" finds that paragraph and nothing else. So... where does the spec say what this thing is?

Only indirect calls on the device will do a search the table.  The spec does not say how it should be implemented.  One could do the  translation at the target region when it is mapped on the host but this  will not handle all the  cases.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157738/new/

https://reviews.llvm.org/D157738



More information about the cfe-commits mailing list