[PATCH] D57779: [SLP] Add support for throttling.
Alexey Bataev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 7 03:05:32 PDT 2021
ABataev added a comment.
In D57779#2743946 <https://reviews.llvm.org/D57779#2743946>, @dtemirbulatov wrote:
>> Why do we need MinVecNodes? MinTreeSize and all associated analysis must be enough
>
> it is Transforms/SLPVectorizer/X86/tiny-tree.ll transform that scared me.
> From:
> define void @tiny_tree_not_fully_vectorizable(double* noalias nocapture %dst, double* noalias nocapture readonly %src, i64 %count) #0 {
> entry:
>
> %cmp12 = icmp eq i64 %count, 0
> br i1 %cmp12, label %for.end, label %for.body
>
> for.body: ; preds = %entry, %for.body
>
> %i.015 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
> %dst.addr.014 = phi double* [ %add.ptr4, %for.body ], [ %dst, %entry ]
> %src.addr.013 = phi double* [ %add.ptr, %for.body ], [ %src, %entry ]
> %0 = load double, double* %src.addr.013, align 8
> store double %0, double* %dst.addr.014, align 8
> %arrayidx2 = getelementptr inbounds double, double* %src.addr.013, i64 2
> %1 = load double, double* %arrayidx2, align 8
> %arrayidx3 = getelementptr inbounds double, double* %dst.addr.014, i64 1
> store double %1, double* %arrayidx3, align 8
> %add.ptr = getelementptr inbounds double, double* %src.addr.013, i64 %i.015
> %add.ptr4 = getelementptr inbounds double, double* %dst.addr.014, i64 %i.015
> %inc = add i64 %i.015, 1
> %exitcond = icmp eq i64 %inc, %count
> br i1 %exitcond, label %for.end, label %for.body
>
> for.end: ; preds = %for.body, %entry
>
> ret void
>
> }
> to:
> define void @tiny_tree_not_fully_vectorizable(double* noalias nocapture %dst, double* noalias nocapture readonly %src, i64 %count) #0 {
> entry:
>
> %cmp12 = icmp eq i64 %count, 0
> br i1 %cmp12, label %for.end, label %for.body
>
> for.body: ; preds = %for.body, %entry
>
> %i.015 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
> %dst.addr.014 = phi double* [ %add.ptr4, %for.body ], [ %dst, %entry ]
> %src.addr.013 = phi double* [ %add.ptr, %for.body ], [ %src, %entry ]
> %0 = load double, double* %src.addr.013, align 8
> %arrayidx2 = getelementptr inbounds double, double* %src.addr.013, i64 2
> %1 = load double, double* %arrayidx2, align 8
> %arrayidx3 = getelementptr inbounds double, double* %dst.addr.014, i64 1
> %2 = insertelement <2 x double> poison, double %0, i32 0
> %3 = insertelement <2 x double> %2, double %1, i32 1
> %4 = bitcast double* %dst.addr.014 to <2 x double>*
> store <2 x double> %3, <2 x double>* %4, align 8
> %add.ptr = getelementptr inbounds double, double* %src.addr.013, i64 %i.015
> %add.ptr4 = getelementptr inbounds double, double* %dst.addr.014, i64 %i.015
> %inc = add i64 %i.015, 1
> %exitcond = icmp eq i64 %inc, %count
> br i1 %exitcond, label %for.end, label %for.body
>
> for.end: ; preds = %for.body, %entry
>
> ret void
>
> }
>
> but now with llvm-mca with -mattr=+corei7-avx, I see the change from 1111 to 1014 cycles, so it looks good. I will check other cases.
If so, it just means that oir min-tree-size analysis os too strict and must be fixed in general, buy by introducing some new throttling-specific options. We may have the same situation without throttling.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57779/new/
https://reviews.llvm.org/D57779
More information about the llvm-commits
mailing list