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

Python example type error (pyshader). #111

Closed
CaiusTSM opened this issue Jan 12, 2021 · 8 comments
Closed

Python example type error (pyshader). #111

CaiusTSM opened this issue Jan 12, 2021 · 8 comments

Comments

@CaiusTSM
Copy link

The first python example on https://kompute.cc/overview/python-package.html causes the following type error:

    mgr.eval_algo_data_def([tensor_in_a, tensor_in_b, tensor_out], compute_shader_multiply.to_spirv())
TypeError: eval_algo_data_def(): incompatible function arguments. The following argument types are supported:
    1. (self: kp.Manager, arg0: List[kp.Tensor], arg1: List[str]) -> None

Invoked with: <kp.Manager object at 0x7f5a042067f0>, [<kp.Tensor object at 0x7f5a0420e5f0>, <kp.Tensor object at 0x7f5a0420e5b0>, <kp.Tensor object at 0x7f5a03cb0d70>], b'\x03\x02#\x07\x00\x03\x01\x00\x00\x00\x00\x00&\x00\x00\x00\x00\x00\x00\x00\x11\x00\x02\x00\x01\x00\x00\x00\x0e\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x00\x06\x00\x05\x00\x00\x00\x01\x00\x00\x00main\x00\x00\x00\x00\x08\x00\x00\x00\x10\x00\x06\x00\x01\x00\x00\x00\x11\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x05\x00\x04\x00\x01\x00\x00\x00main\x00\x00\x00\x00\x05\x00\x04\x00\x08\x00\x00\x00index\x00\x00\x00\x05\x00\x04\x00\r\x00\x00\x00data1\x00\x00\x00\x05\x00\x03\x00\x0e\x00\x00\x000\x00\x00\x00\x05\x00\x04\x00\x11\x00\x00\x00data2\x00\x00\x00\x05\x00\x04\x00\x14\x00\x00\x00data3\x00\x00\x00\x05\x00\x03\x00\x16\x00\x00\x00i\x00\x00\x00G\x00\x04\x00\x08\x00\x00\x00\x0b\x00\x00\x00\x1c\x00\x00\x00G\x00\x04\x00\n\x00\x00\x00\x06\x00\x00\x00\x04\x00\x00\x00H\x00\x05\x00\x0b\x00\x00\x00\x00\x00\x00\x00#\x00\x00\x00\x00\x00\x00\x00G\x00\x03\x00\x0b\x00\x00\x00\x03\x00\x00\x00G\x00\x04\x00\r\x00\x00\x00"\x00\x00\x00\x00\x00\x00\x00G\x00\x04\x00\r\x00\x00\x00!\x00\x00\x00\x00\x00\x00\x00H\x00\x05\x00\x0f\x00\x00\x00\x00\x00\x00\x00#\x00\x00\x00\x00\x00\x00\x00G\x00\x03\x00\x0f\x00\x00\x00\x03\x00\x00\x00G\x00\x04\x00\x11\x00\x00\x00"\x00\x00\x00\x00\x00\x00\x00G\x00\x04\x00\x11\x00\x00\x00!\x00\x00\x00\x01\x00\x00\x00H\x00\x05\x00\x12\x00\x00\x00\x00\x00\x00\x00#\x00\x00\x00\x00\x00\x00\x00G\x00\x03\x00\x12\x00\x00\x00\x03\x00\x00\x00G\x00\x04\x00\x14\x00\x00\x00"\x00\x00\x00\x00\x00\x00\x00G\x00\x04\x00\x14\x00\x00\x00!\x00\x00\x00\x02\x00\x00\x00\x13\x00\x02\x00\x02\x00\x00\x00!\x00\x03\x00\x03\x00\x00\x00\x02\x00\x00\x00\x15\x00\x04\x00\x05\x00\x00\x00 \x00\x00\x00\x01\x00\x00\x00\x17\x00\x04\x00\x06\x00\x00\x00\x05\x00\x00\x00\x03\x00\x00\x00 \x00\x04\x00\x07\x00\x00\x00\x01\x00\x00\x00\x06\x00\x00\x00;\x00\x04\x00\x07\x00\x00\x00\x08\x00\x00\x00\x01\x00\x00\x00\x16\x00\x03\x00\t\x00\x00\x00 \x00\x00\x00\x1d\x00\x03\x00\n\x00\x00\x00\t\x00\x00\x00\x1e\x00\x03\x00\x0b\x00\x00\x00\n\x00\x00\x00 \x00\x04\x00\x0c\x00\x00\x00\x02\x00\x00\x00\x0b\x00\x00\x00;\x00\x04\x00\x0c\x00\x00\x00\r\x00\x00\x00\x02\x00\x00\x00+\x00\x04\x00\x05\x00\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x1e\x00\x03\x00\x0f\x00\x00\x00\n\x00\x00\x00 \x00\x04\x00\x10\x00\x00\x00\x02\x00\x00\x00\x0f\x00\x00\x00;\x00\x04\x00\x10\x00\x00\x00\x11\x00\x00\x00\x02\x00\x00\x00\x1e\x00\x03\x00\x12\x00\x00\x00\n\x00\x00\x00 \x00\x04\x00\x13\x00\x00\x00\x02\x00\x00\x00\x12\x00\x00\x00;\x00\x04\x00\x13\x00\x00\x00\x14\x00\x00\x00\x02\x00\x00\x00 \x00\x04\x00\x15\x00\x00\x00\x07\x00\x00\x00\x05\x00\x00\x00 \x00\x04\x00\x17\x00\x00\x00\x01\x00\x00\x00\x05\x00\x00\x00 \x00\x04\x00\x1d\x00\x00\x00\x02\x00\x00\x00\t\x00\x00\x00 \x00\x04\x00 \x00\x00\x00\x02\x00\x00\x00\t\x00\x00\x00 \x00\x04\x00$\x00\x00\x00\x02\x00\x00\x00\t\x00\x00\x006\x00\x05\x00\x02\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\xf8\x00\x02\x00\x04\x00\x00\x00;\x00\x04\x00\x15\x00\x00\x00\x16\x00\x00\x00\x07\x00\x00\x00A\x00\x05\x00\x17\x00\x00\x00\x18\x00\x00\x00\x08\x00\x00\x00\x0e\x00\x00\x00=\x00\x04\x00\x05\x00\x00\x00\x19\x00\x00\x00\x18\x00\x00\x00>\x00\x03\x00\x16\x00\x00\x00\x19\x00\x00\x00=\x00\x04\x00\x05\x00\x00\x00\x1a\x00\x00\x00\x16\x00\x00\x00=\x00\x04\x00\x05\x00\x00\x00\x1b\x00\x00\x00\x16\x00\x00\x00A\x00\x06\x00\x1d\x00\x00\x00\x1e\x00\x00\x00\r\x00\x00\x00\x0e\x00\x00\x00\x1a\x00\x00\x00=\x00\x04\x00\t\x00\x00\x00\x1f\x00\x00\x00\x1e\x00\x00\x00A\x00\x06\x00 \x00\x00\x00!\x00\x00\x00\x11\x00\x00\x00\x0e\x00\x00\x00\x1b\x00\x00\x00=\x00\x04\x00\t\x00\x00\x00"\x00\x00\x00!\x00\x00\x00\x85\x00\x05\x00\t\x00\x00\x00\x1c\x00\x00\x00\x1f\x00\x00\x00"\x00\x00\x00=\x00\x04\x00\x05\x00\x00\x00#\x00\x00\x00\x16\x00\x00\x00A\x00\x06\x00$\x00\x00\x00%\x00\x00\x00\x14\x00\x00\x00\x0e\x00\x00\x00#\x00\x00\x00>\x00\x03\x00%\x00\x00\x00\x1c\x00\x00\x00\xfd\x00\x01\x008\x00\x01\x00'

It wants a List[str], but is given bytes from the to_spriv function. I tried casting with list(str(compute_shader_multiply.to_spirv())), but that results in a segfault.

@unexploredtest
Copy link
Contributor

Have you installed Vulkan SDK?

@CaiusTSM
Copy link
Author

Yes, I have the Vulkan SDK installed. I have an AMD GPU, does pyshader only work with Nvidia GPUs?

@unexploredtest
Copy link
Contributor

unexploredtest commented Jan 13, 2021

No, mine is also AMD(Radeon HD 7770) but the code works fine.

@unexploredtest
Copy link
Contributor

What version are you using? Mine is 1. (self: kp.Manager, arg0: List[kp.Tensor], arg1: bytes) -> None not 1. (self: kp.Manager, arg0: List[kp.Tensor], arg1: List[str]) -> None

@unexploredtest
Copy link
Contributor

unexploredtest commented Jan 13, 2021

I've downgraded to version 0.4.1 and got the same error, I suspect it's a change due to this commit, I suggest you update kp to the latest version (0.5.1).

@axsaucedo
Copy link
Member

Good shout @aliPMPAINT, yes it does seem like it most probably is due to that change, @CaiusTSM can you confirm which version of the python are you using? Can you try it with the latest 0.5.1?

@CaiusTSM
Copy link
Author

CaiusTSM commented Jan 13, 2021

Yes, I am using version 0.4.1 (python 3.9.1). I have built and installed from source (via pip install .) and the example works now (version 0.5.2). The pypi kompute package (https://pypi.org/project/kompute/#files) does not seem to be kept up to date. Could you update it (unless this is not an official pypi package, not sure)? This seems like a very important version update.

@axsaucedo
Copy link
Member

Oh I see, good shout @CaiusTSM - initially I created the kompute package, but then decided to release to kp instead. I will have a look at either keeping both of them updated, or closing the kompute package.

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

3 participants