Skip to content

Get Vulkan Device Failed on New Current Branch #347

@fangjunzhou

Description

@fangjunzhou

Most recent commit on main branch caused failure on Vulkan device when running slangpy tests:

~/personal/slangpy (feat-flake-and-uv-support ✗) pytest tests
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.12.10, pytest-8.3.5, pluggy-1.5.0
rootdir: /home/fangjun/personal/slangpy
configfile: pyproject.toml
plugins: xdist-3.6.1, cov-6.1.1
collected 1581 items / 5 skipped                                                                                                                                                            

tests/slangpy/core/test_bitmap.py .....................................                                                                                                               [  2%]
tests/slangpy/core/test_crypto.py .                                                                                                                                                   [  2%]
tests/slangpy/core/test_data_struct.py .............................................................................................................................................. [ 11%]
...............................                                                                                                                                                       [ 13%]
tests/slangpy/core/test_logger.py ..s.                                                                                                                                                [ 13%]
tests/slangpy/core/test_platform.py ...                                                                                                                                               [ 13%]
tests/slangpy/core/test_timer.py ...                                                                                                                                                  [ 13%]
tests/slangpy/device/slang/test_atomics.py ssssFsFs^C

========================================================================================= FAILURES ==========================================================================================
__________________________________________________________________________ test_buffer_add_f32[DeviceType.vulkan] ___________________________________________________________________________

device_type = DeviceType.vulkan

    @pytest.mark.parametrize("device_type", helpers.DEFAULT_DEVICE_TYPES)
    def test_buffer_add_f32(device_type: spy.DeviceType):
        if device_type in [spy.DeviceType.metal, spy.DeviceType.cuda]:
            pytest.skip("InterlockedAddF32 not supported")
    
>       device = helpers.get_device(device_type)

tests/slangpy/device/slang/test_atomics.py:83: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

type = DeviceType.vulkan, use_cache = True

    def get_device(type: spy.DeviceType, use_cache: bool = True) -> spy.Device:
        if use_cache and type in DEVICE_CACHE:
            return DEVICE_CACHE[type]
>       device = spy.Device(
            type=type,
            enable_debug_layers=True,
            compiler_options={
                "include_paths": [SHADER_DIR],
                "debug_info": spy.SlangDebugInfoLevel.standard,
            },
        )
E       RuntimeError: Invalid enum value 3
E       /home/fangjun/personal/slangpy/src/sgl/../sgl/core/enum.h:42 in function enum_to_string<sgl::Feature>

tests/slangpy/device/sglhelpers.py:54: RuntimeError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
[INFO] (rhi) layer: CreateDevice: Debug layer is enabled.
[WARN] No supported shader model found, pretending to support sm_6_0.
__________________________________________________________________________ test_buffer_add_u64[DeviceType.vulkan] ___________________________________________________________________________

device_type = DeviceType.vulkan

    @pytest.mark.parametrize("device_type", helpers.DEFAULT_DEVICE_TYPES)
    def test_buffer_add_u64(device_type: spy.DeviceType):
        if device_type in [spy.DeviceType.metal, spy.DeviceType.cuda]:
            pytest.skip("InterlockedAdd64 not supported")
    
>       device = helpers.get_device(device_type)

tests/slangpy/device/slang/test_atomics.py:109: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

type = DeviceType.vulkan, use_cache = True

    def get_device(type: spy.DeviceType, use_cache: bool = True) -> spy.Device:
        if use_cache and type in DEVICE_CACHE:
            return DEVICE_CACHE[type]
>       device = spy.Device(
            type=type,
            enable_debug_layers=True,
            compiler_options={
                "include_paths": [SHADER_DIR],
                "debug_info": spy.SlangDebugInfoLevel.standard,
            },
        )
E       RuntimeError: Invalid enum value 3
E       /home/fangjun/personal/slangpy/src/sgl/../sgl/core/enum.h:42 in function enum_to_string<sgl::Feature>

tests/slangpy/device/sglhelpers.py:54: RuntimeError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
[INFO] (rhi) layer: CreateDevice: Debug layer is enabled.
[WARN] No supported shader model found, pretending to support sm_6_0.
================================================================================== short test summary info ==================================================================================
FAILED tests/slangpy/device/slang/test_atomics.py::test_buffer_add_f32[DeviceType.vulkan] - RuntimeError: Invalid enum value 3
FAILED tests/slangpy/device/slang/test_atomics.py::test_buffer_add_u64[DeviceType.vulkan] - RuntimeError: Invalid enum value 3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! KeyboardInterrupt !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
/home/fangjun/personal/slangpy/.venv/lib/python3.12/site-packages/pluggy/_manager.py:120: KeyboardInterrupt
(to show a full traceback on KeyboardInterrupt use --full-trace)
========================================================================= 2 failed, 220 passed, 12 skipped in 2.65s =========================================================================

The error is narrowed down to this line:

https://github.com/shader-slang/slangpy/blob/630de94b3fc0722627f00051eb2fd20e5c8c9a01/src/sgl/device/device.cpp#L179

It also seems that RHI failed to find any vulkan devices.

Checking out to commits before 2beb521 seems to fix the problem for me. I'm still looking into the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions