Author: Richard Plangger <r...@pasra.at>
Branch: vecopt-merge
Changeset: r79118:81c2f4a28f89
Date: 2015-08-21 15:54 +0200
http://bitbucket.org/pypy/pypy/changeset/81c2f4a28f89/

Log:    translation issues and added documentation to some routines in the
        scheduler

diff --git a/rpython/jit/backend/x86/assembler.py 
b/rpython/jit/backend/x86/assembler.py
--- a/rpython/jit/backend/x86/assembler.py
+++ b/rpython/jit/backend/x86/assembler.py
@@ -592,7 +592,7 @@
         return AsmInfo(ops_offset, startpos + rawstart, codeendpos - startpos, 
rawstart)
 
     def stitch_bridge(self, faildescr, target):
-        assert target != 0
+        assert target.rawstart != 0
         self.patch_jump_for_descr(faildescr, target.rawstart)
 
     def write_pending_failure_recoveries(self, regalloc):
diff --git a/rpython/jit/metainterp/history.py 
b/rpython/jit/metainterp/history.py
--- a/rpython/jit/metainterp/history.py
+++ b/rpython/jit/metainterp/history.py
@@ -771,7 +771,8 @@
         return self._compiled is not None
 
     def copy_operations(self, operations):
-        from rpython.jit.metainterp.compile import ResumeGuardDescr
+        from rpython.jit.metainterp.compile import (ResumeGuardDescr,
+                CompileLoopVersionDescr)
         ignore = (rop.DEBUG_MERGE_POINT,)
         oplist = []
         for op in operations:
@@ -787,6 +788,8 @@
                 cloned.setdescr(descr)
                 if olddescr.loop_version():
                     # copy the version
+                    assert isinstance(olddescr, CompileLoopVersionDescr)
+                    assert isinstance(descr, CompileLoopVersionDescr)
                     descr.version = olddescr.version
                     self.faildescrs.append(descr)
         return oplist
diff --git a/rpython/jit/metainterp/optimizeopt/schedule.py 
b/rpython/jit/metainterp/optimizeopt/schedule.py
--- a/rpython/jit/metainterp/optimizeopt/schedule.py
+++ b/rpython/jit/metainterp/optimizeopt/schedule.py
@@ -303,6 +303,7 @@
 
 
     def transform_pack(self):
+        """ high level transformation routine of a pack to operations """
         op = self.pack.leftmost()
         args = op.getarglist()
         self.before_argument_transform(args)
@@ -344,6 +345,7 @@
         return self.pack.operations
 
     def transform_arguments(self, args):
+        """ transforming one argument to a vector box argument """
         for i,arg in enumerate(args):
             if isinstance(arg, BoxVector):
                 continue
@@ -444,6 +446,7 @@
         return vbox_cloned
 
     def unpack(self, vbox, index, count, arg_ptype):
+        """ extract parts of the vector box into another vector box """
         assert index < vbox.getcount()
         assert index + count <= vbox.getcount()
         assert count > 0
@@ -491,6 +494,9 @@
         assert result.getcount() > arg0.getcount()
 
     def expand(self, arg, argidx):
+        """ expand a value into a vector box. useful for arith metic
+            of one vector with a scalar (either constant/varialbe)
+        """
         elem_count = self.input_type.getcount()
         vbox = self.input_type.new_vector_box(elem_count)
         box_type = arg.type
@@ -665,10 +671,6 @@
     def get_input_type_given(self, output_type, op):
         raise AssertionError("cannot infer input type from output type")
 
-    # OLD
-    def determine_output_type(self, op):
-        return None
-
 GUARD_TF = PassThroughOp((PT_INT_GENERIC,))
 INT_OP_TO_VOP = OpToVectorOp((PT_INT_GENERIC, PT_INT_GENERIC), INT_RES)
 FLOAT_OP_TO_VOP = OpToVectorOp((PT_FLOAT_GENERIC, PT_FLOAT_GENERIC), FLOAT_RES)
@@ -784,6 +786,7 @@
             scheduler.oplist.append(op)
 
     def as_vector_operation(self, scheduler, pack):
+        """ transform a pack into a single or several operation """
         assert pack.opcount() > 1
         # properties that hold for the pack are:
         # + isomorphism (see func above)
@@ -794,7 +797,6 @@
         op = pack.operations[0].getoperation()
         determine_trans(op).as_vector_operation(pack, self, scheduler, oplist)
         #
-        # XXX
         if pack.is_accumulating():
             box = oplist[position].result
             assert box is not None
@@ -804,6 +806,9 @@
                 scheduler.renamer.start_renaming(op.result, box)
 
     def unpack_from_vector(self, op, scheduler):
+        """ if a box is needed that is currently stored within a vector
+            box, this utility creates a unpacking instruction
+        """
         args = op.getarglist()
 
         # unpack for an immediate use
@@ -917,6 +922,7 @@
             node.pack_position = i
 
     def rightmost_match_leftmost(self, other):
+        """ check if pack A can be combined with pack B """
         assert isinstance(other, Pack)
         rightmost = self.operations[-1]
         leftmost = other.operations[0]
@@ -955,6 +961,7 @@
                    self.right is other.right
 
 class AccumPair(Pair):
+    """ A pair that keeps track of an accumulation value """
     def __init__(self, left, right, input_type, output_type, accum):
         assert isinstance(left, Node)
         assert isinstance(right, Node)
diff --git a/rpython/jit/metainterp/test/test_vectorize.py 
b/rpython/jit/metainterp/test/test_vectorize.py
--- a/rpython/jit/metainterp/test/test_vectorize.py
+++ b/rpython/jit/metainterp/test/test_vectorize.py
@@ -283,7 +283,7 @@
         res = self.meta_interp(f, [i])
         assert res == f(i)
 
-    @py.test.mark.parametrize('i,v1,v2',[(25,2.5,0.3)])
+    @py.test.mark.parametrize('i,v1,v2',[(25,2.5,0.3), (15,44.0,22.2)])
     def test_list_vectorize(self,i,v1,v2):
         myjitdriver = JitDriver(greens = [],
                                 reds = 'auto')
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to