Quoting Kenneth Graunke (2017-09-20 13:44:58) > On Wednesday, September 20, 2017 1:27:38 PM PDT Dylan Baker wrote: > > Meson doesn't allow setting environment variables for custom targets, so > > we either need to not pass this as an environment variable or use a > > shell script to wrap the invocation. The chosen solution has the > > advantage of working for both autotools and meson. > > > > Signed-off-by: Dylan Baker <dylanx.c.ba...@intel.com> > > --- > > src/intel/Makefile.compiler.am | 2 +- > > src/intel/compiler/brw_nir_trig_workarounds.py | 34 > > +++++++++++++++++++------- > > 2 files changed, 26 insertions(+), 10 deletions(-) > > > > diff --git a/src/intel/Makefile.compiler.am b/src/intel/Makefile.compiler.am > > index 3ab550c96b1..45e7a6ccce8 100644 > > --- a/src/intel/Makefile.compiler.am > > +++ b/src/intel/Makefile.compiler.am > > @@ -35,7 +35,7 @@ BUILT_SOURCES += $(COMPILER_GENERATED_FILES) > > compiler/brw_nir_trig_workarounds.c: compiler/brw_nir_trig_workarounds.py \ > > > > $(top_srcdir)/src/compiler/nir/nir_algebraic.py > > $(MKDIR_GEN) > > - $(AM_V_GEN) PYTHONPATH=$(top_srcdir)/src/compiler/nir $(PYTHON2) > > $(PYTHON_FLAGS) $(srcdir)/compiler/brw_nir_trig_workarounds.py > $@ || > > ($(RM) $@; false) > > + $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) > > $(srcdir)/compiler/brw_nir_trig_workarounds.py -p > > $(top_srcdir)/src/compiler/nir > $@ || ($(RM) $@; false) > > > > EXTRA_DIST += \ > > compiler/brw_nir_trig_workarounds.py > > diff --git a/src/intel/compiler/brw_nir_trig_workarounds.py > > b/src/intel/compiler/brw_nir_trig_workarounds.py > > index 6a77d64dbd4..a752f5461f1 100644 > > --- a/src/intel/compiler/brw_nir_trig_workarounds.py > > +++ b/src/intel/compiler/brw_nir_trig_workarounds.py > > @@ -20,8 +20,6 @@ > > # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER > > DEALINGS > > # IN THE SOFTWARE. > > > > -import nir_algebraic > > - > > # Prior to Kaby Lake, The SIN and COS instructions on Intel hardware can > > # produce values slightly outside of the [-1.0, 1.0] range for a small set > > of > > # values. Obviously, this can break everyone's expectations about trig > > @@ -33,11 +31,29 @@ import nir_algebraic > > # amplitude slightly. Apparently this also minimizes the error function, > > # reducing the maximum error from 0.00006 to about 0.00003. > > > > -trig_workarounds = [ > > - (('fsin', 'x'), ('fmul', ('fsin', 'x'), 0.99997)), > > - (('fcos', 'x'), ('fmul', ('fcos', 'x'), 0.99997)), > > -] > > +import argparse > > +import sys > > + > > + > > +def main(): > > + parser = argparse.ArgumentParser() > > + parser.add_argument('-p', '--import-path', required=True) > > + args = parser.parse_args() > > + sys.path.insert(0, args.import_path) > > + run() > > + > > + > > +def run(): > > + import nir_algebraic > > + trig_workarounds = [ > > + (('fsin', 'x'), ('fmul', ('fsin', 'x'), 0.99997)), > > + (('fcos', 'x'), ('fmul', ('fcos', 'x'), 0.99997)), > > + ] > > + > > + print '#include "brw_nir.h"' > > + print nir_algebraic.AlgebraicPass("brw_nir_apply_trig_workarounds", > > + trig_workarounds).render() > > + > > > > -print '#include "brw_nir.h"' > > -print nir_algebraic.AlgebraicPass("brw_nir_apply_trig_workarounds", > > - trig_workarounds).render() > > +if __name__ == '__main__': > > + main() > > > > IMHO it would be nice to leave trig_workarounds at the top level, like > it was. That way, you can find the rules easily without having to dig > through the plumbing necessary to set them up. Either way, > > Reviewed-by: Kenneth Graunke <kenn...@whitecape.org>
Sure, I can move them back. I'll add that to v2. Dylan
signature.asc
Description: signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev