================
@@ -34,18 +36,14 @@ void main(unsigned GI : SV_GroupIndex) {
Out2[GI] = In[GI];
#endif
- // For SPIR-V, the addrspacecast comes from `S::operator=` member function,
which expects
- // parameters in address space 0. This is why hlsl_device is a sub address
- // space of the default address space.
- // SPV: %[[INPTR:.*]] = call noundef align 1 dereferenceable(4) ptr
addrspace(11)
@llvm.spv.resource.getpointer.p11.tspirv.VulkanBuffer_a0s_struct.Ss_12_1t.i32(target("spirv.VulkanBuffer",
[0 x %struct.S], 12, 1) %{{.*}}, i32 %{{.*}})
- // SPV: %[[INCAST:.*]] = addrspacecast ptr addrspace(11) %[[INPTR]] to ptr
// SPV: %[[OUTPTR:.*]] = call noundef align 1 dereferenceable(4) ptr
addrspace(11)
@llvm.spv.resource.getpointer.p11.tspirv.VulkanBuffer_a0s_struct.Ss_12_1t.i32(target("spirv.VulkanBuffer",
[0 x %struct.S], 12, 1) %{{.*}}, i32 %{{.*}})
- // SPV: %[[OUTCAST:.*]] = addrspacecast ptr addrspace(11) %[[OUTPTR]] to ptr
- // SPV: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %[[OUTCAST]], ptr align
1 %[[INCAST]], i64 4, i1 false)
+ // SPV: %[[INPTR:.*]] = call noundef align 1 dereferenceable(4) ptr
addrspace(11)
@llvm.spv.resource.getpointer.p11.tspirv.VulkanBuffer_a0s_struct.Ss_12_1t.i32(target("spirv.VulkanBuffer",
[0 x %struct.S], 12, 1) %{{.*}}, i32 %{{.*}})
+ // SPV: call void @llvm.memcpy.p11.p11.i64(ptr addrspace(11) align 1
%[[OUTPTR]], ptr addrspace(11) align 1 %[[INPTR]], i64 4, i1 false)
----------------
s-perron wrote:
In the past, `memcpy` has caused problems. Because the pointers are technically
`void*` in memcpy, the llvm optimizer is free to create different code for it.
It will sometimes replace it with loads and stores of i64 if the size is
64-bits. Then we end up with type mismatches in the generated spir-v.
If the `memcpy` stays as a memcpy, it will be turned into `OpCopyMemory`, which
will work.
https://github.com/llvm/llvm-project/pull/194989
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits