Skip to content

Instantly share code, notes, and snippets.

@jenatali
Created September 15, 2021 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jenatali/f7efd1e376ac2b20467efe1d6c8bd44e to your computer and use it in GitHub Desktop.
Save jenatali/f7efd1e376ac2b20467efe1d6c8bd44e to your computer and use it in GitHub Desktop.
; SPIR-V
; Version: 1.0
; Generator: Khronos; 17
; Bound: 41
; Schema: 0
OpCapability Addresses
OpCapability Kernel
OpCapability Int64
OpCapability ImageBasic
%1 = OpExtInstImport "OpenCL.std"
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %2 "main_test" %__spirv_BuiltInGlobalInvocationId
%4 = OpString "kernel_arg_type.main_test.image2d_t,image2d_t,"
OpSource OpenCL_C 102000
OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId"
OpName %input "input"
OpName %output "output"
OpName %entry "entry"
OpName %input_addr "input.addr"
OpName %output_addr "output.addr"
OpName %coords "coords"
OpName %_compoundliteral ".compoundliteral"
OpName %call "call"
OpName %conv "conv"
OpName %vecinit "vecinit"
OpName %call1 "call1"
OpName %conv2 "conv2"
OpName %vecinit3 "vecinit3"
OpName %call4 "call4"
OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId
OpDecorate %__spirv_BuiltInGlobalInvocationId Constant
OpDecorate %input_addr Alignment 8
OpDecorate %output_addr Alignment 8
OpDecorate %coords Alignment 8
OpDecorate %_compoundliteral Alignment 8
%ulong = OpTypeInt 64 0
%uint = OpTypeInt 32 0
%v3ulong = OpTypeVector %ulong 3
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
%void = OpTypeVoid
%24 = OpTypeImage %void 2D 0 0 0 0 Unknown ReadOnly
%25 = OpTypeImage %void 2D 0 0 0 0 Unknown WriteOnly
%26 = OpTypeFunction %void %24 %25
%_ptr_Function_24 = OpTypePointer Function %24
%_ptr_Function_25 = OpTypePointer Function %25
%v2uint = OpTypeVector %uint 2
%_ptr_Function_v2uint = OpTypePointer Function %v2uint
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3ulong Input
%33 = OpUndef %v2uint
%2 = OpFunction %void DontInline %26
%input = OpFunctionParameter %24
%output = OpFunctionParameter %25
%entry = OpLabel
%input_addr = OpVariable %_ptr_Function_24 Function
%output_addr = OpVariable %_ptr_Function_25 Function
%coords = OpVariable %_ptr_Function_v2uint Function
%_compoundliteral = OpVariable %_ptr_Function_v2uint Function
OpStore %input_addr %input Aligned 8
OpStore %output_addr %output Aligned 8
%34 = OpLoad %v3ulong %__spirv_BuiltInGlobalInvocationId Aligned 32
%call = OpCompositeExtract %ulong %34 0
%conv = OpUConvert %uint %call
%vecinit = OpCompositeInsert %v2uint %conv %33 0
%35 = OpLoad %v3ulong %__spirv_BuiltInGlobalInvocationId Aligned 32
%call1 = OpCompositeExtract %ulong %35 1
%conv2 = OpUConvert %uint %call1
%vecinit3 = OpCompositeInsert %v2uint %conv2 %vecinit 1
OpStore %_compoundliteral %vecinit3 Aligned 8
%36 = OpLoad %v2uint %_compoundliteral Aligned 8
OpStore %coords %36 Aligned 8
%37 = OpLoad %25 %output_addr Aligned 8
%38 = OpLoad %v2uint %coords Aligned 8
%39 = OpLoad %24 %input_addr Aligned 8
%40 = OpLoad %v2uint %coords Aligned 8
%call4 = OpImageRead %v4float %39 %40
OpImageWrite %37 %38 %call4
OpReturn
OpFunctionEnd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment