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] Not passing scope to vk::ReadClock results in ICE #3299

Closed
MarijnS95 opened this issue Dec 4, 2020 · 2 comments
Closed

[SPIR-V] Not passing scope to vk::ReadClock results in ICE #3299

MarijnS95 opened this issue Dec 4, 2020 · 2 comments
Labels
spirv Work related to SPIR-V

Comments

@MarijnS95
Copy link
Contributor

Awesome to see vk::ReadClock introduced in d7bb9ee!

However, I forgot to write the scope by accident (ie. using uint64_t start = vk::ReadClock() directly in code), but instead of getting a nice compiler error needing 1 argument, it crashes:

../tools/clang/include/clang/AST/Type.h:580: const clang::ExtQualsTypeCommonBase *clang::QualType::getCommonPtr() const: Assertion `!isNull() && "Cannot retrieve a NULL type pointer"' failed.

And the backtrace:

#0  0x00007f00481db615 in raise () from /usr/lib/libc.so.6
#1  0x00007f00481c4862 in abort () from /usr/lib/libc.so.6
#2  0x00007f00481c4747 in __assert_fail_base.cold () from /usr/lib/libc.so.6
#3  0x00007f00481d3bf6 in __assert_fail () from /usr/lib/libc.so.6
#4  0x00007effe8dbc067 in clang::QualType::getCommonPtr (this=0x7f0047a3cc70) at ../tools/clang/include/clang/AST/Type.h:580
#5  0x00007effe8db3a15 in clang::QualType::getTypePtr (this=0x7f0047a3cc70) at ../tools/clang/include/clang/AST/Type.h:5060
#6  0x00007effe8db1445 in clang::QualType::operator-> (this=0x7f0047a3cc70) at ../tools/clang/include/clang/AST/Type.h:626
#7  0x00007effe97ff324 in clang::Sema::AddOverloadCandidate (this=0x7efff40d5b90, Function=0x7efff40f8950, FoundDecl=..., Args=..., CandidateSet=..., SuppressUserConversions=false, PartialOverloading=false, AllowExplicit=false)
    at ../tools/clang/lib/Sema/SemaOverload.cpp:5721
#8  0x00007effe9816552 in AddOverloadedCallCandidate (S=..., FoundDecl=..., ExplicitTemplateArgs=0x0, Args=..., CandidateSet=..., PartialOverloading=false, KnownValid=true) at ../tools/clang/lib/Sema/SemaOverload.cpp:10595
#9  0x00007effe9816297 in clang::Sema::AddOverloadedCallCandidates (this=0x7efff40d5b90, ULE=0x7efff4110508, Args=..., CandidateSet=..., PartialOverloading=false) at ../tools/clang/lib/Sema/SemaOverload.cpp:10665
#10 0x00007effe9816aa8 in clang::Sema::buildOverloadedCallSet (this=0x7efff40d5b90, S=0x7efff4079aa0, Fn=0x7efff4110508, ULE=0x7efff4110508, Args=..., RParenLoc=..., CandidateSet=0x7f0047a3d450, Result=0x7f0047a3d430) at ../tools/clang/lib/Sema/SemaOverload.cpp:10951
#11 0x00007effe9817199 in clang::Sema::BuildOverloadedCallExpr (this=0x7efff40d5b90, S=0x7efff4079aa0, Fn=0x7efff4110508, ULE=0x7efff4110508, LParenLoc=..., Args=..., RParenLoc=..., ExecConfig=0x0, AllowTypoCorrection=true) at ../tools/clang/lib/Sema/SemaOverload.cpp:11070
#12 0x00007effe94f2802 in clang::Sema::ActOnCallExpr (this=0x7efff40d5b90, S=0x7efff4079aa0, Fn=0x7efff4110508, LParenLoc=..., ArgExprs=..., RParenLoc=..., ExecConfig=0x0, IsExecConfig=false) at ../tools/clang/lib/Sema/SemaExpr.cpp:5001
#13 0x00007effea4a8cd1 in clang::Parser::ParsePostfixExpressionSuffix (this=0x7efff40d8740, LHS=...) at ../tools/clang/lib/Parse/ParseExpr.cpp:1655
#14 0x00007effea4aedf5 in clang::Parser::ParseCastExpression (this=0x7efff40d8740, isUnaryExpression=false, isAddressOfOperand=false, NotCastExpr=@0x7f0047a40ae7: false, isTypeCast=clang::Parser::NotTypeCast) at ../tools/clang/lib/Parse/ParseExpr.cpp:1460
#15 0x00007effea4a747f in clang::Parser::ParseCastExpression (this=0x7efff40d8740, isUnaryExpression=false, isAddressOfOperand=false, isTypeCast=clang::Parser::NotTypeCast) at ../tools/clang/lib/Parse/ParseExpr.cpp:480
#16 0x00007effea4abc99 in clang::Parser::ParseCastExpression (this=0x7efff40d8740, isUnaryExpression=false, isAddressOfOperand=false, NotCastExpr=@0x7f0047a42b97: false, isTypeCast=clang::Parser::NotTypeCast) at ../tools/clang/lib/Parse/ParseExpr.cpp:905
#17 0x00007effea4a747f in clang::Parser::ParseCastExpression (this=0x7efff40d8740, isUnaryExpression=false, isAddressOfOperand=false, isTypeCast=clang::Parser::NotTypeCast) at ../tools/clang/lib/Parse/ParseExpr.cpp:480
#18 0x00007effea4a5bc9 in clang::Parser::ParseAssignmentExpression (this=0x7efff40d8740, isTypeCast=clang::Parser::NotTypeCast) at ../tools/clang/lib/Parse/ParseExpr.cpp:175
#19 0x00007effea4781a3 in clang::Parser::ParseInitializer (this=0x7efff40d8740) at ../tools/clang/include/clang/Parse/Parser.h:1601
#20 0x00007effea464745 in clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes (this=0x7efff40d8740, D=..., TemplateInfo=..., FRI=0x0) at ../tools/clang/lib/Parse/ParseDecl.cpp:2610
#21 0x00007effea462fc4 in clang::Parser::ParseDeclGroup (this=0x7efff40d8740, DS=..., Context=7, DeclEnd=0x7f0047a44778, FRI=0x0) at ../tools/clang/lib/Parse/ParseDecl.cpp:2381
#22 0x00007effea45be64 in clang::Parser::ParseSimpleDeclaration (this=0x7efff40d8740, Context=7, DeclEnd=..., Attrs=..., RequireSemi=true, FRI=0x0) at ../tools/clang/lib/Parse/ParseDecl.cpp:2029
#23 0x00007effea45b70b in clang::Parser::ParseDeclaration (this=0x7efff40d8740, Context=7, DeclEnd=..., attrs=...) at ../tools/clang/lib/Parse/ParseDecl.cpp:1974
#24 0x00007effea4fe163 in clang::Parser::ParseStatementOrDeclarationAfterAttributes (this=0x7efff40d8740, Stmts=..., OnlyStatement=false, TrailingElseLoc=0x0, Attrs=...) at ../tools/clang/lib/Parse/ParseStmt.cpp:243
#25 0x00007effea4fd9d7 in clang::Parser::ParseStatementOrDeclaration (this=0x7efff40d8740, Stmts=..., OnlyStatement=false, TrailingElseLoc=0x0) at ../tools/clang/lib/Parse/ParseStmt.cpp:107
#26 0x00007effea50789c in clang::Parser::ParseCompoundStatementBody (this=0x7efff40d8740, isStmtExpr=false) at ../tools/clang/lib/Parse/ParseStmt.cpp:1048
#27 0x00007effea50652d in clang::Parser::ParseCompoundStatement (this=0x7efff40d8740, isStmtExpr=false, ScopeFlags=8) at ../tools/clang/lib/Parse/ParseStmt.cpp:926
#28 0x00007effea500f3a in clang::Parser::ParseCompoundStatement (this=0x7efff40d8740, isStmtExpr=false) at ../tools/clang/lib/Parse/ParseStmt.cpp:892
#29 0x00007effea4fe292 in clang::Parser::ParseStatementOrDeclarationAfterAttributes (this=0x7efff40d8740, Stmts=..., OnlyStatement=true, TrailingElseLoc=0x0, Attrs=...) at ../tools/clang/lib/Parse/ParseStmt.cpp:262
#30 0x00007effea4fd9d7 in clang::Parser::ParseStatementOrDeclaration (this=0x7efff40d8740, Stmts=..., OnlyStatement=true, TrailingElseLoc=0x0) at ../tools/clang/lib/Parse/ParseStmt.cpp:107
#31 0x00007effea4fd83c in clang::Parser::ParseStatement (this=0x7efff40d8740, TrailingElseLoc=0x0) at ../tools/clang/lib/Parse/ParseStmt.cpp:42
#32 0x00007effea504842 in clang::Parser::ParseForStatement (this=0x7efff40d8740, TrailingElseLoc=0x0) at ../tools/clang/lib/Parse/ParseStmt.cpp:1821
#33 0x00007effea4fe3a9 in clang::Parser::ParseStatementOrDeclarationAfterAttributes (this=0x7efff40d8740, Stmts=..., OnlyStatement=false, TrailingElseLoc=0x0, Attrs=...) at ../tools/clang/lib/Parse/ParseStmt.cpp:280
#34 0x00007effea4fd9d7 in clang::Parser::ParseStatementOrDeclaration (this=0x7efff40d8740, Stmts=..., OnlyStatement=false, TrailingElseLoc=0x0) at ../tools/clang/lib/Parse/ParseStmt.cpp:107
#35 0x00007effea50789c in clang::Parser::ParseCompoundStatementBody (this=0x7efff40d8740, isStmtExpr=false) at ../tools/clang/lib/Parse/ParseStmt.cpp:1048
#36 0x00007effea5087c2 in clang::Parser::ParseFunctionStatementBody (this=0x7efff40d8740, Decl=0x7efff410dd78, BodyScope=...) at ../tools/clang/lib/Parse/ParseStmt.cpp:1982
#37 0x00007effea43bf2a in clang::Parser::ParseFunctionDefinition (this=0x7efff40d8740, D=..., TemplateInfo=..., LateParsedAttrs=0x7f0047a46ff8) at ../tools/clang/lib/Parse/Parser.cpp:1177
#38 0x00007effea462a7c in clang::Parser::ParseDeclGroup (this=0x7efff40d8740, DS=..., Context=0, DeclEnd=0x0, FRI=0x0) at ../tools/clang/lib/Parse/ParseDecl.cpp:2328
#39 0x00007effea43ab2f in clang::Parser::ParseDeclOrFunctionDefInternal (this=0x7efff40d8740, attrs=..., DS=..., AS=clang::AS_none) at ../tools/clang/lib/Parse/Parser.cpp:965
#40 0x00007effea43a1d6 in clang::Parser::ParseDeclarationOrFunctionDefinition (this=0x7efff40d8740, attrs=..., DS=0x0, AS=clang::AS_none) at ../tools/clang/lib/Parse/Parser.cpp:981
#41 0x00007effea439670 in clang::Parser::ParseExternalDeclaration (this=0x7efff40d8740, attrs=..., DS=0x0) at ../tools/clang/lib/Parse/Parser.cpp:839
#42 0x00007effea4382ac in clang::Parser::ParseTopLevelDecl (this=0x7efff40d8740, Result=...) at ../tools/clang/lib/Parse/Parser.cpp:606
#43 0x00007effea43334c in clang::ParseAST (S=..., PrintStats=false, SkipFunctionBodies=false) at ../tools/clang/lib/Parse/ParseAST.cpp:146
#44 0x00007effe918ab41 in clang::ASTFrontendAction::ExecuteAction (this=0x7f0047a491f0) at ../tools/clang/lib/Frontend/FrontendAction.cpp:554
#45 0x00007effe918a5ad in clang::FrontendAction::Execute (this=0x7f0047a491f0) at ../tools/clang/lib/Frontend/FrontendAction.cpp:455
#46 0x00007effe83b429f in DxcCompiler::Compile (this=0x7efff4099650, pSource=0x7f0047a4a328, pArguments=0x7f00422a83a0, argCount=15, pIncludeHandler=0x7f0043e2db20, riid=..., ppResult=0x7f0047a4a2c0) at ../tools/clang/tools/dxcompiler/dxcompilerobj.cpp:773
#47 0x00007effe83a9feb in hlsl::DxcCompilerAdapter::WrapCompile (this=0x7efff4099828, bPreprocess=false, pSource=0x7f0043f0c4f0, pSourceName=0x7f0043f0bd20 L"main.cs.hlsl", pEntryPoint=0x7f0042f35070 L"main", pTargetProfile=0x7efff4025ec0 L"cs_6_3",
    pArguments=0x7f0042ee7200, argCount=4, pDefines=0x7f0043f0b550, defineCount=3, pIncludeHandler=0x7f0043e2db20, ppResult=0x7f0047a4ae78, ppDebugBlobName=0x0, ppDebugBlob=0x0) at ../tools/clang/tools/dxcompiler/dxcompilerobj.cpp:1418
#48 0x00007effe83ab367 in hlsl::DxcCompilerAdapter::CompileWithDebug (this=0x7efff4099828, pSource=0x7f0043f0c4f0, pSourceName=0x7f0043f0bd20 L"main.cs.hlsl", pEntryPoint=0x7f0042f35070 L"main", pTargetProfile=0x7efff4025ec0 L"cs_6_3", pArguments=0x7f0042ee7200,
    argCount=4, pDefines=0x7f0043f0b550, defineCount=3, pIncludeHandler=0x7f0043e2db20, ppResult=0x7f0047a4ae78, ppDebugBlobName=0x0, ppDebugBlob=0x0) at ../tools/clang/tools/dxcompiler/dxcompilerobj.cpp:1324
#49 0x00007effe83aedb1 in hlsl::DxcCompilerAdapter::Compile (this=0x7efff4099828, pSource=0x7f0043f0c4f0, pSourceName=0x7f0043f0bd20 L"main.cs.hlsl", pEntryPoint=0x7f0042f35070 L"main", pTargetProfile=0x7efff4025ec0 L"cs_6_3", pArguments=0x7f0042ee7200, argCount=4,
    pDefines=0x7f0043f0b550, defineCount=3, pIncludeHandler=0x7f0043e2db20, ppResult=0x7f0047a4ae78) at ../tools/clang/tools/dxcompiler/dxcompileradapter.h:69

CC @ehsannas

@ehsannas ehsannas added the spirv Work related to SPIR-V label Dec 4, 2020
@ehsannas
Copy link
Contributor

ehsannas commented Dec 4, 2020

Thanks for reporting @MarijnS95

@sudonatalie
Copy link
Collaborator

This issue has now been fixed. The error message in the current release of dxc (Vulkan SDK 1.3.216.0) is:

test.hlsl:20:11: error: no matching function for call to 'ReadClock'
  clock = vk::ReadClock();
          ^~~~~~~~~~~~~
test.hlsl:20:11: note: candidate function not viable: requires single argument 'scope', but no arguments were provided

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spirv Work related to SPIR-V
Projects
None yet
Development

No branches or pull requests

3 participants