Skip to content

[Intel][DirectX] Failure to write third scalar value from CBuffer #932

@bob80905

Description

@bob80905

When targeting DXIL IR, Intel seems to consistently fail to write the third scalar value from a CBuffer containing 3 scalars into an output buffer containing a struct of 3 scalar members:

HLSL:

cbuffer CBScalars : register(b0) {
  float16_t a1;
  uint16_t a2;
  int16_t a3;
}

struct Scalars {
  float16_t a1;
  uint16_t a2;
  int16_t a3;
};

RWStructuredBuffer<Scalars> Out : register(u1);

[numthreads(1,1,1)]
void main() {
  Out[0].a1 = a1;
  Out[0].a2 = a2;
  Out[0].a3 = a3;
}

Setup:

---
Shaders:
  - Stage: Compute
    Entry: main
    DispatchSize: [1, 1, 1]
Buffers:
  - Name: CBScalars
    Format: Hex16
    Data: [ 0x3c00, 0x0001, 0xffff ]
  - Name: Out
    Format: Hex16
    Stride: 6
    FillSize: 6
DescriptorSets:
  - Resources:
    - Name: CBScalars
      Kind: ConstantBuffer
      DirectXBinding:
        Register: 0
        Space: 0
      VulkanBinding:
        Binding: 0
    - Name: Out
      Kind: RWStructuredBuffer
      DirectXBinding:
        Register: 1
        Space: 0
      VulkanBinding:
        Binding: 1

# 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 | FileCheck %s
...

We expect Data: [ 0x3C00, 0x1, 0xFFFF ]
But the actual output is: Data: [ 0x3C00, 0x1, 0x0 ]

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