You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FixesKhronosGroup#6156
before this fix the pass will optimize the following code:
```
%v = OpVariable %_ptr_Private_uint Private %uint_0
%load_thread_local = OpFunction %void None %function_type__1561_
%37 = OpLabel
%31 = OpVariable %_ptr_Function__ptr_Private_uint Function
%32 = OpVariable %_ptr_Function_uint Function
%33 = OpVariable %_ptr_Function_uint Function
OpStore %31 %v
%34 = OpLoad %_ptr_Private_uint %31
%35 = OpLoad %uint %34
OpStore %32 %35
%36 = OpLoad %uint %v
OpStore %33 %36
OpReturn
OpFunctionEnd
```
to this:
```
%load_thread_local = OpFunction %void None %function_type__1561_
%37 = OpLabel
%v = OpVariable %_ptr_Function_uint Function %uint_0
%31 = OpVariable %_ptr_Function__ptr_Private_uint Function
%32 = OpVariable %_ptr_Function_uint Function
%33 = OpVariable %_ptr_Function_uint Function
OpStore %31 %v
OpStore %32 %uint_0
OpStore %33 %uint_0
OpReturn
OpFunctionEnd
```
resulting in the following error:
```
error: line 81: OpStore Pointer <id> '31[%31]'s type does not match Object <id> '47[%v]'s type.
OpStore %31 %v
```
private_to_local_pass does not update the storage class of the double
pointer %31 correctly. It currently doesn't have enough context to tell
if %31 is later loaded from and used to store with. For now, just prevent
the optimization if the address of the private variable is used as the
object operand of the OpStore instruction.
with this commit, the spirv code is optimized to this:
```
%v = OpVariable %_ptr_Private_uint Private %uint_0
%load_thread_local = OpFunction %void None %function_type__1561_
%37 = OpLabel
%31 = OpVariable %_ptr_Function__ptr_Private_uint Function
%32 = OpVariable %_ptr_Function_uint Function
%33 = OpVariable %_ptr_Function_uint Function
OpStore %31 %v
%35 = OpLoad %uint %v
OpStore %32 %35
%36 = OpLoad %uint %v
OpStore %33 %36
OpReturn
OpFunctionEnd
```
0 commit comments