microsoft / microsoft/DirectXShaderCompiler

Poor compiler failure mode for invalid GetGroupNodeOutputRecords() uniformity

Open
#7,498 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug diagnostic
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

Description
The spec for GetGroupNodeOutputRecords() says calls and arguments must be uniform:

https://github.com/microsoft/DirectX-Specs/blob/master/d3d/WorkGraphs.md#getgroupnodeoutputrecords

A case like this, however, fails compilation (apparently for good reason):

     GroupNodeOutputRecords<OutputPayload> out_payload_fe =
    (svGroupId.x == 1) ? out_fe.GetGroupNodeOutputRecords(7) : out_fe.GetGroupNodeOutputRecords(recordCount + 4);

The failure manifests as "Internal Compiler error:" though. At minimum there should be better reporting of the situation here. Perhaps the spec can carve out this type of situation as well, but might not be necessary if a good compiler error message can do the job (and thus hint to applications how to refactor their code to get around it).

The diagnostic improvements should hopefully apply to any case where this situation may apply, likely many more cases than just GetGroupNodeOutputRecords().

Steps to Reproduce
Compile attached shader, e.g. dxc /T lib_6_8 PhiRepro.txt

Actual Behavior
Internal compiler error. User would be lost.

Environment

  • DXC version 1.9 - 1.8.0.1 (2835e80b); dxil.dll: 1.9(1.8.2505.27)
  • Host Operating System Win11

PhiRepro.txt

https://godbolt.org/z/fYohvjEnE

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by compiling the attached PhiRepro.txt with dxc /T lib_6_8 and compare the result with the Godbolt reproduction. Trace the diagnostic path for invalid uniformity in GetGroupNodeOutputRecords() and related cases; done means the compiler reports an actionable user-facing error instead of an internal compiler error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.