RFC: Alternative spellings of OpenMP directives

The OpenMP 6.0 spec introduced new spellings for some directives: directives that had a space in their name can/should [1] now be spelled with an underscore, e.g. target update would be target_update.

The proposal (due to @RaviNarayanaswamy) is to recognize new and old spellings in all OpenMP versions (set by -fopenmp-version=), and emit the new spelling whenever the compiler needs to display the directive name:

  • The function getOpenMPDirectiveKind would return OMPD_target_update for both “target update” and “target_update”.
  • The function getOpenMPDirectiveName would return “target_update” for OMPD_target_update.

This would affect clang and flang equally.

[1] Since 6.0 allows more directive combinations forming compound directives, the underscores are mandatory in leaf directives that are parts of compound directive names.

1 Like

There was no opposition to this voiced in any meeting where this was discussed. If there isn’t any within a week (by April 16), I’ll consider this RFC to be accepted, and I’ll proceed to implementing it.

Our process now is to have the Area Team determine RFC consensus, so it is up to them to accept the RFC. @AaronBallman @rnk @efriedma-quic

As personal opinion: I’d probably want us to have ‘extension’ warnings for the new spellings in older language modes, and perhaps deprecated warnings for the old-spellings in the newer version.

The implementation would have parts common between clang and flang[1], but there is no area team for flang.

[1] Both use the same source files with OpenMP directive/clause definitions, but internal representations are different.

From a process perspective, I think then the Clang area team wouldn’t cover this, it would be the ‘overall’ area team.

From Clang - Get Involved

If a proposal receives little or no feedback, that typically means that the proposal is rejected due to lack of interest.

So no news is not good news. :wink:

That said, I think this is reasonable behavior. I agree with @erichkeane that it should come with extension diagnostics when accepting the new spelling in the older mode though.

True, let me add some background info:

This topic is not going to garner a lot of widespread interest, since it’s confined to the OpenMP implementation. There are regular meetings, though, for OpenMP both in clang and in flang, and this item has been discussed.

This RFC pertains to a feature added in OpenMP 6.0, and we will have to implement it somehow. :slight_smile:

1 Like

Btw, to clarify something a bit – I don’t think this one needed an RFC because it’s not really adding/removing anything from Clang, just a fairly minor modification to existing functionality coming from a language standard. I think this could have been done via a PR alone.

I think the RFC was probably done just to make sure there’s some wider awareness, which isn’t a bad thing. So I don’t think silence in this case means “nobody wants to get involved in this mess”.

2 Likes

+1 to this, and I’m glad to hear the OpenMP folks have already discussed this and found agreement.

If there are no objections in the next day or so, I think this RFC is accepted.

1 Like

Agreed. This RFC is following the standard, which we want to do by default. And nobody seems to be opposed to the way to do it. Now to make sure there is interest shown in this thread.

+1 on implementing this.

The proposal (due to @RaviNarayanaswamy) is to recognize new and old spellings in all OpenMP versions (set by -fopenmp-version= ), and emit the new spelling whenever the compiler needs to display the directive name.

Accepting the new spelling in the old versions seems reasonable but I agree with @erichkeane, we likely want to make it an extension (with the usual implications).
Emitting the new spelling is different and I would not recommend doing that for old versions. We offer tooling that should work with old versions w/o “auto-upgrading” their code, even just to avoid the churn. If you want to modernize your code, make this a clang-modernize thing.
If an underscore is necessary, it’s by definition version 6.0, so we would emit new spelling anyway.

The essence of the RFC was whether to attach version numbers to spellings. With the feedback above being that there should be an interaction between the spelling and the version number, the RFC cannot be implemented as stated.

The difference is that now

  • the function getOpenMPDirectiveName should take a version number as well as the directive id,
  • the directive description in the OMP.td file would need to have “versioned spellings”, instead of just a list of strings.

Are you referring to my feedback? My suggestion was to still allow both spellings in both ways, but during parsing to diagnose based on language option.

Any time we expose spellings/features from 1 version to another, we need to have those two sorts of warnings.

Even in parsing we still need to know if the spelling in the source code is the same as the corresponding OpenMP spec allows, so there has to be a connection between the spelling and the version number. Also, @jdoerfert’s feedback to emit spec-specific spellings requires that we maintain this kind of a mapping.

FWIW, the alternative is to emit the exact spelling in the source code, which might even be better. However, I can see that that would explode our enums.

If this means that AST loses source fidelity on the exact spelling, I find that unfortunate.