vulkan icon indicating copy to clipboard operation
vulkan copied to clipboard

Upgrade to Vulkan 1.3

Open juliancoy opened this issue 3 years ago • 28 comments

Testing in progress

juliancoy avatar Feb 03 '22 22:02 juliancoy

Hello @julianfl0w , do you have others commits to do or is your pull request ready ? Thanks for the good work !

realitix avatar Feb 07 '22 13:02 realitix

@realitix i have nothing more to add

juliancoy avatar Feb 20 '22 21:02 juliancoy

will this be merged with pyvulkan?

okuma10 avatar Feb 23 '22 19:02 okuma10

@realitix?

okuma10 avatar Mar 15 '22 20:03 okuma10

I'm testing right now to check the test works

realitix avatar Mar 16 '22 08:03 realitix

Sorry but I have errors with your pr:

How to reproduce the error:

  1. clone your pr: git clone https://github.com/julianfl0w/vulkan.git
  2. create vent: python3 -m venv venv
  3. load venv: . venv/bin/activate
  4. install: python setup.py install
Error:
/usr/lib/python3.10/distutils/dist.py:274: UserWarning: Unknown distribution option: 'long_descripiton'
  warnings.warn(msg)
Traceback (most recent call last):
  File "/home/realitix/git/vulkan/.eggs/cffi-1.15.0-py3.10-linux-x86_64.egg/cffi/cparser.py", line 336, in _parse
    ast = _get_parser().parse(fullcsource)
  File "/home/realitix/git/vulkan/.eggs/pycparser-2.21-py3.10.egg/pycparser/c_parser.py", line 147, in parse
    return self.cparser.parse(
  File "/home/realitix/git/vulkan/.eggs/pycparser-2.21-py3.10.egg/pycparser/ply/yacc.py", line 331, in parse
    return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
  File "/home/realitix/git/vulkan/.eggs/pycparser-2.21-py3.10.egg/pycparser/ply/yacc.py", line 1199, in parseopt_notrack
    tok = call_errorfunc(self.errorfunc, errtoken, self)
  File "/home/realitix/git/vulkan/.eggs/pycparser-2.21-py3.10.egg/pycparser/ply/yacc.py", line 193, in call_errorfunc
    r = errorfunc(token)
  File "/home/realitix/git/vulkan/.eggs/pycparser-2.21-py3.10.egg/pycparser/c_parser.py", line 1931, in p_error
    self._parse_error(
  File "/home/realitix/git/vulkan/.eggs/pycparser-2.21-py3.10.egg/pycparser/plyparser.py", line 67, in _parse_error
    raise ParseError("%s: %s" % (coord, msg))
pycparser.plyparser.ParseError: <cdef source string>:11240:5: before: HMONITOR

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/realitix/git/vulkan/setup.py", line 8, in <module>
    setup(
  File "/home/realitix/git/vulkan/venv/lib/python3.10/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.10/distutils/core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "/home/realitix/git/vulkan/venv/lib/python3.10/site-packages/setuptools/dist.py", line 453, in __init__
    _Distribution.__init__(
  File "/usr/lib/python3.10/distutils/dist.py", line 292, in __init__
    self.finalize_options()
  File "/home/realitix/git/vulkan/venv/lib/python3.10/site-packages/setuptools/dist.py", line 831, in finalize_options
    ep(self)
  File "/home/realitix/git/vulkan/venv/lib/python3.10/site-packages/setuptools/dist.py", line 852, in _finalize_setup_keywords
    ep.load()(self, ep.name, value)
  File "/home/realitix/git/vulkan/.eggs/cffi-1.15.0-py3.10-linux-x86_64.egg/cffi/setuptools_ext.py", line 219, in cffi_modules
    add_cffi_module(dist, cffi_module)
  File "/home/realitix/git/vulkan/.eggs/cffi-1.15.0-py3.10-linux-x86_64.egg/cffi/setuptools_ext.py", line 49, in add_cffi_module
    execfile(build_file_name, mod_vars)
  File "/home/realitix/git/vulkan/.eggs/cffi-1.15.0-py3.10-linux-x86_64.egg/cffi/setuptools_ext.py", line 25, in execfile
    exec(code, glob, glob)
  File "vulkan/vulkan_build.py", line 13, in <module>
    ffi.cdef(cdef)
  File "/home/realitix/git/vulkan/.eggs/cffi-1.15.0-py3.10-linux-x86_64.egg/cffi/api.py", line 112, in cdef
    self._cdef(csource, override=override, packed=packed, pack=pack)
  File "/home/realitix/git/vulkan/.eggs/cffi-1.15.0-py3.10-linux-x86_64.egg/cffi/api.py", line 126, in _cdef
    self._parser.parse(csource, override=override, **options)
  File "/home/realitix/git/vulkan/.eggs/cffi-1.15.0-py3.10-linux-x86_64.egg/cffi/cparser.py", line 389, in parse
    self._internal_parse(csource)
  File "/home/realitix/git/vulkan/.eggs/cffi-1.15.0-py3.10-linux-x86_64.egg/cffi/cparser.py", line 394, in _internal_parse
    ast, macros, csource = self._parse(csource)
  File "/home/realitix/git/vulkan/.eggs/cffi-1.15.0-py3.10-linux-x86_64.egg/cffi/cparser.py", line 338, in _parse
    self.convert_pycparser_error(e, csource)
  File "/home/realitix/git/vulkan/.eggs/cffi-1.15.0-py3.10-linux-x86_64.egg/cffi/cparser.py", line 367, in convert_pycparser_error
    raise CDefError(msg)
cffi.CDefError: cannot parse "HMONITOR hmonitor;"
<cdef source string>:11240:5: before: HMONITOR

Can you fix this ? Thanks

realitix avatar Mar 16 '22 08:03 realitix

@realitix I've naively dumped my entire package set to a Conda environment.yml . Importantly, it enforces Python3.9

This works on Windows, NOT TESTED ON LINUX

Usage: conda env create -f environment.yml pip install .

juliancoy avatar Apr 06 '22 04:04 juliancoy

Sorry but it has to work on Linux to be merged, it shouldn't be too much work.

realitix avatar Apr 06 '22 09:04 realitix

win32 header has been manually removed from Linux headers
vulkan wrapper raster pipeline is working on Ubuntu, with my library "vulkanese"
image
https://github.com/julianfl0w/vulkanese

Raytrace pipeline is failing at the final step, with error

NameError: name 'vkCreateRayTracingPipelinesKHR' is not defined

This behavior is consistent in Windows and Linux. Perhaps an issue with Extension functions in the new XML

juliancoy avatar Apr 13 '22 07:04 juliancoy

using VENV setup on Linux, Conda environment.yml on Windows

juliancoy avatar Apr 13 '22 07:04 juliancoy

RayTrace bug is killing me. Could you kindly review my build procedure diagram? I believe the issue lies therein https://github.com/julianfl0w/vulkan/blob/master/README.md#architecture

juliancoy avatar Apr 15 '22 03:04 juliancoy

solved it. I simply needed to use vkGetInstanceProcAddr function. please try now

juliancoy avatar Apr 15 '22 05:04 juliancoy

@realitix can this be merged ?

okuma10 avatar Apr 23 '22 17:04 okuma10

@okuma10 have you been able to successfully test my fork on your machine? I am currently dealing with an obscure bug involving vkGetBufferDeviceAddress, a requirement of raytracing

juliancoy avatar Apr 23 '22 18:04 juliancoy

@julianfl0w no, sadly I'm a bit of a noob at this and I don't know how to install your fork on my machine. That's why I'm hoping this gets in to pyVulkan's master.

okuma10 avatar Apr 23 '22 21:04 okuma10

try pip install git+https://github.com/julianfl0w/vulkan

juliancoy avatar Apr 23 '22 21:04 juliancoy

Hello, I tried again and I got this error now:

python example_sdl2.py 
Traceback (most recent call last):
  File "/home/realitix/git/vulkan/example/example_sdl2.py", line 11, in <module>
    from vulkan import *
  File "/home/realitix/git/vulkan/venv/lib/python3.10/site-packages/vulkan-1.1.99.1-py3.10.egg/vulkan/__init__.py", line 1, in <module>
    from vulkan._vulkan import * # noqa
  File "/home/realitix/git/vulkan/venv/lib/python3.10/site-packages/vulkan-1.1.99.1-py3.10.egg/vulkan/_vulkan.py", line 99, in <module>
    if "nt" in os.name.lower() or "win" in os.platform.lower():
AttributeError: module 'os' has no attribute 'platform'

You should directly use the module platform and not os.platform. Can you update your patch ?

realitix avatar Apr 27 '22 08:04 realitix

i introduced that bug recently. please try now. i've just tested on linux ive started my own DLL/SO + Header wrapper, because vkGetBufferDeviceAddress is segfaulting and it is difficult to debug when accessed as a wrapped function

juliancoy avatar Apr 27 '22 13:04 juliancoy

Hello @julianfl0w, thanks for the update. I tried with your last revision and now I have this error:

Traceback (most recent call last):
  File "/home/realitix/git/vulkan/example/example_sdl2.py", line 11, in <module>
    from vulkan import *
  File "/home/realitix/git/vulkan/.venv/lib/python3.10/site-packages/vulkan-1.1.99.1-py3.10.egg/vulkan/__init__.py", line 1, in <module>
    from vulkan._vulkan import * # noqa
  File "/home/realitix/git/vulkan/.venv/lib/python3.10/site-packages/vulkan-1.1.99.1-py3.10.egg/vulkan/_vulkan.py", line 104, in <module>
    lib = ffi.dlopen(name)
OSError: cannot load library '/home/realitix/git/vulkan/.venv/lib/python3.10/site-packages/vulkan-1.1.99.1-py3.10.egg/vulkan/libvulkan.so': /home/realitix/git/vulkan/.venv/lib/python3.10/site-packages/vulkan-1.1.99.1-py3.10.egg/vulkan/libvulkan.so: cannot open shared object file: No such file or directory

realitix avatar May 09 '22 16:05 realitix

just some git trouble. try now

juliancoy avatar May 10 '22 13:05 juliancoy

It works now.

realitix avatar May 11 '22 14:05 realitix

The code is hard to review because you lanched the generator, can you create the patch without launching the generator, in order to get only the difference in the patch. And in another commit, we can launch the generator to split it in 2 commits.

Moreover, can you change theses elements:

  • Remove useless print
  • Remove useless comment
  • Use underscore naming style for variable and function names (my_function instead of myFunction)

Thanks a lot for your work.

realitix avatar May 11 '22 15:05 realitix

code has been simplified and updated to realitix conventions. retested on Windows and Linux. GetBufferDeviceAddress command is still segfaulting, but the raster engine is working well.

I have begun a project to turn (dll/so + c header) into a python library, (IE. without vk.xml) using Python's own ctypes. This schema is at once more maintainable and more generic. However, this project has presented difficulty, and been shelved for now as SODLL https://github.com/julianfl0w/sodll

I am now investigating use of CuPy for my (simple) raytracing ambitions

juliancoy avatar May 17 '22 16:05 juliancoy

can you clarify your concerns with the generator? ive not made architectural changes there

juliancoy avatar May 17 '22 16:05 juliancoy

any progress on this? @realitix

okuma10 avatar Jun 13 '22 08:06 okuma10

I think it would be simpler to split the PR :

  • Update to Vulkan 3
  • Add the Windows installation

I have looked at the Vulkan 3 part, and I have obtained something slightly different for the generator.

mathrack avatar Jun 14 '22 11:06 mathrack

is this issue dead?

okuma10 avatar Jul 18 '22 19:07 okuma10

I'm poking this thread again

okuma10 avatar Jul 31 '22 22:07 okuma10

It's updated now.

realitix avatar Jan 18 '24 11:01 realitix