This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Another ptx offloading patch


On Fri, Jan 16, 2015 at 11:45:40AM +0100, Richard Biener wrote:
> On Thu, Jan 15, 2015 at 7:35 PM, Jeff Law <law@redhat.com> wrote:
> > On 11/20/14 05:33, Bernd Schmidt wrote:
> >>
> >> Now that I've managed to put together and test all the submitted OpenACC
> >> patches I found there was one piece missing. The problem is that omp-low
> >> on the host likes to generate function names like "_main._omp_fn". On
> >> ptx, the dot is not allowed in identifiers, so we have to rewrite this
> >> to use a dollar sign.
> >>
> >> The patch below does this at the lto-read stage. Bootstrapped on
> >> x86_64-linux, ok if testing is successful?
> >
> > Was expecting Richi or Honza to review this...  They certainly know the LTO
> > bits far better than I.  Or have you ultimately addressed this issue some
> > other way?
> 
> I don't like the validize_symbol_for_target thing - you create proper
> symbols elsewhere from the start - what's left to fix?  IMHO we should
> have a single helper somewhere for concatenating with some separator.

The problem is that the host compiler does not and cannot know what
characters are valid or invalid on the offloading target (and, especially if
you have multiple of them, as we do now, where some of the .$_ characters
are valid and others are not).
The only universally available character is _ I assume, but that one has the
problem that users can type that in their code and clash with the internal
symbols.  And, if we do not want to use _ from the beginning, what do you
suggest otherwise?  Also note that normally the same functions are emitted
for both host and offloading target, you don't have different symbol names
for host and different for what you want to stream to the offloading LTO
sections.

So I think something like Bernd's patch is the way to go.  Another
alternative is to pick up some completely different character not valid
in any identifiers, and do two transformations of the names.  When streaming
offloading LTO from the host compiler, mangle the $ and . characters in
names to some other character, say %, and then when streaming the offloading
LTO into the offloading compiler, remap the % (or whatever) character to
the best internal symbol character there - ., $ or _ (in that order?).
But Bernd's patch looks simpler than that.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]