Issue 244302
Summary [SPIR-V] GLSL.std.450 calls on long vectors are split into 4-component pieces with SPV_EXT_long_vector
Labels backend:SPIR-V, SPIR-V, clang:HLSL:SPIRV
Assignees dnovillo
Reporter dnovillo
    With `SPV_EXT_long_vector` on Vulkan, the SPIR-V backend splits `GLSL.std.450` instructions on long vectors into 4-component pieces. The results are correct, but the code is 4-wide. I found this while enabling long vectors in the offload test suite ([offload-test-suite#1721](https://github.com/llvm/offload-test-suite/issues/1721)).

>From `sin.long-vector.32.test`:

    ByteAddressBuffer In0 : register(t0);
 RWByteAddressBuffer Out : register(u1);

    [numthreads(1,1,1)]
    void main() {
      Out.Store<vector<float, 16> >(0, sin(In0.Load<vector<float, 16> >(0)));
    }

    clang-dxc -spirv -fspv-target-env=vulkan1.3 -fspv-extension=DXC -fspv-extension=SPV_EXT_long_vector -T cs_6_0 -Fc - source.hlsl

The module declares the long-vector type and then calls `Sin` four times on `float4`:

    %6 = OpTypeInt 32 0
    %7 = OpTypeFloat 32
 %8 = OpConstant %6 16
    %9 = OpTypeVectorIdEXT %7 %8            ; vector<float, 16>
    %18 = OpTypeVector %7 4                 ; float4
 %422 = OpExtInst %18 %423 Sin %418
    %424 = OpExtInst %18 %423 Sin %419
 %425 = OpExtInst %18 %423 Sin %420
    %426 = OpExtInst %18 %423 Sin %421

[SPV_EXT_long_vector](https://github.khronos.org/SPIRV-Registry/extensions/EXT/SPV_EXT_long_vector.html) allows `GLSL.std.450` instructions on long vectors, so this could be one `Sin` on `%9`.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to