public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][Cilkplus] Fix pragma simd info being lost
@ 2012-12-14  4:59 Iyer, Balaji V
  2012-12-14 16:59 ` Jakub Jelinek
  0 siblings, 1 reply; 6+ messages in thread
From: Iyer, Balaji V @ 2012-12-14  4:59 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 356 bytes --]

Hello Everyone,
	This patch is for the Cilk Plus branch mainly affecting both C and C++ compilers. Some of the pragma simd structure's indices were getting lost and this patch will restore them. It will also insert the appropriate error messages when assert (in pragma simd) is requested in some places that were omitted.

Thanks,

Balaji V. Iyer.


[-- Attachment #2: patch_fix_p_simd_index.txt --]
[-- Type: text/plain, Size: 17452 bytes --]

Index: ChangeLog.cilkplus
===================================================================
--- ChangeLog.cilkplus	(revision 194483)
+++ ChangeLog.cilkplus	(working copy)
@@ -1,3 +1,17 @@
+2012-12-13  Balaji V. Iyer  <balaji.v.iyer@intel.com>
+
+	* tree-vect-loop.c (vect_determine_vectorization_factor): Added a
+	check if assert is requested in simd pragma.
+	(vect_analyze_loop_form): Likewise.
+	(vect_analyze_loop_operations): Likewise.
+	(vect_analyze_loop): Likewise.
+	* tree-cfgcleanup.c (remove_forwarder_block): Copied the pragma
+	simd struct index from the removed bb to the destination basic block.
+	* cfgloop.c (flow_loops_find): Added flag_enable_cilk check.
+	* tree-cfg.c (gimple_merge_blocks): Copied the pragma simd struct
+	index from the source to destination.
+	(remove_bb): Likewise.
+
 2012-12-12  Balaji V. Iyer  <balaji.v.iyer@intel.com>
 
 	* c/c-objc-common.h (LANG_HOOKS_CILK_CHECK_CTRL_FLOW): New define.
Index: tree-vect-loop.c
===================================================================
--- tree-vect-loop.c	(revision 194483)
+++ tree-vect-loop.c	(working copy)
@@ -234,8 +234,8 @@
 		  if (flag_enable_cilk && pragma_simd_assert_requested_p
 		      (loop->pragma_simd_index))
 		    {
-		      error ("Loop not vectorized. " 
-			     "Exiting as requested by Pragma SIMD");
+		      fatal_error ("Loop not vectorized. " 
+				   "Exiting as requested by Pragma SIMD");
 		    }
 		  return false;
 		}
@@ -412,8 +412,8 @@
 	      if (flag_enable_cilk && pragma_simd_assert_requested_p 
 		  (loop->pragma_simd_index))
 		{
-		  error ("Loop not vectorized. "
-			 "Exiting as requested by PRAGMA SIMD");
+		  fatal_error ("Loop not vectorized. " 
+			       "Exiting as requested by PRAGMA SIMD");
 		}
 	      return false;
 	    }
@@ -429,8 +429,8 @@
 	      if (flag_enable_cilk && pragma_simd_assert_requested_p 
 		  (loop->pragma_simd_index))
 		{
-		  error ("Loop not vectorized. "
-			 "Exiting as requested by PRAGMA SIMD");
+		  fatal_error ("Loop not vectorized. " 
+			       "Exiting as requested by PRAGMA SIMD");
 		}
 	      return false;
 	    }
@@ -470,8 +470,8 @@
 		  if (flag_enable_cilk && pragma_simd_assert_requested_p 
 		      (loop->pragma_simd_index))
 		    {
-		      error ("Loop not vectorized. "
-			     "Exiting as requested by PRAGMA SIMD");
+		      fatal_error ("Loop not vectorized. " 
+				   "Exiting as requested by PRAGMA SIMD");
 		    }
 		  return false;
 		}
@@ -518,8 +518,8 @@
 	      if (flag_enable_cilk && pragma_simd_assert_requested_p 
 		  (loop->pragma_simd_index))
 		{
-		  error ("Loop not vectorized. "
-			 "Exiting as requested by PRAGMA SIMD");
+		  fatal_error ("Loop not vectorized. " 
+			       "Exiting as requested by PRAGMA SIMD");
 		}
 	      return false;
 	    }
@@ -541,8 +541,8 @@
 	      if (flag_enable_cilk && pragma_simd_assert_requested_p 
 		  (loop->pragma_simd_index))
 		{
-		  error ("Loop not vectorized. "
-			 "Exiting as requested by PRAGMA SIMD");
+		  fatal_error ("Loop not vectorized. " 
+			       "Exiting as requested by PRAGMA SIMD");
 		}
 	      return false;
 	    }
@@ -607,8 +607,8 @@
       if (flag_enable_cilk && pragma_simd_assert_requested_p 
 	  (loop->pragma_simd_index))
 	{
-	  error ("Loop not vectorized. "
-		 "Exiting as requested by Pragma SIMD");
+	  fatal_error ("Loop not vectorized. " 
+		       "Exiting as requested by Pragma SIMD");
 	}
       return false;
     }
@@ -1188,18 +1188,26 @@
         {
           if (dump_enabled_p ())
             dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
-			     "not vectorized: control flow in loop.");
+			     "not vectorized: control flow in loop."); 
+	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
+	      (loop->pragma_simd_index)) 
+	    fatal_error ("Loop not vectorized. " 
+			 "Exiting as requested by Pragma SIMD"); 
           return NULL;
         }
 
       if (empty_block_p (loop->header))
-    {
+	{
           if (dump_enabled_p ())
             dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
 			     "not vectorized: empty loop.");
-      return NULL;
+	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
+	      (loop->pragma_simd_index)) 
+	    fatal_error ("Loop not vectorized. " 
+			 "Exiting as requested by Pragma SIMD"); 
+	  return NULL;
+	}
     }
-    }
   else
     {
       struct loop *innerloop = loop->inner;
@@ -1227,6 +1235,10 @@
 	  if (dump_enabled_p ())
 	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
 			     "not vectorized: multiple nested loops.");
+	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
+	      (loop->pragma_simd_index)) 
+	    fatal_error ("Loop not vectorized. " 
+			 "Exiting as requested by Pragma SIMD"); 
 	  return NULL;
 	}
 
@@ -1237,6 +1249,10 @@
 	  if (dump_enabled_p ())
             dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
 			     "not vectorized: Bad inner loop.");
+	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
+	      (loop->pragma_simd_index)) 
+	    fatal_error ("Loop not vectorized. " 
+			 "Exiting as requested by Pragma SIMD"); 
 	  return NULL;
 	}
 
@@ -1246,6 +1262,10 @@
 	  if (dump_enabled_p ())
 	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, 
 			     "not vectorized: inner-loop count not invariant.");
+	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
+	      (loop->pragma_simd_index)) 
+	    fatal_error ("Loop not vectorized. " 
+			 "Exiting as requested by Pragma SIMD"); 
 	  destroy_loop_vec_info (inner_loop_vinfo, true);
 	  return NULL;
 	}
@@ -1255,6 +1275,10 @@
 	  if (dump_enabled_p ())
 	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
 			     "not vectorized: control flow in loop.");
+	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
+	      (loop->pragma_simd_index)) 
+	    fatal_error ("Loop not vectorized. " 
+			 "Exiting as requested by Pragma SIMD"); 
 	  destroy_loop_vec_info (inner_loop_vinfo, true);
 	  return NULL;
         }
@@ -1271,6 +1295,10 @@
 	  if (dump_enabled_p ())
 	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, 
 			     "not vectorized: unsupported outerloop form.");
+	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
+	      (loop->pragma_simd_index)) 
+	    fatal_error ("Loop not vectorized. " 
+			 "Exiting as requested by Pragma SIMD"); 
 	  destroy_loop_vec_info (inner_loop_vinfo, true);
 	  return NULL;
 	}
@@ -1286,11 +1314,21 @@
       if (dump_enabled_p ())
         {
           if (!single_exit (loop))
-	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
-			     "not vectorized: multiple exits.");
+	    { 
+	      dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, 
+			       "not vectorized: multiple exits."); 
+	      if (flag_enable_cilk && pragma_simd_assert_requested_p 
+		  (loop->pragma_simd_index)) 
+		fatal_error ("Loop not vectorized. " 
+			     "Exiting as requested by Pragma SIMD"); 
+	    }
           else if (EDGE_COUNT (loop->header->preds) != 2)
 	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, 
 			     "not vectorized: too many incoming edges.");
+	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
+	      (loop->pragma_simd_index)) 
+	    fatal_error ("Loop not vectorized. " 
+			 "Exiting as requested by Pragma SIMD"); 
         }
       if (inner_loop_vinfo)
 	destroy_loop_vec_info (inner_loop_vinfo, true);
@@ -1307,6 +1345,10 @@
       if (dump_enabled_p ())
 	dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
 			 "not vectorized: unexpected loop form.");
+	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
+	      (loop->pragma_simd_index)) 
+	    fatal_error ("Loop not vectorized. " 
+			 "Exiting as requested by Pragma SIMD"); 
       if (inner_loop_vinfo)
 	destroy_loop_vec_info (inner_loop_vinfo, true);
       return NULL;
@@ -1327,6 +1369,10 @@
 	  if (dump_enabled_p ())
 	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, 
 			     "not vectorized: abnormal loop exit edge.");
+	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
+	      (loop->pragma_simd_index)) 
+	    fatal_error ("Loop not vectorized. " 
+			 "Exiting as requested by Pragma SIMD"); 
 	  if (inner_loop_vinfo)
 	    destroy_loop_vec_info (inner_loop_vinfo, true);
 	  return NULL;
@@ -1339,6 +1385,10 @@
       if (dump_enabled_p ())
 	dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, 
 			 "not vectorized: complicated exit condition.");
+	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
+	      (loop->pragma_simd_index)) 
+	    fatal_error ("Loop not vectorized. " 
+			 "Exiting as requested by Pragma SIMD"); 
       if (inner_loop_vinfo)
 	destroy_loop_vec_info (inner_loop_vinfo, true);
       return NULL;
@@ -1350,6 +1400,10 @@
 	dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, 
 			 "not vectorized: number of iterations cannot be "
 			 "computed.");
+	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
+	      (loop->pragma_simd_index)) 
+	    fatal_error ("Loop not vectorized. " 
+			 "Exiting as requested by Pragma SIMD"); 
       if (inner_loop_vinfo)
 	destroy_loop_vec_info (inner_loop_vinfo, true);
       return NULL;
@@ -1379,6 +1433,10 @@
       if (dump_enabled_p ())
 	dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
 			 "not vectorized: number of iterations = 0.");
+	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
+	      (loop->pragma_simd_index)) 
+	    fatal_error ("Loop not vectorized. " 
+			 "Exiting as requested by Pragma SIMD"); 
       if (inner_loop_vinfo)
         destroy_loop_vec_info (inner_loop_vinfo, false);
       return NULL;
@@ -1540,6 +1598,10 @@
               if (dump_enabled_p ())
 		dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
 				 "not vectorized: value used after loop.");
+	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
+	      (loop->pragma_simd_index)) 
+	    fatal_error ("Loop not vectorized. " 
+			 "Exiting as requested by Pragma SIMD"); 
               return false;
             }
 
@@ -1550,6 +1612,10 @@
               if (dump_enabled_p ())
 		dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, 
 				 "not vectorized: scalar dependence cycle.");
+	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
+	      (loop->pragma_simd_index)) 
+	    fatal_error ("Loop not vectorized. " 
+			 "Exiting as requested by Pragma SIMD"); 
               return false;
             }
 
@@ -1568,6 +1634,10 @@
 				   "not vectorized: relevant phi not "
 				   "supported: ");
                   dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, phi, 0);
+		  if (flag_enable_cilk && pragma_simd_assert_requested_p 
+		      (loop->pragma_simd_index)) 
+		    fatal_error ("Loop not vectorized. " 
+				 "Exiting as requested by Pragma SIMD"); 
                 }
 	      return false;
             }
@@ -1595,6 +1665,10 @@
 	dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, 
 			 "not vectorized: redundant loop. no profit to "
 			 "vectorize.");
+      if (flag_enable_cilk && pragma_simd_assert_requested_p 
+	  (loop->pragma_simd_index)) 
+	fatal_error ("Loop not vectorized. " 
+		     "Exiting as requested by Pragma SIMD"); 
       return false;
     }
 
@@ -1616,6 +1690,10 @@
 	dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
 			 "not vectorized: iteration count smaller than "
 			 "vectorization factor.");
+      if (flag_enable_cilk && pragma_simd_assert_requested_p 
+	  (loop->pragma_simd_index)) 
+	fatal_error ("Loop not vectorized. " 
+		     "Exiting as requested by Pragma SIMD"); 
       return false;
     }
 
@@ -1638,6 +1716,10 @@
 	dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, 
 			 "not vectorized: vector version will never be "
 			 "profitable.");
+      if (flag_enable_cilk && pragma_simd_assert_requested_p 
+	  (loop->pragma_simd_index)) 
+	fatal_error ("Loop not vectorized. " 
+		     "Exiting as requested by Pragma SIMD"); 
       return false;
     }
 
@@ -1665,6 +1747,10 @@
 			 "not vectorized: iteration count smaller than user "
 			 "specified loop bound parameter or minimum profitable "
 			 "iterations (whichever is more conservative).");
+      if (flag_enable_cilk && pragma_simd_assert_requested_p 
+	  (loop->pragma_simd_index)) 
+	fatal_error ("Loop not vectorized. " 
+		     "Exiting as requested by Pragma SIMD"); 
       return false;
     }
 
@@ -1682,6 +1768,10 @@
                          "than specified loop bound parameter or minimum "
                          "profitable iterations (whichever is more "
                          "conservative).");
+      if (flag_enable_cilk && pragma_simd_assert_requested_p 
+	  (loop->pragma_simd_index)) 
+	fatal_error ("Loop not vectorized. " 
+		     "Exiting as requested by Pragma SIMD"); 
       return false;
     }
 
@@ -1696,6 +1786,10 @@
           if (dump_enabled_p ())
 	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, 
 			     "not vectorized: can't create epilog loop 1.");
+	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
+	      (loop->pragma_simd_index)) 
+	    fatal_error ("Loop not vectorized. " 
+			 "Exiting as requested by Pragma SIMD"); 
           return false;
         }
       if (!slpeel_can_duplicate_loop_p (loop, single_exit (loop)))
@@ -1703,6 +1797,10 @@
           if (dump_enabled_p ())
 	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, 
 			     "not vectorized: can't create epilog loop 2.");
+	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
+	      (loop->pragma_simd_index)) 
+	    fatal_error ("Loop not vectorized. " 
+			 "Exiting as requested by Pragma SIMD"); 
           return false;
         }
     }
@@ -1735,7 +1833,7 @@
     {
       if (dump_enabled_p ())
 	dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
-			 "bad data references.");
+			 "bad data references."); 
       return false;
     }
 
@@ -1903,6 +2001,13 @@
 	  if (dump_enabled_p ())
 	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
 			     "bad loop form.");
+	  if (flag_enable_cilk && pragma_simd_assert_requested_p
+	      (loop->pragma_simd_index))
+	    {
+	      fatal_error ("Loop not vectorized. " 
+			   "Exiting as requested by Pragma SIMD");
+	    }
+
 	  return NULL;
 	}
 
@@ -1918,8 +2023,13 @@
       vector_sizes &= ~current_vector_size;
       if (vector_sizes == 0
 	  || current_vector_size == 0)
-	return NULL;
-
+	{ 
+	  if (flag_enable_cilk 
+	      && pragma_simd_assert_requested_p (loop->pragma_simd_index)) 
+	    fatal_error ("Loop not vectorized. " 
+			 "Exiting as requested by Pragma SIMD"); 
+	  return NULL;
+	}
       /* Try the next biggest vector size.  */
       current_vector_size = 1 << floor_log2 (vector_sizes);
       if (dump_enabled_p ())
Index: tree-cfgcleanup.c
===================================================================
--- tree-cfgcleanup.c	(revision 194483)
+++ tree-cfgcleanup.c	(working copy)
@@ -346,6 +346,11 @@
   if (dest == bb)
     return false;
 
+  if (flag_enable_cilk && bb->pragma_simd_index != 0
+      && (dest->pragma_simd_index == 0
+	  || dest->pragma_simd_index == INVALID_PRAGMA_SIMD_SLOT))
+    dest->pragma_simd_index = bb->pragma_simd_index;
+
   /* If the destination block consists of a nonlocal label or is a
      EH landing pad, do not merge it.  */
   label = first_stmt (dest);
Index: cfgloop.c
===================================================================
--- cfgloop.c	(revision 194483)
+++ cfgloop.c	(working copy)
@@ -423,8 +423,11 @@
 	      bitmap_set_bit (headers, header->index);
               /* Here we are going to copy the pragma simd value from 
 		 the latch to the header.  */
-              if ((header->pragma_simd_index == 0)  
-		  && (latch->pragma_simd_index  != 0)) 
+              if (flag_enable_cilk 
+		  && (header->pragma_simd_index == 0 
+		      || header->pragma_simd_index == INVALID_PRAGMA_SIMD_SLOT)
+		  && (latch->pragma_simd_index  != 0 
+		      || latch->pragma_simd_index != INVALID_PRAGMA_SIMD_SLOT))
 		header->pragma_simd_index = latch->pragma_simd_index;
 	      num_loops++;
 	    }
@@ -466,7 +469,8 @@
 
 	  loop->header = header;
 	  loop->num = num_loops;
-	  loop->pragma_simd_index = header->pragma_simd_index;
+	  if (flag_enable_cilk)
+	    loop->pragma_simd_index = header->pragma_simd_index;
 
 	  num_loops++;
 
Index: tree-cfg.c
===================================================================
--- tree-cfg.c	(revision 194483)
+++ tree-cfg.c	(working copy)
@@ -1631,6 +1631,11 @@
   if (dump_file)
     fprintf (dump_file, "Merging blocks %d and %d\n", a->index, b->index);
 
+  if (flag_enable_cilk && b->pragma_simd_index != 0
+      && (a->pragma_simd_index == 0
+	  || a->pragma_simd_index == INVALID_PRAGMA_SIMD_SLOT))
+    a->pragma_simd_index = b->pragma_simd_index;
+
   /* Remove all single-valued PHI nodes from block B of the form
      V_i = PHI <V_j> by propagating V_j to all the uses of V_i.  */
   gsi = gsi_last_bb (a);
@@ -1897,7 +1902,11 @@
   remove_phi_nodes_and_edges_for_unreachable_block (bb);
   bb->il.gimple.seq = NULL;
   bb->il.gimple.phi_nodes = NULL;
-  bb->next_bb->pragma_simd_index = bb->pragma_simd_index;
+  if (flag_enable_cilk 
+      && bb->next_bb->pragma_simd_index == 0
+      && bb->pragma_simd_index != 0 
+      && bb->pragma_simd_index != INVALID_PRAGMA_SIMD_SLOT)
+    bb->next_bb->pragma_simd_index = bb->pragma_simd_index;
 }
 
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][Cilkplus] Fix pragma simd info being lost
  2012-12-14  4:59 [PATCH][Cilkplus] Fix pragma simd info being lost Iyer, Balaji V
@ 2012-12-14 16:59 ` Jakub Jelinek
  2012-12-14 17:02   ` Iyer, Balaji V
  0 siblings, 1 reply; 6+ messages in thread
From: Jakub Jelinek @ 2012-12-14 16:59 UTC (permalink / raw)
  To: Iyer, Balaji V; +Cc: gcc-patches

On Fri, Dec 14, 2012 at 04:59:02AM +0000, Iyer, Balaji V wrote:
> --- tree-vect-loop.c	(revision 194483)
> +++ tree-vect-loop.c	(working copy)
> @@ -234,8 +234,8 @@
>  		  if (flag_enable_cilk && pragma_simd_assert_requested_p
>  		      (loop->pragma_simd_index))
>  		    {
> -		      error ("Loop not vectorized. " 
> -			     "Exiting as requested by Pragma SIMD");
> +		      fatal_error ("Loop not vectorized. " 
> +				   "Exiting as requested by Pragma SIMD");
>  		    }
>  		  return false;
>  		}

Why do you think fatal_error is the right thing here?  Why doesn't normal
error work?  Generally, if one function contains 10 #pragma simd loops that
require vectorization and 5 out of them aren't vectorized, it is nicer for
users to be told about all 5 of them, rather than just the first one.
fatal_error will exit immediately.

	Jakub

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH][Cilkplus] Fix pragma simd info being lost
  2012-12-14 16:59 ` Jakub Jelinek
@ 2012-12-14 17:02   ` Iyer, Balaji V
  2012-12-14 17:09     ` Jakub Jelinek
  0 siblings, 1 reply; 6+ messages in thread
From: Iyer, Balaji V @ 2012-12-14 17:02 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

Hello Jakub,
	Please see my responses below.

Thanks,

Balaji V. Iyer.

> -----Original Message-----
> From: Jakub Jelinek [mailto:jakub@redhat.com]
> Sent: Friday, December 14, 2012 11:59 AM
> To: Iyer, Balaji V
> Cc: gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH][Cilkplus] Fix pragma simd info being lost
> 
> On Fri, Dec 14, 2012 at 04:59:02AM +0000, Iyer, Balaji V wrote:
> > --- tree-vect-loop.c	(revision 194483)
> > +++ tree-vect-loop.c	(working copy)
> > @@ -234,8 +234,8 @@
> >  		  if (flag_enable_cilk && pragma_simd_assert_requested_p
> >  		      (loop->pragma_simd_index))
> >  		    {
> > -		      error ("Loop not vectorized. "
> > -			     "Exiting as requested by Pragma SIMD");
> > +		      fatal_error ("Loop not vectorized. "
> > +				   "Exiting as requested by Pragma SIMD");
> >  		    }
> >  		  return false;
> >  		}
> 
> Why do you think fatal_error is the right thing here?  Why doesn't normal error
> work?  Generally, if one function contains 10 #pragma simd loops that require
> vectorization and 5 out of them aren't vectorized, it is nicer for users to be told
> about all 5 of them, rather than just the first one.
> fatal_error will exit immediately.

The #pragma simd assert requires the compiler to halt compilation if the loop is not vectorized. This is why I used fatal_error. The default case is noassert.


> 
> 	Jakub

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][Cilkplus] Fix pragma simd info being lost
  2012-12-14 17:02   ` Iyer, Balaji V
@ 2012-12-14 17:09     ` Jakub Jelinek
  2012-12-14 19:38       ` Iyer, Balaji V
  2012-12-18 18:04       ` Iyer, Balaji V
  0 siblings, 2 replies; 6+ messages in thread
From: Jakub Jelinek @ 2012-12-14 17:09 UTC (permalink / raw)
  To: Iyer, Balaji V; +Cc: gcc-patches

On Fri, Dec 14, 2012 at 05:01:48PM +0000, Iyer, Balaji V wrote:
> > Why do you think fatal_error is the right thing here?  Why doesn't normal error
> > work?  Generally, if one function contains 10 #pragma simd loops that require
> > vectorization and 5 out of them aren't vectorized, it is nicer for users to be told
> > about all 5 of them, rather than just the first one.
> > fatal_error will exit immediately.
> 
> The #pragma simd assert requires the compiler to halt compilation if the
> loop is not vectorized.  This is why I used fatal_error.  The default case
> is noassert.

The compilation is halted even with error, compiler will exit with non-zero
exit status, won't compile any further functions, etc.

	Jakub

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH][Cilkplus] Fix pragma simd info being lost
  2012-12-14 17:09     ` Jakub Jelinek
@ 2012-12-14 19:38       ` Iyer, Balaji V
  2012-12-18 18:04       ` Iyer, Balaji V
  1 sibling, 0 replies; 6+ messages in thread
From: Iyer, Balaji V @ 2012-12-14 19:38 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches



> -----Original Message-----
> From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-
> owner@gcc.gnu.org] On Behalf Of Jakub Jelinek
> Sent: Friday, December 14, 2012 12:09 PM
> To: Iyer, Balaji V
> Cc: gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH][Cilkplus] Fix pragma simd info being lost
> 
> On Fri, Dec 14, 2012 at 05:01:48PM +0000, Iyer, Balaji V wrote:
> > > Why do you think fatal_error is the right thing here?  Why doesn't
> > > normal error work?  Generally, if one function contains 10 #pragma
> > > simd loops that require vectorization and 5 out of them aren't
> > > vectorized, it is nicer for users to be told about all 5 of them, rather than just
> the first one.
> > > fatal_error will exit immediately.
> >
> > The #pragma simd assert requires the compiler to halt compilation if
> > the loop is not vectorized.  This is why I used fatal_error.  The
> > default case is noassert.
> 
> The compilation is halted even with error, compiler will exit with non-zero exit
> status, won't compile any further functions, etc.

OK, I will change them and send out another patch.

> 
> 	Jakub

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH][Cilkplus] Fix pragma simd info being lost
  2012-12-14 17:09     ` Jakub Jelinek
  2012-12-14 19:38       ` Iyer, Balaji V
@ 2012-12-18 18:04       ` Iyer, Balaji V
  1 sibling, 0 replies; 6+ messages in thread
From: Iyer, Balaji V @ 2012-12-18 18:04 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1186 bytes --]



> -----Original Message-----
> From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-
> owner@gcc.gnu.org] On Behalf Of Jakub Jelinek
> Sent: Friday, December 14, 2012 12:09 PM
> To: Iyer, Balaji V
> Cc: gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH][Cilkplus] Fix pragma simd info being lost
> 
> On Fri, Dec 14, 2012 at 05:01:48PM +0000, Iyer, Balaji V wrote:
> > > Why do you think fatal_error is the right thing here?  Why doesn't
> > > normal error work?  Generally, if one function contains 10 #pragma
> > > simd loops that require vectorization and 5 out of them aren't
> > > vectorized, it is nicer for users to be told about all 5 of them, rather than just
> the first one.
> > > fatal_error will exit immediately.
> >
> > The #pragma simd assert requires the compiler to halt compilation if
> > the loop is not vectorized.  This is why I used fatal_error.  The
> > default case is noassert.
> 
> The compilation is halted even with error, compiler will exit with non-zero exit
> status, won't compile any further functions, etc.

Here is a patch where I have replaced all fatal_errors with error_at.

Thanks,

Balaji V. Iyer.

> 
> 	Jakub

[-- Attachment #2: patch_fatal_error_to_error_at.txt --]
[-- Type: text/plain, Size: 14463 bytes --]

Index: gcc/ChangeLog.cilkplus
===================================================================
--- gcc/ChangeLog.cilkplus	(revision 194585)
+++ gcc/ChangeLog.cilkplus	(working copy)
@@ -1,3 +1,11 @@
+2012-12-18  Balaji V. Iyer  <balaji.v.iyer@intel.com>
+
+	* tree-vect-loop.c (vect_determine_vectorization_factor): Replaced all
+	occurances of "fatal_error" with error_at with vect_location.
+	(vect_analyze_loop_form): Likewise.
+	(vect_analyze_loop_operations): Likewise.
+	(vect_analyze_loop): Likewise.
+
 2012-12-16  Balaji V. Iyer  <balaji.v.iyer@intel.com>
 
 	* tree.h (GTY): Added new field in struct called "decl_auto."
Index: gcc/tree-vect-loop.c
===================================================================
--- gcc/tree-vect-loop.c	(revision 194585)
+++ gcc/tree-vect-loop.c	(working copy)
@@ -233,10 +233,8 @@
 		    }
 		  if (flag_enable_cilk && pragma_simd_assert_requested_p
 		      (loop->pragma_simd_index))
-		    {
-		      fatal_error ("Loop not vectorized. " 
-				   "Exiting as requested by Pragma SIMD");
-		    }
+		    error_at (vect_location, "loop not vectorized. " 
+			      "Exiting as requested by Pragma SIMD");
 		  return false;
 		}
 	      /* here we set the linear info */
@@ -411,10 +409,8 @@
 		}
 	      if (flag_enable_cilk && pragma_simd_assert_requested_p 
 		  (loop->pragma_simd_index))
-		{
-		  fatal_error ("Loop not vectorized. " 
-			       "Exiting as requested by PRAGMA SIMD");
-		}
+		error_at (vect_location, "loop not vectorized. " 
+			  "Exiting as requested by PRAGMA SIMD");
 	      return false;
 	    }
 
@@ -428,10 +424,8 @@
 	        }
 	      if (flag_enable_cilk && pragma_simd_assert_requested_p 
 		  (loop->pragma_simd_index))
-		{
-		  fatal_error ("Loop not vectorized. " 
-			       "Exiting as requested by PRAGMA SIMD");
-		}
+		error_at (vect_location, "loop not vectorized. " 
+			  "Exiting as requested by PRAGMA SIMD");
 	      return false;
 	    }
 
@@ -468,11 +462,9 @@
                                          scalar_type);
 		    }
 		  if (flag_enable_cilk && pragma_simd_assert_requested_p 
-		      (loop->pragma_simd_index))
-		    {
-		      fatal_error ("Loop not vectorized. " 
-				   "Exiting as requested by PRAGMA SIMD");
-		    }
+		      (loop->pragma_simd_index)) 
+		    error_at (vect_location, "loop not vectorized. " 
+			      "Exiting as requested by PRAGMA SIMD");   
 		  return false;
 		}
 		/* here we set the linear info */
@@ -517,10 +509,8 @@
 		}
 	      if (flag_enable_cilk && pragma_simd_assert_requested_p 
 		  (loop->pragma_simd_index))
-		{
-		  fatal_error ("Loop not vectorized. " 
-			       "Exiting as requested by PRAGMA SIMD");
-		}
+		error_at (vect_location, "loop not vectorized. " 
+			  "Exiting as requested by PRAGMA SIMD");
 	      return false;
 	    }
 
@@ -540,10 +530,8 @@
 		}
 	      if (flag_enable_cilk && pragma_simd_assert_requested_p 
 		  (loop->pragma_simd_index))
-		{
-		  fatal_error ("Loop not vectorized. " 
-			       "Exiting as requested by PRAGMA SIMD");
-		}
+		error_at (vect_location, "loop not vectorized. " 
+			  "Exiting as requested by PRAGMA SIMD");
 	      return false;
 	    }
 
@@ -606,10 +594,8 @@
 
       if (flag_enable_cilk && pragma_simd_assert_requested_p 
 	  (loop->pragma_simd_index))
-	{
-	  fatal_error ("Loop not vectorized. " 
-		       "Exiting as requested by Pragma SIMD");
-	}
+	error_at (vect_location, "loop not vectorized. " 
+		  "Exiting as requested by Pragma SIMD");	
       return false;
     }
   LOOP_VINFO_VECT_FACTOR (loop_vinfo) = vectorization_factor;
@@ -1191,8 +1177,8 @@
 			     "not vectorized: control flow in loop."); 
 	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
 	      (loop->pragma_simd_index)) 
-	    fatal_error ("Loop not vectorized. " 
-			 "Exiting as requested by Pragma SIMD"); 
+	    error_at (vect_location, "loop not vectorized. " 
+		      "Exiting as requested by Pragma SIMD"); 
           return NULL;
         }
 
@@ -1203,8 +1189,8 @@
 			     "not vectorized: empty loop.");
 	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
 	      (loop->pragma_simd_index)) 
-	    fatal_error ("Loop not vectorized. " 
-			 "Exiting as requested by Pragma SIMD"); 
+	    error_at (vect_location, "loop not vectorized. " 
+		      "Exiting as requested by Pragma SIMD");
 	  return NULL;
 	}
     }
@@ -1237,8 +1223,8 @@
 			     "not vectorized: multiple nested loops.");
 	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
 	      (loop->pragma_simd_index)) 
-	    fatal_error ("Loop not vectorized. " 
-			 "Exiting as requested by Pragma SIMD"); 
+	    error_at (vect_location, "loop not vectorized. " 
+		      "Exiting as requested by Pragma SIMD");
 	  return NULL;
 	}
 
@@ -1251,8 +1237,8 @@
 			     "not vectorized: Bad inner loop.");
 	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
 	      (loop->pragma_simd_index)) 
-	    fatal_error ("Loop not vectorized. " 
-			 "Exiting as requested by Pragma SIMD"); 
+	    error_at (vect_location, "loop not vectorized. " 
+		      "Exiting as requested by Pragma SIMD");
 	  return NULL;
 	}
 
@@ -1264,8 +1250,8 @@
 			     "not vectorized: inner-loop count not invariant.");
 	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
 	      (loop->pragma_simd_index)) 
-	    fatal_error ("Loop not vectorized. " 
-			 "Exiting as requested by Pragma SIMD"); 
+	    error_at (vect_location, "loop not vectorized. " 
+		      "Exiting as requested by Pragma SIMD"); 
 	  destroy_loop_vec_info (inner_loop_vinfo, true);
 	  return NULL;
 	}
@@ -1277,8 +1263,8 @@
 			     "not vectorized: control flow in loop.");
 	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
 	      (loop->pragma_simd_index)) 
-	    fatal_error ("Loop not vectorized. " 
-			 "Exiting as requested by Pragma SIMD"); 
+	    error_at (vect_location, "loop not vectorized. " 
+		      "Exiting as requested by Pragma SIMD"); 
 	  destroy_loop_vec_info (inner_loop_vinfo, true);
 	  return NULL;
         }
@@ -1297,8 +1283,8 @@
 			     "not vectorized: unsupported outerloop form.");
 	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
 	      (loop->pragma_simd_index)) 
-	    fatal_error ("Loop not vectorized. " 
-			 "Exiting as requested by Pragma SIMD"); 
+	    error_at (vect_location, "loop not vectorized. " 
+		      "Exiting as requested by Pragma SIMD"); 
 	  destroy_loop_vec_info (inner_loop_vinfo, true);
 	  return NULL;
 	}
@@ -1319,16 +1305,16 @@
 			       "not vectorized: multiple exits."); 
 	      if (flag_enable_cilk && pragma_simd_assert_requested_p 
 		  (loop->pragma_simd_index)) 
-		fatal_error ("Loop not vectorized. " 
-			     "Exiting as requested by Pragma SIMD"); 
+		error_at (vect_location, "loop not vectorized. " 
+			  "Exiting as requested by Pragma SIMD"); 
 	    }
           else if (EDGE_COUNT (loop->header->preds) != 2)
 	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, 
 			     "not vectorized: too many incoming edges.");
 	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
 	      (loop->pragma_simd_index)) 
-	    fatal_error ("Loop not vectorized. " 
-			 "Exiting as requested by Pragma SIMD"); 
+	    error_at (vect_location, "loop not vectorized. " 
+		      "Exiting as requested by Pragma SIMD"); 
         }
       if (inner_loop_vinfo)
 	destroy_loop_vec_info (inner_loop_vinfo, true);
@@ -1347,8 +1333,8 @@
 			 "not vectorized: unexpected loop form.");
 	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
 	      (loop->pragma_simd_index)) 
-	    fatal_error ("Loop not vectorized. " 
-			 "Exiting as requested by Pragma SIMD"); 
+	    error_at (vect_location, "loop not vectorized. " 
+		      "Exiting as requested by Pragma SIMD"); 
       if (inner_loop_vinfo)
 	destroy_loop_vec_info (inner_loop_vinfo, true);
       return NULL;
@@ -1371,8 +1357,8 @@
 			     "not vectorized: abnormal loop exit edge.");
 	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
 	      (loop->pragma_simd_index)) 
-	    fatal_error ("Loop not vectorized. " 
-			 "Exiting as requested by Pragma SIMD"); 
+	    error_at (vect_location, "loop not vectorized. " 
+		      "Exiting as requested by Pragma SIMD"); 
 	  if (inner_loop_vinfo)
 	    destroy_loop_vec_info (inner_loop_vinfo, true);
 	  return NULL;
@@ -1387,8 +1373,8 @@
 			 "not vectorized: complicated exit condition.");
 	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
 	      (loop->pragma_simd_index)) 
-	    fatal_error ("Loop not vectorized. " 
-			 "Exiting as requested by Pragma SIMD"); 
+	    error_at (vect_location, "loop not vectorized. " 
+		      "Exiting as requested by Pragma SIMD"); 
       if (inner_loop_vinfo)
 	destroy_loop_vec_info (inner_loop_vinfo, true);
       return NULL;
@@ -1402,8 +1388,8 @@
 			 "computed.");
 	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
 	      (loop->pragma_simd_index)) 
-	    fatal_error ("Loop not vectorized. " 
-			 "Exiting as requested by Pragma SIMD"); 
+	    error_at (vect_location, "loop not vectorized. " 
+		      "Exiting as requested by Pragma SIMD"); 
       if (inner_loop_vinfo)
 	destroy_loop_vec_info (inner_loop_vinfo, true);
       return NULL;
@@ -1435,8 +1421,8 @@
 			 "not vectorized: number of iterations = 0.");
 	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
 	      (loop->pragma_simd_index)) 
-	    fatal_error ("Loop not vectorized. " 
-			 "Exiting as requested by Pragma SIMD"); 
+	    error_at (vect_location, "loop not vectorized. " 
+		      "Exiting as requested by Pragma SIMD"); 
       if (inner_loop_vinfo)
         destroy_loop_vec_info (inner_loop_vinfo, false);
       return NULL;
@@ -1600,8 +1586,8 @@
 				 "not vectorized: value used after loop.");
 	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
 	      (loop->pragma_simd_index)) 
-	    fatal_error ("Loop not vectorized. " 
-			 "Exiting as requested by Pragma SIMD"); 
+	    error_at (vect_location, "loop not vectorized. " 
+		      "Exiting as requested by Pragma SIMD"); 
               return false;
             }
 
@@ -1614,8 +1600,8 @@
 				 "not vectorized: scalar dependence cycle.");
 	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
 	      (loop->pragma_simd_index)) 
-	    fatal_error ("Loop not vectorized. " 
-			 "Exiting as requested by Pragma SIMD"); 
+	    error_at (vect_location, "loop not vectorized. " 
+		      "Exiting as requested by Pragma SIMD"); 
               return false;
             }
 
@@ -1636,8 +1622,8 @@
                   dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, phi, 0);
 		  if (flag_enable_cilk && pragma_simd_assert_requested_p 
 		      (loop->pragma_simd_index)) 
-		    fatal_error ("Loop not vectorized. " 
-				 "Exiting as requested by Pragma SIMD"); 
+		    error_at (vect_location, "loop not vectorized. " 
+			      "Exiting as requested by Pragma SIMD"); 
                 }
 	      return false;
             }
@@ -1667,8 +1653,8 @@
 			 "vectorize.");
       if (flag_enable_cilk && pragma_simd_assert_requested_p 
 	  (loop->pragma_simd_index)) 
-	fatal_error ("Loop not vectorized. " 
-		     "Exiting as requested by Pragma SIMD"); 
+	error_at (vect_location, "loop not vectorized. " 
+		  "Exiting as requested by Pragma SIMD"); 
       return false;
     }
 
@@ -1692,8 +1678,8 @@
 			 "vectorization factor.");
       if (flag_enable_cilk && pragma_simd_assert_requested_p 
 	  (loop->pragma_simd_index)) 
-	fatal_error ("Loop not vectorized. " 
-		     "Exiting as requested by Pragma SIMD"); 
+	error_at (vect_location, "loop not vectorized. " 
+		  "Exiting as requested by Pragma SIMD"); 
       return false;
     }
 
@@ -1718,8 +1704,8 @@
 			 "profitable.");
       if (flag_enable_cilk && pragma_simd_assert_requested_p 
 	  (loop->pragma_simd_index)) 
-	fatal_error ("Loop not vectorized. " 
-		     "Exiting as requested by Pragma SIMD"); 
+	error_at (vect_location, "loop not vectorized. " 
+		  "Exiting as requested by Pragma SIMD");
       return false;
     }
 
@@ -1749,8 +1735,8 @@
 			 "iterations (whichever is more conservative).");
       if (flag_enable_cilk && pragma_simd_assert_requested_p 
 	  (loop->pragma_simd_index)) 
-	fatal_error ("Loop not vectorized. " 
-		     "Exiting as requested by Pragma SIMD"); 
+	error_at (vect_location, "loop not vectorized. " 
+		  "Exiting as requested by Pragma SIMD"); 
       return false;
     }
 
@@ -1770,8 +1756,8 @@
                          "conservative).");
       if (flag_enable_cilk && pragma_simd_assert_requested_p 
 	  (loop->pragma_simd_index)) 
-	fatal_error ("Loop not vectorized. " 
-		     "Exiting as requested by Pragma SIMD"); 
+	error_at (vect_location, "loop not vectorized. " 
+		  "Exiting as requested by Pragma SIMD"); 
       return false;
     }
 
@@ -1788,8 +1774,8 @@
 			     "not vectorized: can't create epilog loop 1.");
 	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
 	      (loop->pragma_simd_index)) 
-	    fatal_error ("Loop not vectorized. " 
-			 "Exiting as requested by Pragma SIMD"); 
+	    error_at (vect_location, "loop not vectorized. " 
+		      "Exiting as requested by Pragma SIMD");
           return false;
         }
       if (!slpeel_can_duplicate_loop_p (loop, single_exit (loop)))
@@ -1799,8 +1785,8 @@
 			     "not vectorized: can't create epilog loop 2.");
 	  if (flag_enable_cilk && pragma_simd_assert_requested_p 
 	      (loop->pragma_simd_index)) 
-	    fatal_error ("Loop not vectorized. " 
-			 "Exiting as requested by Pragma SIMD"); 
+	    error_at (vect_location, "loop not vectorized. " 
+		      "Exiting as requested by Pragma SIMD");
           return false;
         }
     }
@@ -2003,10 +1989,9 @@
 			     "bad loop form.");
 	  if (flag_enable_cilk && pragma_simd_assert_requested_p
 	      (loop->pragma_simd_index))
-	    {
-	      fatal_error ("Loop not vectorized. " 
-			   "Exiting as requested by Pragma SIMD");
-	    }
+	    error_at (vect_location, "loop not vectorized. "
+		      "Exiting as requested by Pragma SIMD");
+	    
 
 	  return NULL;
 	}
@@ -2026,8 +2011,8 @@
 	{ 
 	  if (flag_enable_cilk 
 	      && pragma_simd_assert_requested_p (loop->pragma_simd_index)) 
-	    fatal_error ("Loop not vectorized. " 
-			 "Exiting as requested by Pragma SIMD"); 
+	    error_at (vect_location, "loop not vectorized. " 
+		      "Exiting as requested by Pragma SIMD"); 
 	  return NULL;
 	}
       /* Try the next biggest vector size.  */

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-12-18 18:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-14  4:59 [PATCH][Cilkplus] Fix pragma simd info being lost Iyer, Balaji V
2012-12-14 16:59 ` Jakub Jelinek
2012-12-14 17:02   ` Iyer, Balaji V
2012-12-14 17:09     ` Jakub Jelinek
2012-12-14 19:38       ` Iyer, Balaji V
2012-12-18 18:04       ` Iyer, Balaji V

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).