Skip to content

[SER] Incomprehensible error from initializing const payload in a certain way and using it in Invoke #7761

@Hengoo

Description

@Hengoo

Description

When creating a const payload via = {...} initialization and then use it to call Invoke you get a validation error that is quite unhelpful.
I suspect from the way the error is written, that it is not something that is expected to be triggered via mistakes in hlsl code.

Note: This issue might be related to #7760

Steps to Reproduce

// Disabled payload access qualifier just do hide a warning. It also fails with the same error when PAQ are enabled
struct Payload {
    float value;
};

[shader("raygeneration")]
void RayGen()
{
    RayDesc ray;
    // Removing the const fixes the validation error
    // Initializing p via an existing struct fixes the validation error
    const Payload p = {0.0};
    dx::HitObject obj = dx::HitObject::MakeMiss(0, 0, ray);
    // Removing this invoke fixes the validation error
    dx::HitObject::Invoke(obj, p);
}

-T lib_6_9 -disable-payload-qualifiers

https://godbolt.org/z/aT8hK9r4d

Actual Behavior

Compilation failed with Error message:

error: validation errors
Function: �?RayGen@@YAXXZ: error: Instructions must be of an allowed type.
note: at 'unreachable' in block '#0' of function '�?RayGen@@YAXXZ'.
Validation failed.


Compiler returned: 5

I would expect an error message similar to (just an example error on a test function)

<source>:20:5: error: no matching function for call to 'test'
    test(p);
    ^~~~
<source>:6:6: note: candidate function not viable: 1st argument ('__restrict Payload') would lose restrict qualifier
void test(inout Payload p) {
     ^

Something that tells you what / where the mistake is.

Environment

  • DXC version: dxcompiler.dll: 1.9 - 1.8.2505.32 (b106a96); dxil.dll: 1.9(1.8.2505.32)

Metadata

Metadata

Assignees

Labels

bugBug, regression, crashneeds-triageAwaiting triage

Type

No type

Projects

Status

Triaged

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions