Richard Biener <[email protected]> writes: > On Wed, 3 Sep 2025, Richard Sandiford wrote: > >> Tamar Christina <[email protected]> writes: >> > We also don't ever force unrolling for predicated SVE because for >> > predicated SVE we have to balance predicate throughput limitations >> > of any given CPU. Having the user unroll factor be able to override >> > the cost model one will almost certainly lead to worse performance >> > in this case. >> >> FWIW, cause and effect are kind-of the other way around: we request an >> unroll factor for SVE in the normal way, but doing so disables predication, >> thanks to: >> >> /* For partial-vector-usage=1, try to push the handling of partial >> vectors to the epilogue, with the main loop continuing to operate >> on full vectors. >> >> If we are unrolling we also do not want to use partial vectors. This >> is to avoid the overhead of generating multiple masks and also to >> avoid having to execute entire iterations of FALSE masked instructions >> when dealing with one or less full iterations. >> >> ??? We could then end up failing to use partial vectors if we >> decide to peel iterations into a prologue, and if the main loop >> then ends up processing fewer than VF iterations. */ >> if ((param_vect_partial_vector_usage == 1 >> || loop_vinfo->suggested_unroll_factor > 1) >> && !LOOP_VINFO_EPILOGUE_P (loop_vinfo) >> && !vect_known_niters_smaller_than_vf (loop_vinfo)) >> LOOP_VINFO_EPIL_USING_PARTIAL_VECTORS_P (loop_vinfo) = true; >> else >> LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo) = true; > > Context doesn't show, but I guess this honors > LOOP_VINFO_MUST_USE_PARTIAL_VECTORS_P. > > Also I wonder when we don't use partial vectors, does that mean > we are using fixed-length vectors? Unless -msve-vector-bits is > specified this means using NEON width? At least I don't remember > seeing non-len-based code to query the actual vector length > at runtime?
We do support unpredicated vectorisation with variable lengths. It just all happens via the poly_ints, and so looks very much like fixed-length code would. No specific query is needed. The unpredicated case is actually the one that we implemented first. Then we added support for predicated loops, gradually extending the types of vectorisation that support predication so that now almost all do. But there is at least one case that we never implemented: reversed contiguous accesses. Richard
