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

[SPIR-V] Partial Template Specializations with non-type parameters crashes DXC with found unregistered decl #7007

Open
devshgraphicsprogramming opened this issue Nov 13, 2024 · 0 comments
Labels
bug Bug, regression, crash needs-triage Awaiting triage spirv Work related to SPIR-V

Comments

@devshgraphicsprogramming

Description
The following code:

namespace nbl
{
namespace hlsl
{


template<typename MatT>
struct matrix_traits;
// partial spec for matrices
template<typename T, int32_t N, int32_t M>
struct matrix_traits<matrix<T,N,M> >
{
    static const uint32_t RowCount = N;
    static const uint32_t ColumnCount = M;
    static const bool Square = N==M;
};

namespace impl
{
template<typename MatT>
MatT diagonal(float diagonal)
{
    MatT output;
    
    for(int i = 0; i < matrix_traits<MatT>::RowCount; ++i)
    for(int j = 0; j < matrix_traits<MatT>::ColumnCount; ++j)
        output[i][j] = 0;
    
    for(int diag = 0; diag < matrix_traits<MatT>::RowCount; ++diag)
        output[diag][diag] = diagonal;
        
    return output;
}
}
}
}

crashes the compiler when compiling SpirV and not when compiling DXIL

Steps to Reproduce

SPIR-V : https://godbolt.org/z/69KodrMb9
HLSL : https://godbolt.org/z/49YjvYnnh

Actual Behavior

<source>:10:30: fatal error: found unregistered decl N
template<typename T, int32_t N, int32_t M>
                             ^

Environment

  • DXC version: trunk
  • Host Operating System: Godbolt
@devshgraphicsprogramming devshgraphicsprogramming added bug Bug, regression, crash needs-triage Awaiting triage spirv Work related to SPIR-V labels Nov 13, 2024
@damyanp damyanp moved this to For Google in HLSL Triage Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug, regression, crash needs-triage Awaiting triage spirv Work related to SPIR-V
Projects
Status: For Google
Development

No branches or pull requests

1 participant