Skip to content

[Intel][DirectX] Failure to write final array value from CBuffer #933

@bob80905

Description

@bob80905

When targeting DXIL IR, Intel seems to consistently fail to write the third array's final value from a CBuffer containing 3 arrays into an output buffer containing a struct of 3 array members:

HLSL:

cbuffer CBArrays : register(b0) {
  uint16_t c1[2][2];
  float16_t c2[1];
  uint16_t4 c3[2];
}

struct Arrays {
  uint16_t c1[2][2];
  float16_t c2[1];
  uint16_t4 c3[2];
};

RWStructuredBuffer<Arrays> Out : register(u1);

[numthreads(1,1,1)]
void main() {
  Out[0].c1 = c1;
  Out[0].c2 = c2;
  Out[0].c3 = c3;
}

Setup:

---
Shaders:
  - Stage: Compute
    Entry: main
    DispatchSize: [1, 1, 1]
Buffers:
  - Name: CBArrays
    Format: Hex16
    Data: [
      0x0001, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A,
      0xffff, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A,
      0x1234, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A,
      0x0002, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A,
      0x3c00, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A,
      0x0001, 0x0002, 0x0003, 0x0004, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A,
      0x0005, 0x0006, 0x0007, 0x0008, 0x5A5A, 0x5A5A, 0x5A5A, 0x5A5A,
    ]
  - Name: Out
    Format: Hex16
    Stride: 26
    FillSize: 26
  - Name: ExpectedOut
    Format: Hex16
    Stride: 26
    Data: [
      0x0001,
      0xffff,
      0x1234,
      0x0002,
      0x3c00,
      0x0001, 0x0002, 0x0003, 0x0004,
      0x0005, 0x0006, 0x0007, 0x0008
    ]
Results:
  - Result: Test1
    Rule: BufferExact
    Actual: Out
    Expected: ExpectedOut
DescriptorSets:
  - Resources:
    - Name: CBArrays
      Kind: ConstantBuffer
      DirectXBinding:
        Register: 0
        Space: 0
      VulkanBinding:
        Binding: 0
    - Name: Out
      Kind: RWStructuredBuffer
      DirectXBinding:
        Register: 1
        Space: 0
      VulkanBinding:
        Binding: 1
...
#--- end

# RUN: split-file %s %t
# RUN: %dxc_target -fvk-use-dx-layout -enable-16bit-types -T cs_6_5 -Fo %t.o %t/source.hlsl
# RUN: %offloader %t/pipeline.yaml %t.o

We expect Data: [
0x0001,
0xffff,
0x1234,
0x0002,
0x3c00,
0x0001, 0x0002, 0x0003, 0x0004,
0x0005, 0x0006, 0x0007, 0x0008]

But the actual output is: Data: [
0x0001,
0xffff,
0x1234,
0x0002,
0x3c00,
0x0001, 0x0002, 0x0003, 0x0004,
0x0005, 0x0006, 0x0007, 0x0000

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions