Skip to content

Passing pointers to Input memory with Phi nodes triggers compilation failure #347

@Hugobros3

Description

@Hugobros3

The following snippet fails to compile with level-zero, but it's clearly an underlying compiler issue. I'm not sure if there is an easy way to run igc offline... Anyhow, I've bisected the problem to the OpPhi of type _ptr_Input_v3uint - removing it makes this compile just fine.

               OpCapability Kernel
               OpCapability Addresses
               OpCapability Int64
               OpCapability Linkage
               OpMemoryModel Physical64 OpenCL
               OpDecorate %7 Aliased
               OpDecorate %8 Aliased
               OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
       %uint = OpTypeInt 32 0
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
       %void = OpTypeVoid
          %5 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint
     %v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
%_ptr_Input_uint = OpTypePointer Input %uint
     %uint_0 = OpConstant %uint 0
%_mem__pu32_ = OpTypeStruct %uint
      %ulong = OpTypeInt 64 0
  %copy_krnl = OpFunction %void None %5
          %7 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
          %8 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%copy_krnl_0 = OpLabel
               OpBranch %cont
       %cont = OpLabel
       ; this opphi is problematic, if we replace %12 by %gl_GlobalInvocationID and comment it out, things work just fine
         %12 = OpPhi %_ptr_Input_v3uint %gl_GlobalInvocationID %copy_krnl_0
         %16 = OpAccessChain %_ptr_Input_uint %12 %uint_0
         %17 = OpLoad %uint %16
         %20 = OpBitcast %uint %17
         %21 = OpPtrAccessChain %_ptr_CrossWorkgroup_uint %7 %20
         %22 = OpLoad %uint %21 Aligned 4
         %23 = OpPtrAccessChain %_ptr_CrossWorkgroup_uint %8 %20
               OpStore %23 %22 Aligned 4
               OpReturn
               OpFunctionEnd

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions