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: [PATCH] Merging Cilk Plus into Trunk (Patch 1 of approximately 22)


On Sun, Sep 9, 2012 at 8:02 PM, Iyer, Balaji V <balaji.v.iyer@intel.com> wrote:
> Hello Joseph,
>         Here is an updated patch. I think I have fixed all the changes you and others have mentioned. Please let me know if everything looks OK. Thanks again for doing the review!

The ChangeLog still mentions the vectorizer looking at flag_cilk_plus.  Also
this patch does not contain a single testcase and thus all codepaths are
not exercised when bootstrapping and testing.

You do not mention how this feature works from an ABI perspective.

I don't think this is anywere ready to go in.  Please split it into
two parts at least,
part one would be to make the vectorizer support vectorizing functions with
the "elemental function" attribute by assuming a vectorized variant with
documented mangling exists.  That feature should work regardless of whether
Cilk+ is enabled or not.  The mangling needs to be documented alongside
the documentation for the "elemental funciton" attribute.  Part two would be
the rest, possibly re-implemented in the way that was suggested.

Thanks,
Richard.

> Sincerely,
>
> Balaji V. Iyer.
>
> Here are the fixed ChangeLog entries:
>
> ============================================================================================
> gcc/ChangeLog
> 2012-09-09  Balaji V. Iyer  <balaji.v.iyer@intel.com>
>
>         * attribs.c (is_elem_fn_attribute_p): New function.
>         (decl_attributes): Added a check for Elemental function attribute when
>         Cilk Plus is enabled.
>         * cgraphunit.c (cgraph_decide_is_function_needed): Added a check for
>         cloned elemental function when Cilk Plus is enabled.
>         (cgraph_add_new_function): When Cilk Plus is enabled we call
>         cgraph_get_create_node.
>         (cgraph_analyze_functions): Added a check if the function call is a
>         cloned elemental function when Cilk Plus is enabled.
>         * cilkplus.h: New file.
>         * elem-function-common.c: Likewise.
>         * config/i386/i386.c (ix86_cilkplus_map_proc_to_attr): New function.
>         (TARGET_CILKPLUS_BUILTIN_MAP_PROCESSOR_TO_ATTR): New define.
>         * expr.c (expand_expr_real_1): Added a check if Cilk Plus is enabled.
>         * function.h (struct function): Added elem_fn_already_cloned field.
>         * gimplify.c (gimplify_function_tree): Added a check if Cilk Plus is
>         enabled and if the function is an elemental function.  If so, then call
>         the function to clone elemental function.
>         * langhooks.c (lhd_elem_fn_create_fn): New function.
>         * langhooks-def.h (LANG_HOOKS_CILKPLUS): New define.
>         (LANG_HOOK_DECLS): Added LANG_HOOKS_CILKPLUS field.
>         * langhooks.h (struct lang_hooks_for_cilkplus): New struct.
>         (struct lang_hooks): Added a field called cilkplus.
>         * target.def (TARGET_CILKPLUS): New hook vector.
>         (builtin_map_processor_to_attr): New target hook def.
>         * targhooks.c (default_builtin_map_processor_to_attr): New function.
>         * doc/tm.texi: Regenerated.
>         * doc/tm.texi.in (TARGET_CILKPLUS_BUILTIN_MAP_PROCESSOR_TO_ATTR): Documented
>         new hook.
>         * tree.h (tree_function_decl): Added a new field called
>         elem_fn_already_cloned.
>         (DECL_ELEM_FN_ALREADY_CLONED): New define.
>         * tree-data-ref.c (find_data_references_in_stmt): Added a check for
>         an elemental function call when Cilk Plus is enabled.
>         * tree-inline.c (elem_fn_copy_arguments_for_versioning): New function.
>         (initialize_elem_fn_cfun): Likewise.
>         (tree_elem_fn_versioning): Likewise.
>         * tree-vect-stmts.c (vect_get_vec_def_for_operand): Check parm type for
>         an elemental function when Cilk Plus is enabled and set data definition
>         accordingly.
>         (elem_fn_vect_get_vec_def_for_operand): New function.
>         (vect_finish_stmt_generation): Added a check for elemental function.
>         (vectorizable_function): Check if the function call is a Cilk Plus
>         elemental function.  If so, then insert the appopriate mangled name.
>         (vectorizable_call): Eliminate the argument requirement when Cilk Plus
>         is enabled for vectorization.  Also, set thee appropriate data def. for
>         an elemental function call.
>         (elem_fn_linear_init_vector): New function.
>         * tree.c (build_elem_fn_linear_vector): Likewise.
>
> gcc/c-family/ChangeLog
> 2012-09-09  Balaji V. Iyer  <balaji.v.iyer@intel.com>
>
>         * c-common.c (struct c_common_attribute_table): Added vector
>         attribute for Cilk Plus elemental function.
>         (handle_vector_atribute): New function.
>         * c-cpp-elem-function.c: New file.
>         * c.opt (-fcilkplus): Added new flag.
>
> gcc/c/ChangeLog
> 2012-09-09  Balaji V. Iyer  <balaji.v.iyer@intel.com>
>
>         * c-decl.c (bind): Added a check for non NULL scope.
>         * c-parser.c (c_parser_declaration_or_fndef): Added a check if Cilk
>         Plus defined.  If so, then we save the arguments for a function
>         declaration.
>         (c_parser_attributes): Added a check if Cilk Plus is enabled and if
>         elemental function vector attribute is given.  If so, then call the
>         function c_parser_elem_fn_expr_list ().
>         (c_parser_elem_fn_processor_clause): New function.
>         (c_parser_elem_fn_uniform_clause): Likewise.
>         (c_parser_elem_fn_linear_clause): Likewise.
>         (c_parser_elem_fn_vlength_clause): Likewise.
>         (c_parser_elem_fn_expr_list): Likewise.
>
> ===========================================================================================
>
>
>>-----Original Message-----
>>From: Joseph Myers [mailto:joseph@codesourcery.com]
>>Sent: Thursday, September 06, 2012 12:18 PM
>>To: Iyer, Balaji V
>>Cc: gcc-patches@gcc.gnu.org; Aldy Hernandez (aldyh@redhat.com); Jeff Law;
>>rth@redhat.com
>>Subject: RE: [PATCH] Merging Cilk Plus into Trunk (Patch 1 of approximately 22)
>>
>>On Thu, 6 Sep 2012, Iyer, Balaji V wrote:
>>
>>> Ok, I was mistaken there. I thought we had to add a changelog entry
>>> for every function and not every file. I will fix it in the updated
>>> patch I send soon.
>>
>>For functions in existing files you do need to mention each function - but not for
>>new files.
>>
>>> >create_processor_attribute contains hardcoded references to
>>> >x86-specific functionality.  This is not OK; all such target
>>> >dependencies need to be kept within the back ends, and handled from
>>> >the rest of the compiler via target hooks (in most cases, new target
>>dependencies must use target hooks not target macros).
>>>
>>> The only thing I am doing in that function is to add appropriate
>>> attribute. In elemental function, there is a processor clause that
>>> will allow users to set the type of processor they want the function
>>> compiled for. All I am doing is to map that information to the appropriate
>>"arch"
>>> attribute. I didn't think it had any back end pecularity.
>>
>>Concepts such as "pentium_4" are architecture-specific and have no place in
>>front-end files.  This whole mapping from one sort of string to another belongs
>>within the back end.
>>
>>--
>>Joseph S. Myers
>>joseph@codesourcery.com


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