microsoft / microsoft/DirectXShaderCompiler

[SPIR-V] Embedding debug info from shader source with non Latin letters causes exception

Open
#6,948 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description
Attempting to generate spirv byte code with debug information inside the binary crashes when the input file path contains non-latin text. Resulting in an internal compiler error to be reported. Except when specifying vulkan-with-source

Steps to Reproduce

# Crash
dxc.exe hlsl_頂点.hlsl -spirv -T vs_6_0 -Qembed_debug -Zi

# No Crash, no spirv flag set
dxc.exe hlsl_頂点.hlsl -T vs_6_0 -Qembed_debug -Zi

# Crash 
dxc.exe hlsl_頂点.hlsl -spirv -T vs_6_0 -fspv-debug=file
dxc.exe hlsl_頂点.hlsl -spirv -T vs_6_0 -fspv-debug=line
dxc.exe hlsl_頂点.hlsl -spirv -T vs_6_0 -fspv-debug=source

# Interestingly,  this results in *no* crash 
dxc.exe hlsl_頂点.hlsl -spirv -T vs_6_0 -fspv-debug=vulkan-with-source

Source code inside the hlsl file is a simple text shader which just passes information to next stage

struct VS_OUTPUT {
    float4 pos : POSITION;
};

struct VS_INPUT {
    float4 pos : POSITION;
};

VS_OUTPUT main(const VS_INPUT vs_input) {
    VS_OUTPUT vs_out;
    vs_out.pos = vs_input.pos;
    return vs_out;
}

Actual Behavior
The compiler only outputs this text on the runs which crash

Internal compiler error: access violation. Attempted to read from address 0x00000000000000A8

Environment

  • DXC version: dxcompiler.dll: 1.8 - 1.8.2407.7 (416fab6b5); dxil.dll: 1.8(101.8.2407.12)
  • 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 listed dxc.exe commands using a non-Latin shader filename, then compare the SPIR-V debug-information modes with the non-SPIR-V and vulkan-with-source cases. Trace the compiler's SPIR-V debug-info handling to identify the access violation; done means all listed modes compile successfully without 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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.