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

How to get spir-v with OpCapability Kernel? #1094

Open
jczaja opened this issue Sep 22, 2023 · 2 comments
Open

How to get spir-v with OpCapability Kernel? #1094

jczaja opened this issue Sep 22, 2023 · 2 comments

Comments

@jczaja
Copy link

jczaja commented Sep 22, 2023

Hi,

I have a dummy compute kernel:

#[spirv(compute(threads(768)))]
pub fn main_cs(
    #[spirv(global_invocation_id)] id: UVec3,
    #[spirv(storage_buffer, descriptor_set = 0, binding = 0)] prime_indices: &mut [u32],
) {
    let index = id.x as usize;
    prime_indices[index] = collatz(prime_indices[index]).1u32;
}

I can run it using Vulkano abd it works, but I wanted to run this spir-v kernel using Intel Level Zero and this did not work. Problem is that Intel Level zero is OpenCL like API and it require that SPIR-V is :

OpCapability Kernel
OpMemoryModel Physical64 OpenCL
..

while my dummy compute kernel as SPIR-V contains:

OpCapability Shader 
OpMemoryModel Logical Simple 
...

How can I compiler my rust compute shader so it is of SPIR-V form OpCapability Kernel ?

@JoelCourtney
Copy link

JoelCourtney commented Oct 10, 2023

I believe you do it in the spirv builder interface.

SpirvBuilder::new(<path_to_crate>, <target>)
        .capability(Capability::Kernel)
        .build()?

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
@jczaja @JoelCourtney and others