Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with exported matrices in DxcLinker #4880

Closed
cheneym2 opened this issue Aug 20, 2024 · 3 comments
Closed

Problem with exported matrices in DxcLinker #4880

cheneym2 opened this issue Aug 20, 2024 · 3 comments
Labels
goal:quality & productivity Quality issues and issues that impact our productivity coding day to day inside slang kind:bug something doesn't work like it should

Comments

@cheneym2
Copy link
Collaborator

First, compile a dxil library that uses the float4x4 matrix type.

$ cat ./lib.slang
module "repro";

export float4x4 to4x4(float3x4 source)
{
    return float4x4(source[0], source[1], source[2], float4(0.0f, 0.0f, 0.0f, 1.0f));
}
$ ./build/Release/bin/slangc.exe ./lib.slang -profile lib_6_6 -o lib.dxil
<success>

Now compile an "anyhit" shader including that precompiled library as a reference so it gets linked in, tickling the DxcLinker usage.

$ cat ./anyhit.slang
struct Attributes
{
    float2 bary;
};

struct ShadowHitInfo
{
    bool isHit;
    uint seed;
};

[shader("anyhit")]
void shadow(inout ShadowHitInfo payload, Attributes attrib)
{
    IgnoreHit();
}
$ ./build/Release/bin/slangc.exe ./anyhit.slang -stage anyhit -entry shadow -o out2.dxil -r lib.dxil
dxc 1.7: : error : error: validation errors
Function: ?to4x4_0@@YA?AV?$matrix@M$03$03@@V?$matrix@M$02$03@@@Z: error: ExtractValue should only be used on dxil struct types and cmpxchg.
note: at '%2 = extractvalue %class.matrix.float.3.4 %0, 0, 0' in block '#0' of function '?to4x4_0@@YA?AV?$matrix@M$03$03@@V?$matrix@M$02$03@@@Z'.
Function: ?to4x4_0@@YA?AV?$matrix@M$03$03@@V?$matrix@M$02$03@@@Z: error: ExtractValue should only be used on dxil struct types and cmpxchg.
note: at '%7 = extractvalue %class.matrix.float.3.4 %0, 0, 1' in block '#0' of function '?to4x4_0@@YA?AV?$matrix@M$03$03@@V?$matrix@M$02$03@@@Z'.
Function: ?to4x4_0@@YA?AV?$matrix@M$03$03@@V?$matrix@M$02$03@@@Z: error: ExtractValue should only be used on dxil struct types and cmpxchg.
note: at '%12 = extractvalue %class.matrix.float.3.4 %0, 0, 2' in block '#0' of function '?to4x4_0@@YA?AV?$matrix@M$03$03@@V?$matrix@M$02$03@@@Z'.
Function: ?to4x4_0@@YA?AV?$matrix@M$03$03@@V?$matrix@M$02$03@@@Z: error: Instructions must be of an allowed type.
note: at '%18 = insertvalue %class.matrix.float.4.4 undef, <4 x float> %17, 0, 0' in block '#0' of function '?to4x4_0@@YA?AV?$matrix@M$03$03@@V?$matrix@M$02$03@@@Z'.
Function: ?to4x4_0@@YA?AV?$matrix@M$03$03@@V?$matrix@M$02$03@@@Z: error: Instructions must be of an allowed type.
note: at '%20 = insertvalue %class.matrix.float.4.4 %18, <4 x float> %19, 0, 1' in block '#0' of function '?to4x4_0@@YA?AV?$matrix@M$03$03@@V?$matrix@M$02$03@@@Z'.
Function: ?to4x4_0@@YA?AV?$matrix@M$03$03@@V?$matrix@M$02$03@@@Z: error: Instructions must be of an allowed type.
note: at '%22 = insertvalue %class.matrix.float.4.4 %20, <4 x float> %21, 0, 2' in block '#0' of function '?to4x4_0@@YA?AV?$matrix@M$03$03@@V?$matrix@M$02$03@@@Z'.
Function: ?to4x4_0@@YA?AV?$matrix@M$03$03@@V?$matrix@M$02$03@@@Z: error: Instructions must be of an allowed type.
note: at '%23 = insertvalue %class.matrix.float.4.4 %22, <4 x float> <float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 1.000000e+00>, 0, 3' in block '#0' of function '?to4x4_0@@YA?AV?$matrix@M$03$03@@V?$matrix@M$02$03@@@Z'.
Validation failed.

@cheneym2 cheneym2 added the kind:bug something doesn't work like it should label Aug 20, 2024
@bmillsNV bmillsNV added the goal:quality & productivity Quality issues and issues that impact our productivity coding day to day inside slang label Aug 22, 2024
@bmillsNV bmillsNV added this to the Q4 2024 (Fall) milestone Aug 22, 2024
@bmillsNV
Copy link
Collaborator

bmillsNV commented Aug 22, 2024

Setting P3, marking for Q4 for now. Looks like a DXC issue - would probably require us working w/DXC team to fix.

@cheneym2
Copy link
Collaborator Author

I filed the external bug here microsoft/DirectXShaderCompiler#6889 in the DirectXShaderCompiler github project.

@bmillsNV
Copy link
Collaborator

Won't support this beyond basic HLSL prototype. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
goal:quality & productivity Quality issues and issues that impact our productivity coding day to day inside slang kind:bug something doesn't work like it should
Projects
None yet
Development

No branches or pull requests

2 participants