]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[GCN] Fix run-time variable 'num_workers'
authorThomas Schwinge <thomas@codesourcery.com>
Sat, 5 Jun 2021 20:39:21 +0000 (22:39 +0200)
committerThomas Schwinge <thomas@codesourcery.com>
Tue, 8 Jun 2021 10:00:15 +0000 (12:00 +0200)
... which currently has *not* been forced to 'num_workers (1)'.

In addition to the testcases modified here, this also fixes:

    FAIL: libgomp.oacc-c/../libgomp.oacc-c-c++-common/mode-transitions.c -DACC_DEVICE_TYPE_radeon=1 -DACC_MEM_SHARED=0 -foffload=amdgcn-amdhsa  -O0  execution test
    [Etc.]

    mode-transitions.exe: [...]/libgomp.oacc-c-c++-common/mode-transitions.c:702: t17: Assertion `arr_b[i] == (i ^ 31) * 8' failed.

libgomp/
* plugin/plugin-gcn.c (gcn_exec): Force 'num_workers (1)'
unconditionally.
* testsuite/libgomp.oacc-c-c++-common/acc_prof-kernels-1.c:
Update.
* testsuite/libgomp.oacc-c-c++-common/parallel-dims.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/routine-wv-2.c: Likewise.

libgomp/plugin/plugin-gcn.c
libgomp/testsuite/libgomp.oacc-c-c++-common/acc_prof-kernels-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/parallel-dims.c
libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-2.c

index 8aab708b0efeb9c124c71a904ea29de9a3b3f0a2..cfed42a2d4d89e7a7f2885117e64c56aa4fac77e 100644 (file)
@@ -3041,10 +3041,9 @@ gcn_exec (struct kernel_info *kernel, size_t mapnum, void **hostaddrs,
      problem size, so let's do a reasonable number of single-worker gangs.
      64 gangs matches a typical Fiji device.  */
 
-  /* NOTE: Until support for middle-end worker partitioning is merged, use 1
-     for the default number of workers.  */
   if (dims[0] == 0) dims[0] = get_cu_count (kernel->agent); /* Gangs.  */
-  if (dims[1] == 0) dims[1] = 1;  /* Workers.  */
+  /* NOTE: Until support for middle-end worker partitioning is merged, force 'num_workers (1)'.  */
+  if (/*TODO dims[1] == 0*/ true) dims[1] = 1;  /* Workers.  */
 
   /* The incoming dimensions are expressed in terms of gangs, workers, and
      vectors.  The HSA dimensions are expressed in terms of "work-items",
index 7f74ee922b738743d1d54c419e2ad205f9e7aa40..6c136c26c939399ede26e38b74735ccb3ca41c3d 100644 (file)
@@ -94,9 +94,7 @@ static void cb_enqueue_launch_start (acc_prof_info *prof_info, acc_event_info *e
   if (num_workers < 1)
     assert (event_info->launch_event.num_workers >= 1);
   /* GCN currently enforces 'num_workers (1)'.  */
-  else if (acc_device_type == acc_device_radeon
-          /*TODO ... just not in the "Parallelism dimensions: variable" case.  */
-          && /*TODO*/ num_gangs != 22)
+  else if (acc_device_type == acc_device_radeon)
     assert (event_info->launch_event.num_workers == 1);
   else
     {
index 974e15045341adc30cc973fdf9375609140b2280..fe0dacd5aac409c2ba3b2c8431816170e746826e 100644 (file)
@@ -313,8 +313,9 @@ int main ()
        }
       else if (acc_on_device (acc_device_radeon))
        {
-         /* The GCC GCN back end is limited to num_workers (16).  */
-         workers_actual = 16;
+         /* The GCC GCN back end is limited to num_workers (16).
+            Temporarily set this to 1 until multiple workers are permitted. */
+         workers_actual = 1; // 16;
        }
       else
        __builtin_abort ();
index a03a2c2b163881b74025304c0c0722305c2944b7..624ec24e43747c28d4e500cd9a82c64c2a57405e 100644 (file)
@@ -6,7 +6,8 @@
 #include <gomp-constants.h>
 
 #ifdef ACC_DEVICE_TYPE_radeon
-#define NUM_WORKERS 16
+/* Temporarily set this to 1 until multiple workers are permitted.  */
+#define NUM_WORKERS 1
 #define NUM_VECTORS 1
 #else
 #define NUM_WORKERS 16