Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyshader appears to be retired and failing #373

Open
airlied opened this issue May 1, 2024 · 0 comments
Open

pyshader appears to be retired and failing #373

airlied opened this issue May 1, 2024 · 0 comments

Comments

@airlied
Copy link

airlied commented May 1, 2024

So pyshader github repo seems to be retired, and the examples are failing for me with

pytest ./test_array_multiplication.py 
========================================================================== test session starts ==========================================================================
platform linux -- Python 3.12.2, pytest-7.4.3, pluggy-1.3.0
rootdir: /fast/devel/kompute
collected 1 item                                                                                                                                                        

test_array_multiplication.py F                                                                                                                                    [100%]

=============================================================================== FAILURES ================================================================================
_______________________________________________________________________ test_array_multiplication _______________________________________________________________________

    def test_array_multiplication():
    
        # 1. Create Kompute Manager (selects device 0 by default)
        mgr = kp.Manager()
    
        # 2. Create Kompute Tensors to hold data
        tensor_in_a = mgr.tensor(np.array([2, 2, 2]))
        tensor_in_b = mgr.tensor(np.array([1, 2, 3]))
        tensor_out = mgr.tensor(np.array([0, 0, 0]))
    
        params = [tensor_in_a, tensor_in_b, tensor_out]
    
        # 4. Define the multiplication shader code to run on the GPU
>       @ps.python2shader

test_array_multiplication.py:19: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/airlied/.local/lib/python3.12/site-packages/pyshader/py.py:43: in python2shader
    converter.convert(func, shader_type)
/home/airlied/.local/lib/python3.12/site-packages/pyshader/py.py:181: in convert
    self._convert()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <pyshader.py.PyBytecode2Bytecode object at 0x7f6ff032f920>

    def _convert(self):
    
        self._line_bump_index = 0
        self._pointer = 0
        while self._pointer < len(self._py_bytecode):
            if (
                self._loops_to_handle
                and self._pointer == self._loops_to_handle[0]["start"]
            ):
                self._start_loop(self._loops_to_handle.pop(0))
            elif self._pointer == self._loop_stack[-1].get("end"):
                self._end_loop()
            elif (
                self._pointer in self._labels
                and self._pointer not in self._protected_labels
            ):
                label = self._labels[self._pointer]
                last_opcode = self._opcodes[-1][0]
                if last_opcode not in (
                    "co_branch",
                    "co_branch_conditional",
                    "co_branch_loop",
                ):
                    self.emit(op.co_branch, label)
                self.emit(op.co_label, label)
            for instruction in self._insert_at.get(self._pointer, []):
                self.emit(*instruction)
            opname, arg = self._next()
            print(opname.lower())
            method_name = "_op_" + opname.lower()
            method = getattr(self, method_name, None)
            if method is None:
                pprint_bytecode(self._co)
>               raise RuntimeError(
                    self.errinfo()
                    + f"Cannot parse py's {opname} yet (no {method_name}())."
                )
E               RuntimeError: 
E                 Source file "/fast/devel/kompute/python/test/test_array_multiplication.py", line 19, in compute_mult
E                   @ps.python2shader
E                 Cannot parse py's BUILD_MAP_UNPACK_WITH_CALL yet (no _op_build_map_unpack_with_call()).

/home/airlied/.local/lib/python3.12/site-packages/pyshader/py.py:255: RuntimeError
------------------------------------------------------------------------- Captured stdout call --------------------------------------------------------------------------
build_map_unpack_with_call
 19           0 RESUME                   0

 24           2 LOAD_FAST                0 (index)
              4 LOAD_ATTR                0 (x)
             24 STORE_FAST               4 (i)

 25          26 LOAD_FAST                1 (data1)
             28 LOAD_FAST                4 (i)
             30 BINARY_SUBSCR
             34 LOAD_FAST                2 (data2)
             36 LOAD_FAST                4 (i)
             38 BINARY_SUBSCR
             42 BINARY_OP                5 (*)
             46 LOAD_FAST                3 (data3)
             48 LOAD_FAST                4 (i)
             50 STORE_SUBSCR
             54 RETURN_CONST             0 (None)
=========================================================================== warnings summary ============================================================================
python/test/test_array_multiplication.py::test_array_multiplication
  /home/airlied/.local/lib/python3.12/site-packages/pyshader/py.py:57: DeprecationWarning: co_lnotab is deprecated, use co_lines instead.
    for i in range(0, len(co.co_lnotab), 2):

python/test/test_array_multiplication.py::test_array_multiplication
python/test/test_array_multiplication.py::test_array_multiplication
  /home/airlied/.local/lib/python3.12/site-packages/pyshader/py.py:58: DeprecationWarning: co_lnotab is deprecated, use co_lines instead.
    addr_incr = co.co_lnotab[i]

python/test/test_array_multiplication.py::test_array_multiplication
python/test/test_array_multiplication.py::test_array_multiplication
  /home/airlied/.local/lib/python3.12/site-packages/pyshader/py.py:59: DeprecationWarning: co_lnotab is deprecated, use co_lines instead.
    line_incr = co.co_lnotab[i + 1]

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================================================== short test summary info ========================================================================
FAILED test_array_multiplication.py::test_array_multiplication - RuntimeError: 
===================================================================== 1 failed, 5 warnings in 0.24s =====================================================================

This seems like a bug in pyshader, but it isn't getting updates then it probably should be moved on from.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant