Skip to content

linking two spirvs produces with opaque ptrs fails #2153

@airlied

Description

@airlied

I'm not sure if this is here or spirv-tools but I'll start here.

Mesa has an intel_clc tool that is used to convert some CL kernels to intel gpu asm at build time. It wraps clang and spirv-llvm-translator and then does some spirv linking and reads it all into mesa NIR and the intel nir backend.

This fails at the moment due to opaque ptrs but I'm not sure how best to fix it:

# env MESA_SHADER_CACHE_DISABLE=true /builddir/build/BUILD/mesa-bd0d3c7b1c61e834e563f7f1c0c9ff553661cbd0/redhat-linux-build/src/intel/compiler/intel_clc -p dg2 --prefix gfx125_bvh_build_leaf_create_HW_instance_nodes -e create_HW_instance_nodes --in ../src/intel/vulkan/grl/gpu/bvh_build_leaf.cl --in /builddir/build/BUILD/mesa-bd0d3c7b1c61e834e563f7f1c0c9ff553661cbd0/src/intel/vulkan/grl/gpu/libs/lsc_intrinsics_fallback.cl -o src/intel/vulkan/grl/gfx125_bvh_build_leaf_create_HW_instance_nodes.h -- -cl-std=cl2.0 -D__OPENCL_VERSION__=200 -DMAX_HW_SIMD_WIDTH=16 -DMAX_WORKGROUP_SIZE=16 -I/builddir/build/BUILD/mesa-bd0d3c7b1c61e834e563f7f1c0c9ff553661cbd0/src/intel/vulkan/grl/gpu -I/builddir/build/BUILD/mesa-bd0d3c7b1c61e834e563f7f1c0c9ff553661cbd0/src/intel/vulkan/grl/include -include opencl-c.h (file=input,line=0,column=0,index=0): Type mismatch on symbol "store_uint4_L1WB_L3WB" between imported variable/function %77 and exported variable/function %9649.

this is because store_uint4_L1WB_L3WB in one unit,
%76 = OpTypeFunction %void %_ptr_CrossWorkgroup_struct_Quad %uint %v4uint

and the other
%1540 = OpTypeFunction %void %_ptr_CrossWorkgroup_v4uint %uint %v4uint

this is because the translator tries to work out from the caller what the correct type is
%arrayidx67 = getelementptr inbounds %struct.Quad, ptr addrspace(1) %1065, i64 %idxprom66 store ptr addrspace(1) %arrayidx67, ptr %dst, align 8 %1067 = load ptr addrspace(1), ptr %dst, align 8 %1068 = load <4 x i32>, ptr %pack0, align 16 call spir_func void @store_uint4_L1WB_L3WB(ptr addrspace(1) noundef %1067, i32 noundef 0, <4 x i32> noundef %1068) #8
but there is really no info to reconstruct that it wants a v4uint not a struct Quad

Anyone want to hazard a guess at where this could be solved?

Metadata

Metadata

Assignees

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