microsoft / microsoft/DirectXShaderCompiler

Link fails when using -Fd with -Qstrip_debug

Open
#5,737 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description
Linking a compute shader with the command-line DXC will error out if using -Fd and -Qstrip_debug together. This is not consistent with the compiler, which will output a PDB even if debug info is stripped from the object file.

Steps to Reproduce
Create a file named test.hlsl:

RWTexture2D<uint> rwTexResource[] : register(u0, space2400);
[numthreads(8, 8, 1)]
void main(uint3 dtid : SV_DispatchThreadID, uint3 gtid : SV_GroupThreadID, uint3 gid : SV_GroupID, uint gindex : SV_GroupIndex)
{
    rwTexResource[0][dtid.xy] = texResource.Load(dtid.xyz);
}

Run these commands:

dxc.exe -T lib_6_3 -Zi -Qstrip_reflect -Qembed_debug -Fd testc.pdb -Fo test.lib test.hlsl
dxc.exe -link -T lib_6_3 -Zi -Qstrip_reflect -Qstrip_debug -Fd test.pdb -Fo test.bin test.lib

Actual Behavior
DXC fails with error:
dxc failed : DXIL container does not contain the given part.

Environment

  • DXC version dxcompiler.dll: 1.7 - 1.7.2207.3 (e9137cd1d); dxil.dll: 1.7(101.7.2207.10)
  • Host Operating System Windows 10

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

Reproduce the failure with the two DXC commands and the supplied test.hlsl shader. Start by tracing the linker path used with -Qstrip_debug and -Fd, then verify how it handles the missing debug-related container part. Done means linking succeeds and produces test.pdb while retaining the requested stripping behavior.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.