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

Slang crashes during link when attempting to call a kernel function from another function #5590

Open
ccummingsNV opened this issue Nov 19, 2024 · 0 comments

Comments

@ccummingsNV
Copy link
Contributor

ccummingsNV commented Nov 19, 2024

When attempting to call a function tagging as a compute shader from another function, slang crashes during link.

Expected behaviour: Slang should either allow this, or report a compile error.

The module in the following SGL test case reproduces the crash in the call to link_program. Debugging c++, the crash was inside IDevice::createProgram

`
def test_call_kernel_function(test_id: str, device_type: sgl.DeviceType):
device = helpers.get_device(type=device_type)

# Loading a valid module must succeed
module = device.load_module_from_source(
    module_name=f"test_call_kernel_function_{test_id}",
    source="""
    [shader("compute")]
    [numthreads(1, 1, 1)]
    void foo_kernel(uint3 tid: SV_DispatchThreadID, uniform int x) { }

    [shader("compute")]
    [numthreads(1, 1, 1)]
    void main_kernel(uint3 tid: SV_DispatchThreadID, uniform int x)
    {
        foo_kernel(tid, x);
    }

""",
)
assert len(module.entry_points) == 2
main = module.entry_point("main_kernel")
assert main.name == "main_kernel"
device.link_program([module], [main])

`

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