[PATCH] TTI: Honour cost model for estimating cost of vector-intrinsic and calls.

hfinkel at anl.gov hfinkel at anl.gov
Fri Mar 6 11:14:27 PST 2015


================
Comment at: include/llvm/CodeGen/BasicTTIImpl.h:548
@@ +547,3 @@
+      if (ScalarCalls == 1)
+        return 10;
+
----------------
mzolotukhin wrote:
> hfinkel wrote:
> > Why are you changing the default cost for intrinsics from one to ten? I believe it used to be one, and that was because we made an explicit decision to make intrinsics default to something cheap.
> I made two changes here:
> 
> 1) Change `10 * Cost * Num` to `ScalarCalls * ScalarCost + ScalarizationOverhead`. I believe factor `10` initially was used to model the scalarization overhead, but now we can estimate it more accurately.
> 
> 2) Change `ScalarCalls + ScalarizationCost` to `ScalarCalls*10 + ScalarizationCost`. To me it looked a bit inconsistent: when an unknown intrinsic has a vector type, we returned `ScalarCalls + ScalarizationCost` (effectively, `ScalarCost` is implicitly assumed to be 1). However, for known intrinsics scalar cost is 10 (unless the operation is legal and we know exact cost). I can revert this change, but the original code just looked a bit odd to me.
> 
> However, I can find explanation like "we expect all unknown intrinsics to be lowered to somewhat cheap (cost=1), in contrast to the listed ones, which will definitely be lowered to an expensive libcall (cost=10)". If that's the case, I agree that the original code is correct.
> However, I can find explanation like "we expect all unknown intrinsics to be lowered to somewhat cheap (cost=1), in contrast to the listed ones, which will definitely be lowered to an expensive libcall (cost=10)". If that's the case, I agree that the original code is correct.

Yes, I believe that was the logic, and the original code was consistent with that reasoning.

http://reviews.llvm.org/D8096

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list