Version: dxcompiler.dll 1.9(5402-0d3ee6b5)(1.9.0.5402) - 1.9.0.5402 (0d3ee6b55-dirty)
Repro files: matrix_buffer_load.zip
dxc -T cs_6_0 -Zi -Qembed_debug -Od -Fc float4x4.ll float4x4.hlsl
RWStructuredBuffer<float4x4> buffer : register(u0);
[numthreads(1, 1, 1)]
void main()
{
float4x4 value = buffer[0];
float4x4 result = value * 2;
buffer[1] = result;
}
Actual
All 16 elements of value are live SSA values, but only the four produced by the first bufferLoad get a dbg.value:
%1 = call %dx.types.ResRet.f32 @dx.op.bufferLoad.f32(i32 68, %dx.types.Handle %buffer_UAV_structbuf, i32 0, i32 0)
%2 = extractvalue %dx.types.ResRet.f32 %1, 0
%3 = extractvalue %dx.types.ResRet.f32 %1, 1
%4 = extractvalue %dx.types.ResRet.f32 %1, 2
%5 = extractvalue %dx.types.ResRet.f32 %1, 3
%6 = call %dx.types.ResRet.f32 @dx.op.bufferLoad.f32(i32 68, %dx.types.Handle %buffer_UAV_structbuf, i32 0, i32 16)
%7 = extractvalue %dx.types.ResRet.f32 %6, 0
...
%20 = extractvalue %dx.types.ResRet.f32 %16, 3
; nothing for %7..%10, %12..%15, %17..%20
call void @llvm.dbg.value(metadata float %2, ...) ; var:"value" !DIExpression(DW_OP_bit_piece, 0, 32)
call void @llvm.dbg.value(metadata float %3, ...) ; var:"value" !DIExpression(DW_OP_bit_piece, 32, 32)
call void @llvm.dbg.value(metadata float %4, ...) ; var:"value" !DIExpression(DW_OP_bit_piece, 64, 32)
call void @llvm.dbg.value(metadata float %5, ...) ; var:"value" !DIExpression(DW_OP_bit_piece, 96, 32)
result on the other hand is computed rather than loaded, gets all 16 fragments.
| repro |
matrix |
elements |
fragments for value |
fragments for result |
float2x3.hlsl |
float2x3 |
6 |
4 |
6 |
float2x4.hlsl |
float2x4 |
8 |
4 |
8 |
float3x2.hlsl |
float3x2 |
6 |
4 |
6 |
float3x3.hlsl |
float3x3 |
9 |
4 |
9 |
float3x4.hlsl |
float3x4 |
12 |
4 |
12 |
float4x2.hlsl |
float4x2 |
8 |
4 |
8 |
float4x3.hlsl |
float4x3 |
12 |
4 |
12 |
float4x4.hlsl |
float4x4 |
16 |
4 |
16 |
int4x4.hlsl |
int4x4 |
16 |
4 |
16 |
half4x4.hlsl |
half4x4 |
16 |
4 |
16 |
double4x4.hlsl |
double4x4 |
16 |
4 |
16 |
float2x2 is unaffected because it has exactly four elements.
Expected
value should get one dbg.value per element, like result does.
Version:
dxcompiler.dll 1.9(5402-0d3ee6b5)(1.9.0.5402) - 1.9.0.5402 (0d3ee6b55-dirty)Repro files: matrix_buffer_load.zip
Actual
All 16 elements of
valueare live SSA values, but only the four produced by the firstbufferLoadget adbg.value:resulton the other hand is computed rather than loaded, gets all 16 fragments.valueresultfloat2x3.hlslfloat2x4.hlslfloat3x2.hlslfloat3x3.hlslfloat3x4.hlslfloat4x2.hlslfloat4x3.hlslfloat4x4.hlslint4x4.hlslhalf4x4.hlsldouble4x4.hlslfloat2x2is unaffected because it has exactly four elements.Expected
valueshould get onedbg.valueper element, likeresultdoes.