Am 05.05.2015 um 00:16 schrieb Matt Turner: > On Tue, Feb 24, 2015 at 10:39 AM, Roland Scheidegger <srol...@vmware.com> > wrote: >> As a side note (not really directly related to the patch) I think this >> could benefit from some optimization, unless there's some passes >> somewhere which can already do this. >> >> The non-scalar (non-cube) calculation does this: >> lod_info.lod = log2(max(sqrt(dot1), sqrt(dot2))) >> The second sqrt can be trivially eliminated: >> = log2(sqrt(max(dot1, dot2))) > > I don't think that's valid, since sqrt(x) is greater than x for x < 1.0. That relationship is true, but not relevant, since when (x >= y) -> sqrt(x) >= sqrt(y) still holds true (for non-negative numbers anyway)
Roland > >> And furthermore the remaining sqrt can be killed off too thanks to >> n*log2(x) = log2(x^n) >> = 0.5*log2(max(dot1, dot2))) >> >> I don't really know anything about the hw, but I would think this should >> be faster not only on the 1 mathbox-per-gpu ancient igps ;-). > > FWIW, I implemented that optimization in NIR based on this email in > > commit 099c729b4cb6863e8ddbdb9afe7fd7bd53c11ee1 > Author: Matt Turner <matts...@gmail.com> > Date: Thu Mar 26 10:07:58 2015 -0700 > > nir: Add identities for the log function. > > and it didn't find any instances of log(sqrt(x)) in our shader-db. :( > > It did find some rcp(log(x)) though! > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev