On Wed, Aug 07, 2024 at 02:08:42PM +0200, Tobias Burnus wrote:
> On Aug 1, 2024, Jakub Jelinek wrote:
> > On Tue, Jul 30, 2024 at 10:51:56PM +0200, Tobias Burnus wrote:
> > > - char id[sizeof (SSDF_IDENTIFIER) + 1 /* '\0' */ + 32];
> > > + tree name;
> > > ...
> > I'd just use a single buffer here,
> > char id[MAX (sizeof (SSDF_IDENTIFIER), sizeof (OMP_SSDF_IDENTIFIER))
> > + 1 /* \0 */ + 32];
> Done as proposed.
> > Given that the Xeon PHI offloading is gone and fork offloading doesn't seem
> > to be worked on, my preference would be
> > __builtin_omp_is_initial_device () and fold that to 0/1 after IPA, because
> > that will actually help user code too.
> Done.
> > And of course, it would be much better to figure out real nohost fix,
> > because if we need to register a constructor which will just do nothing, it
> > still wastes runtime.
>
> To be done in a follow-up patch.
>
> Comments, suggestions, concerns?
As I wrote, I think there should be some option to override the
omp_is_initial_device folding, e.g. for the case where one is compiling some
library code which could be linked either way and so need to avoid folding
omp_is_initial_device because we'll only know at runtime.
But it can certainly wait for incremental change.
> gcc/fortran/ChangeLog:
>
> * f95-lang.cc (gfc_init_builtin_functions): Handle
> DEF_GOMP_BUILTIN_COMPILER)
s/)/./
> @@ -5220,6 +5237,9 @@ gimple_fold_builtin (gimple_stmt_iterator *gsi)
> case BUILT_IN_ACC_ON_DEVICE:
> return gimple_fold_builtin_acc_on_device (gsi,
> gimple_call_arg (stmt, 0));
> + case BUILT_IN_OMP_IS_INITIAL_DEVICE:
> + return gimple_fold_builtin_omp_is_initial_device (gsi);
The indentation here looks wrong, case is 4 spaces indented and next line
uses tab, should use 6 spaces.
Maybe would be worth testing that omp_is_initial_device is not treated like
a builtin in C++ in custom namespace, or as a static or non-static member
function, or for C or Fortran as nested function.
Otherwise LGTM.
Jakub