[committed,nvptx] Eliminate PTX_VECTOR_LENGTH

Message ID 20190107085422.GA23971@delia
State New
Headers show
Series
  • [committed,nvptx] Eliminate PTX_VECTOR_LENGTH
Related show

Commit Message

Tom de Vries Jan. 7, 2019, 8:54 a.m.
Hi,

this patch removes PTX_VECTOR_LENGTH and replaces uses of it with
PTX_DEFAULT_VECTOR_LENGTH, PTX_MAX_VECTOR_LENGTH and PTX_WARP_SIZE.

Committed to trunk.

Thanks,
- Tom

[nvptx] Eliminate PTX_VECTOR_LENGTH

2019-01-07  Tom de Vries  <tdevries@suse.de>

	* config/nvptx/nvptx.c (PTX_VECTOR_LENGTH): Remove.
	(PTX_DEFAULT_VECTOR_LENGTH, PTX_MAX_VECTOR_LENGTH): Define.
	(nvptx_goacc_validate_dims_1, nvptx_dim_limit)
	(nvptx_goacc_reduction_fini): Use PTX_DEFAULT_VECTOR_LENGTH,
	PTX_MAX_VECTOR_LENGTH and PTX_WARP_SIZE instead of PTX_VECTOR_LENGTH.

---
 gcc/config/nvptx/nvptx.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

Patch

diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c
index c0a58f3aee5..3d680e9d80a 100644
--- a/gcc/config/nvptx/nvptx.c
+++ b/gcc/config/nvptx/nvptx.c
@@ -82,7 +82,8 @@ 
 #define WORKAROUND_PTXJIT_BUG_3 1
 
 #define PTX_WARP_SIZE 32
-#define PTX_VECTOR_LENGTH 32
+#define PTX_DEFAULT_VECTOR_LENGTH PTX_WARP_SIZE
+#define PTX_MAX_VECTOR_LENGTH PTX_WARP_SIZE
 #define PTX_WORKER_LENGTH 32
 #define PTX_DEFAULT_RUNTIME_DIM 0 /* Defer to runtime.  */
 
@@ -5376,14 +5377,14 @@  nvptx_goacc_validate_dims_1 (tree decl, int dims[], int fn_level)
     }
 
   if (dims[GOMP_DIM_VECTOR] >= 0
-      && dims[GOMP_DIM_VECTOR] != PTX_VECTOR_LENGTH)
+      && dims[GOMP_DIM_VECTOR] != PTX_WARP_SIZE)
     {
       warning_at (decl ? DECL_SOURCE_LOCATION (decl) : UNKNOWN_LOCATION, 0,
 		  dims[GOMP_DIM_VECTOR]
 		  ? G_("using vector_length (%d), ignoring %d")
 		  : G_("using vector_length (%d), ignoring runtime setting"),
-		  PTX_VECTOR_LENGTH, dims[GOMP_DIM_VECTOR]);
-      dims[GOMP_DIM_VECTOR] = PTX_VECTOR_LENGTH;
+		  PTX_DEFAULT_VECTOR_LENGTH, dims[GOMP_DIM_VECTOR]);
+      dims[GOMP_DIM_VECTOR] = PTX_DEFAULT_VECTOR_LENGTH;
     }
 
   /* Check the num workers is not too large.  */
@@ -5397,7 +5398,7 @@  nvptx_goacc_validate_dims_1 (tree decl, int dims[], int fn_level)
 
   if (oacc_default_dims_p)
     {
-      dims[GOMP_DIM_VECTOR] = PTX_VECTOR_LENGTH;
+      dims[GOMP_DIM_VECTOR] = PTX_DEFAULT_VECTOR_LENGTH;
       if (dims[GOMP_DIM_WORKER] < 0)
 	dims[GOMP_DIM_WORKER] = PTX_DEFAULT_RUNTIME_DIM;
       if (dims[GOMP_DIM_GANG] < 0)
@@ -5440,7 +5441,7 @@  nvptx_dim_limit (int axis)
   switch (axis)
     {
     case GOMP_DIM_VECTOR:
-      return PTX_VECTOR_LENGTH;
+      return PTX_MAX_VECTOR_LENGTH;
 
     default:
       break;
@@ -5937,7 +5938,7 @@  nvptx_goacc_reduction_fini (gcall *call)
       /* Emit binary shuffle tree.  TODO. Emit this as an actual loop,
 	 but that requires a method of emitting a unified jump at the
 	 gimple level.  */
-      for (int shfl = PTX_VECTOR_LENGTH / 2; shfl > 0; shfl = shfl >> 1)
+      for (int shfl = PTX_WARP_SIZE / 2; shfl > 0; shfl = shfl >> 1)
 	{
 	  tree other_var = make_ssa_name (TREE_TYPE (var));
 	  nvptx_generate_vector_shuffle (gimple_location (call),