Giter Site home page Giter Site logo

Comments (5)

rjodinchr avatar rjodinchr commented on June 9, 2024

Is there a reason not to use clvk?
If you want to continue with your own vulkan code to iteract with code generated by clspv, I would advise to start by parsing the non semantic reflections that are inside the SPIR-V code.
When you disassemble z_generated.cl.spv with spirv-dis, you will find that information at the end (note that you can get that information using spirv-tools without having to disassemble):

        %176 = OpExtInst %void %172 Kernel %22 %173 %uint_6 %uint_0 %174
        %177 = OpExtInst %void %172 PropertyRequiredWorkgroupSize %176 %uint_1 %uint_1 %uint_1
        %179 = OpExtInst %void %172 ArgumentInfo %178
        %180 = OpExtInst %void %172 ArgumentStorageBuffer %176 %uint_1 %uint_0 %uint_0 %179
        %183 = OpExtInst %void %172 Kernel %37 %181 %uint_6 %uint_0 %182
        %184 = OpExtInst %void %172 PropertyRequiredWorkgroupSize %183 %uint_256 %uint_1 %uint_1
        %186 = OpExtInst %void %172 ArgumentInfo %185
        %187 = OpExtInst %void %172 ArgumentStorageBuffer %183 %uint_0 %uint_0 %uint_1 %186
        %189 = OpExtInst %void %172 ArgumentInfo %188
        %190 = OpExtInst %void %172 ArgumentStorageBuffer %183 %uint_1 %uint_0 %uint_0 %189
        %192 = OpExtInst %void %172 ArgumentInfo %191
        %193 = OpExtInst %void %172 ArgumentPodPushConstant %183 %uint_2 %uint_0 %uint_4 %192
        %195 = OpExtInst %void %172 ArgumentInfo %194
        %197 = OpExtInst %void %172 ArgumentPodPushConstant %183 %uint_3 %uint_4 %uint_4 %195
        %199 = OpExtInst %void %172 ArgumentInfo %198
        %200 = OpExtInst %void %172 ArgumentPodPushConstant %183 %uint_4 %uint_8 %uint_4 %199
        %202 = OpExtInst %void %172 ArgumentInfo %201
        %205 = OpExtInst %void %172 ArgumentPodPushConstant %183 %uint_5 %uint_12 %uint_4 %202

from clspv.

FROL256 avatar FROL256 commented on June 9, 2024

Unfortunately yes, i need Vulkan itself. In general i need graphics features like ray tracing, dynamic descriptor indexing, BC compression and other. Therefore some kernels are unfortunately must be created with GLSL and bind with Vulkan directly. So, what basically i want from clspv is to have some kernels in OpenCL C and others in GLSL anyway.

Thank you very much for the advice. Could you please clarify what I need to pay attention to this disasm? I'm not very familiar with SPIR-V understanding )

from clspv.

rjodinchr avatar rjodinchr commented on June 9, 2024

You can find more information about each OpExtInst in the spirv-headers.

Basically, for the ArgumentPodPushConstant you want to make sure that you are using the correct offset. And for the ArgumentStorageBuffer you want to make sure you are using the same descriptorset and binding.

from clspv.

rjodinchr avatar rjodinchr commented on June 9, 2024

if you look at those 2 lines:

%187       = OpExtInst %void %172 ArgumentStorageBuffer  %183      %uint_0   %uint_0 %uint_1   %186
%190       = OpExtInst %void %172 ArgumentStorageBuffer  %183      %uint_1   %uint_0 %uint_0   %189
<spirv-id> = OpExtInst %void %172 ArgumentStorageBuffer <decl_id> <ordinal> <ds>    <binding> <arginfo>

You can see that the first argument of the kernel (ordinal 0) is set to the descriptorset 0 with binding 1, while the second arg (ordinal 1) is set to descriptor 0 with binding 0.
It can feel weird to have exchanged those 2, I don't know why clspv did that, there might be multiple reasons. But in the end, you need to stick to that mapping.

from clspv.

FROL256 avatar FROL256 commented on June 9, 2024

Thank you very much, understood!

from clspv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.