https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109620

            Bug ID: 109620
           Summary: [OpenMP][Offloading] OMP_CANCELLATION ICV not mapped
                    to device
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgomp
          Assignee: unassigned at gcc dot gnu.org
          Reporter: frederik at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

The value of the OMP_CANCELLATION ICV does not get copied to offloading
devices.
I have tested it by running the following test code both with nvptx and amgdcn
offloading as a part of the libgomp testsuite:   

/* { dg-set-target-env-var OMP_CANCELLATION "true" } */

#include <omp.h>

int
main ()
{

  __builtin_printf("OMP_CANCELLATION on host: %d\n",
                 omp_get_cancellation ());
#pragma omp target
{
  __builtin_printf("OMP_CANCELLATION on device: %d\n",
                   omp_get_cancellation ());
}

  return 0;
}

In both cases, the output was:

OMP_CANCELLATION on host: 1
OMP_CANCELLATION on device: 0

Does libgomp copy global ICVs to the device environment at all?
I did not find any tests that use cancellation in "target" regions. I think
there is no way for a user to enable it if the ICV is not forwarded.
But would it be supported in principle?

Reply via email to