Hi Julian, hi all,

(I have not (yet) looked at the patch/testcase in depth - and I prefer
that someone knowledgeable with C++ constructors comments. However:)

Regarding only nvptx - and the testcase on nvptx:

On 12.05.23 14:02, Julian Brown wrote:
The approach taken is to generate a set of constructors to run on the
target: this currently works for AMD GCN, but fails on NVPTX due
to lack of constructor/destructor support there so far on mainline.
(See the new test static-aggr-constructor-destructor-3.C for a reason
why running constructors on the target is preferable to e.g. constructing
on the host and then copying the resulting object to the target.)

(I think also the wording in OpenMP implies that it is constructed
on the device and not copied over from the host, albeit the wording
is not very clear.)

For nvptx constructor/destructor support, see email thread
"nvptx: Support global constructors/destructors via 'collect2' for offloading",
e.g., https://gcc.gnu.org/pipermail/gcc-patches/2023-January/609711.html
* * *

If I run the testcase manually with nvptx offloading and -O0, I get:
  libgomp/testsuite/libgomp.c++/static-aggr-constructor-destructor-3.C:8:3: 
error:
    alias definitions not supported in this configuration

and with -O1 and higher:
  libgomp/testsuite/libgomp.c++/static-aggr-constructor-destructor-3.C:36:1:
     sorry, unimplemented: global constructors not supported on this target

As DEFAULT_CFLAGS is -O2 checking for the proper error works, i.e. something
like (untested and ... to be filled in):

  /* { dg-message "sorry, ..." "..." target { offload_target_nvptx } } }
  /* { dg-excess-errors "Follow-up errors from mkoffload and lto-wrapper" { 
target { offload_target_nvptx } } */


Tobias

-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 
München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas 
Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht 
München, HRB 106955

Reply via email to