Re: [PATCH] More compile-time saving in BB vectorization
On 12 November 2015 at 21:04, Christophe Lyon wrote: > On 12 November 2015 at 16:49, Andreas Schwab wrote: >> Richard Biener writes: >> >>> * tree-vectorizer.h (vect_slp_analyze_and_verify_instance_alignment): >>> Declare. >>> (vect_analyze_data_refs_alignment): Make loop vect specific. >>> (vect_verify_datarefs_alignment): Likewise. >>> * tree-vect-data-refs.c (vect_slp_analyze_data_ref_dependences): >>> Add missing continue. >>> (vect_compute_data_ref_alignment): Export. >>> (vect_compute_data_refs_alignment): Merge into... >>> (vect_analyze_data_refs_alignment): ... this. >>> (verify_data_ref_alignment): Split out from ... >>> (vect_verify_datarefs_alignment): ... here. >>> (vect_slp_analyze_and_verify_node_alignment): New function. >>> (vect_slp_analyze_and_verify_instance_alignment): Likewise. >>> * tree-vect-slp.c (vect_supported_load_permutation_p): Remove >>> misplaced checks on alignment. >>> (vect_slp_analyze_bb_1): Add fatal output parameter. Do >>> alignment analysis after SLP discovery and do it per instance. >>> (vect_slp_bb): When vect_slp_analyze_bb_1 fatally failed do not >>> bother to re-try using different vector sizes. >> >> This breaks libgfortran on ia64: >> >> ../../../libgfortran/generated/matmul_c4.c: In function 'matmul_c4': >> ../../../libgfortran/generated/matmul_c4.c:79:1: internal compiler error: in >> vectorizable_store, at tree-vect-stmts.c:5651 >> matmul_c4 (gfc_array_c4 * const restrict retarray, >> ^ >> 0x410ff01f vectorizable_store >> ../../gcc/tree-vect-stmts.c:5651 >> 0x41115b5f vect_transform_stmt(gimple*, gimple_stmt_iterator*, >> bool*, _slp_tree*, _slp_instance*) >> ../../gcc/tree-vect-stmts.c:8003 >> 0x4114df1f vect_schedule_slp_instance >> ../../gcc/tree-vect-slp.c:3484 >> 0x41154d6f vect_schedule_slp(vec_info*) >> ../../gcc/tree-vect-slp.c:3549 >> 0x411562bf vect_slp_bb(basic_block_def*) >> ../../gcc/tree-vect-slp.c:2543 >> 0x41159f2f execute >> ../../gcc/tree-vectorizer.c:734 >> > > Same problem on armeb. > Now fixed at r230260 (pr68308). Thanks. > >> Andreas. >> >> -- >> Andreas Schwab, SUSE Labs, sch...@suse.de >> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 >> "And now for something completely different."
Re: [PATCH] More compile-time saving in BB vectorization
On 12 November 2015 at 16:49, Andreas Schwab wrote: > Richard Biener writes: > >> * tree-vectorizer.h (vect_slp_analyze_and_verify_instance_alignment): >> Declare. >> (vect_analyze_data_refs_alignment): Make loop vect specific. >> (vect_verify_datarefs_alignment): Likewise. >> * tree-vect-data-refs.c (vect_slp_analyze_data_ref_dependences): >> Add missing continue. >> (vect_compute_data_ref_alignment): Export. >> (vect_compute_data_refs_alignment): Merge into... >> (vect_analyze_data_refs_alignment): ... this. >> (verify_data_ref_alignment): Split out from ... >> (vect_verify_datarefs_alignment): ... here. >> (vect_slp_analyze_and_verify_node_alignment): New function. >> (vect_slp_analyze_and_verify_instance_alignment): Likewise. >> * tree-vect-slp.c (vect_supported_load_permutation_p): Remove >> misplaced checks on alignment. >> (vect_slp_analyze_bb_1): Add fatal output parameter. Do >> alignment analysis after SLP discovery and do it per instance. >> (vect_slp_bb): When vect_slp_analyze_bb_1 fatally failed do not >> bother to re-try using different vector sizes. > > This breaks libgfortran on ia64: > > ../../../libgfortran/generated/matmul_c4.c: In function 'matmul_c4': > ../../../libgfortran/generated/matmul_c4.c:79:1: internal compiler error: in > vectorizable_store, at tree-vect-stmts.c:5651 > matmul_c4 (gfc_array_c4 * const restrict retarray, > ^ > 0x410ff01f vectorizable_store > ../../gcc/tree-vect-stmts.c:5651 > 0x41115b5f vect_transform_stmt(gimple*, gimple_stmt_iterator*, bool*, > _slp_tree*, _slp_instance*) > ../../gcc/tree-vect-stmts.c:8003 > 0x4114df1f vect_schedule_slp_instance > ../../gcc/tree-vect-slp.c:3484 > 0x41154d6f vect_schedule_slp(vec_info*) > ../../gcc/tree-vect-slp.c:3549 > 0x411562bf vect_slp_bb(basic_block_def*) > ../../gcc/tree-vect-slp.c:2543 > 0x41159f2f execute > ../../gcc/tree-vectorizer.c:734 > Same problem on armeb. > Andreas. > > -- > Andreas Schwab, SUSE Labs, sch...@suse.de > GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 > "And now for something completely different."
Re: [PATCH] More compile-time saving in BB vectorization
Richard Biener writes: > * tree-vectorizer.h (vect_slp_analyze_and_verify_instance_alignment): > Declare. > (vect_analyze_data_refs_alignment): Make loop vect specific. > (vect_verify_datarefs_alignment): Likewise. > * tree-vect-data-refs.c (vect_slp_analyze_data_ref_dependences): > Add missing continue. > (vect_compute_data_ref_alignment): Export. > (vect_compute_data_refs_alignment): Merge into... > (vect_analyze_data_refs_alignment): ... this. > (verify_data_ref_alignment): Split out from ... > (vect_verify_datarefs_alignment): ... here. > (vect_slp_analyze_and_verify_node_alignment): New function. > (vect_slp_analyze_and_verify_instance_alignment): Likewise. > * tree-vect-slp.c (vect_supported_load_permutation_p): Remove > misplaced checks on alignment. > (vect_slp_analyze_bb_1): Add fatal output parameter. Do > alignment analysis after SLP discovery and do it per instance. > (vect_slp_bb): When vect_slp_analyze_bb_1 fatally failed do not > bother to re-try using different vector sizes. This breaks libgfortran on ia64: ../../../libgfortran/generated/matmul_c4.c: In function 'matmul_c4': ../../../libgfortran/generated/matmul_c4.c:79:1: internal compiler error: in vectorizable_store, at tree-vect-stmts.c:5651 matmul_c4 (gfc_array_c4 * const restrict retarray, ^ 0x410ff01f vectorizable_store ../../gcc/tree-vect-stmts.c:5651 0x41115b5f vect_transform_stmt(gimple*, gimple_stmt_iterator*, bool*, _slp_tree*, _slp_instance*) ../../gcc/tree-vect-stmts.c:8003 0x4114df1f vect_schedule_slp_instance ../../gcc/tree-vect-slp.c:3484 0x41154d6f vect_schedule_slp(vec_info*) ../../gcc/tree-vect-slp.c:3549 0x411562bf vect_slp_bb(basic_block_def*) ../../gcc/tree-vect-slp.c:2543 0x41159f2f execute ../../gcc/tree-vectorizer.c:734 Andreas. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."
[PATCH] More compile-time saving in BB vectorization
This saves some more compile-time avoiding vector size iteration for trivial fails. It also improves time spent by not giving up completely for all SLP instances if one fails to vectorize because of alignment issues. And it sneaks in a correctness fix for a previous change. Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. Richard. 2015-11-11 Richard Biener * tree-vectorizer.h (vect_slp_analyze_and_verify_instance_alignment): Declare. (vect_analyze_data_refs_alignment): Make loop vect specific. (vect_verify_datarefs_alignment): Likewise. * tree-vect-data-refs.c (vect_slp_analyze_data_ref_dependences): Add missing continue. (vect_compute_data_ref_alignment): Export. (vect_compute_data_refs_alignment): Merge into... (vect_analyze_data_refs_alignment): ... this. (verify_data_ref_alignment): Split out from ... (vect_verify_datarefs_alignment): ... here. (vect_slp_analyze_and_verify_node_alignment): New function. (vect_slp_analyze_and_verify_instance_alignment): Likewise. * tree-vect-slp.c (vect_supported_load_permutation_p): Remove misplaced checks on alignment. (vect_slp_analyze_bb_1): Add fatal output parameter. Do alignment analysis after SLP discovery and do it per instance. (vect_slp_bb): When vect_slp_analyze_bb_1 fatally failed do not bother to re-try using different vector sizes. Index: gcc/tree-vectorizer.h === *** gcc/tree-vectorizer.h (revision 230155) --- gcc/tree-vectorizer.h (working copy) *** extern tree vect_get_smallest_scalar_typ *** 1011,1018 extern bool vect_analyze_data_ref_dependences (loop_vec_info, int *); extern bool vect_slp_analyze_data_ref_dependences (bb_vec_info); extern bool vect_enhance_data_refs_alignment (loop_vec_info); ! extern bool vect_analyze_data_refs_alignment (vec_info *); ! extern bool vect_verify_datarefs_alignment (vec_info *); extern bool vect_analyze_data_ref_accesses (vec_info *); extern bool vect_prune_runtime_alias_test_list (loop_vec_info); extern tree vect_check_gather_scatter (gimple *, loop_vec_info, tree *, tree *, --- 1011,1019 extern bool vect_analyze_data_ref_dependences (loop_vec_info, int *); extern bool vect_slp_analyze_data_ref_dependences (bb_vec_info); extern bool vect_enhance_data_refs_alignment (loop_vec_info); ! extern bool vect_analyze_data_refs_alignment (loop_vec_info); ! extern bool vect_verify_datarefs_alignment (loop_vec_info); ! extern bool vect_slp_analyze_and_verify_instance_alignment (slp_instance); extern bool vect_analyze_data_ref_accesses (vec_info *); extern bool vect_prune_runtime_alias_test_list (loop_vec_info); extern tree vect_check_gather_scatter (gimple *, loop_vec_info, tree *, tree *, Index: gcc/tree-vect-data-refs.c === *** gcc/tree-vect-data-refs.c (revision 230155) --- gcc/tree-vect-data-refs.c (working copy) *** vect_slp_analyze_data_ref_dependences (b *** 645,650 --- 645,651 (SLP_INSTANCE_TREE (instance))[0], 0); vect_free_slp_instance (instance); BB_VINFO_SLP_INSTANCES (bb_vinfo).ordered_remove (i); + continue; } i++; } *** vect_slp_analyze_data_ref_dependences (b *** 668,674 FOR NOW: No analysis is actually performed. Misalignment is calculated only for trivial cases. TODO. */ ! static bool vect_compute_data_ref_alignment (struct data_reference *dr) { gimple *stmt = DR_STMT (dr); --- 669,675 FOR NOW: No analysis is actually performed. Misalignment is calculated only for trivial cases. TODO. */ ! bool vect_compute_data_ref_alignment (struct data_reference *dr) { gimple *stmt = DR_STMT (dr); *** vect_compute_data_ref_alignment (struct *** 838,882 } - /* Function vect_compute_data_refs_alignment - -Compute the misalignment of data references in the loop. -Return FALSE if a data reference is found that cannot be vectorized. */ - - static bool - vect_compute_data_refs_alignment (vec_info *vinfo) - { - vec datarefs = vinfo->datarefs; - struct data_reference *dr; - unsigned int i; - - FOR_EACH_VEC_ELT (datarefs, i, dr) - { - stmt_vec_info stmt_info = vinfo_for_stmt (DR_STMT (dr)); - if (STMT_VINFO_VECTORIZABLE (stmt_info) - && !vect_compute_data_ref_alignment (dr)) - { - /* Strided accesses perform only component accesses, misalignment -information is irrelevant for them. */ - if (STMT_VINFO_STRIDED_P (stmt_info) - && !STMT_VINFO_GROUPED_ACCESS (stmt_info)) - continue; - - if (is_a (vinfo)) - { - /* Mark unsupported statement as unvectorizab