Code Monkey home page Code Monkey logo

Comments (3)

karolherbst avatar karolherbst commented on August 17, 2024

well with master the generated spirv looks like this:

; SPIR-V
; Version: 1.0
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 18
; Schema: 0
               OpCapability Addresses
               OpCapability Kernel
               OpCapability Int64
          %1 = OpExtInstImport "OpenCL.std"
               OpMemoryModel Physical64 OpenCL
               OpEntryPoint Kernel %8 "test_fn"
               OpSource OpenCL_C 200000
               OpName %res "res"
               OpName %v "v"
               OpName %entry "entry"
               OpName %arrayidx "arrayidx"
               OpDecorate %17 FuncParamAttr NoCapture
         %17 = OpDecorationGroup
               OpGroupDecorate %17 %res %v
       %uint = OpTypeInt 32 0
      %ulong = OpTypeInt 64 0
    %ulong_0 = OpConstant %ulong 0
    %ulong_1 = OpConstant %ulong 1
       %void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
     %v2uint = OpTypeVector %uint 2
%_ptr_CrossWorkgroup_v2uint = OpTypePointer CrossWorkgroup %v2uint
          %7 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_v2uint
          %8 = OpFunction %void None %7
        %res = OpFunctionParameter %_ptr_CrossWorkgroup_uint
          %v = OpFunctionParameter %_ptr_CrossWorkgroup_v2uint
      %entry = OpLabel
   %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %v %ulong_0 %ulong_1
         %16 = OpLoad %uint %arrayidx Aligned 4
               OpStore %res %16 Aligned 4
               OpReturn
               OpFunctionEnd

same issue still though

from spirv-llvm-translator.

robclark avatar robclark commented on August 17, 2024

hmm, I may be thinking about this a bit incorrectly.. Possibly:

         %15 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %10 %uint_0 %uint_1

is correct.. it seems a bit funny to think about accessing the (for ex) 15'th element of a vec2 (ie. if you had ((__global int *)v)[15]) but I guess the math should work out.

from spirv-llvm-translator.

karolherbst avatar karolherbst commented on August 17, 2024

@robclark yeah, I think our mistake was, that OpInBoundsPtrAccessChain isn't derefing anything, it simply does some pointer maths + casts to pointer to member type.

so the Base use used to do array indexing for example, because the pointer type stays the same and then you index and just add the offset to your last pointer value.

from spirv-llvm-translator.

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.