This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: New OpenACC pass and Target Hook


On 09/29/2015 08:36 PM, Nathan Sidwell wrote:
This patch implements an openacc device-specific lowering pass, and an
openacc target hook for validating compute dimensions.

The pass 'oaccdevlow' is inserted early after LTO readback.  It is
active for offloaded openacc functions, and openacc routines.  Currently
its only action is to validate the compute dimensions specified for an
offloaded function.
+/* Validate compute dimensions, fill in non-unity defaults.  FN_LEVEL
+   indicates the level at which a routine might spawn a loop.  It is
+   negative for non-routines.  */
+
+static bool
+nvptx_validate_dims (tree ARG_UNUSED (decl), int *ARG_UNUSED (dims),
+		     int ARG_UNUSED (fn_level))

The function name and/or comment should mention OpenACC, it could be confusing otherwise.

I don't know what style to use for unused args now that we have C++. I'm fine with this, and it presumably will be changed anyway.

+DEFHOOK
+(validate_dims,
+"This hook should check the launch dimensions provided.  It should fill\n\
+in anything that needs to default to non-unity and verify non-defaults.\n\
+Defaults are represented as -1.  Diagnostics should be issued as\n\
+appropriate.  Return true if changes have been made.  You must override\n\
+this hook to provide dimensions larger than 1.",
+bool, (tree decl, int dims[], int fn_level),
+default_goacc_validate_dims)

I feel the documentation should be expanded to say what FN_LEVEL does. I guess it's one of gang/worker/vector. Without real code to look at yet I'm left wondering how the hook would use it.

It sounds like this is for both omp-low created child functions, and also for acc routine functions. That should be documented here.

+bool
+default_goacc_validate_dims (tree ARG_UNUSED (decl), int *ARG_UNUSED (dims),
+			     int ARG_UNUSED (fn_level))

dims is not unused in this function.

Otherwise it looks ok to me.


Bernd


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]