Skip to content

Conversation

@cbalint13
Copy link
Contributor

This fix instruct LLVM debuginfo to not emit entries for invalid variable types.

Prior to this, it was impossible to build and run a valid TIR program having a flow with scalable vectors.

tvm/src/target/llvm/codegen_llvm.cc", line 2163,
        in tvm::codegen::CodeGenLLVM::VisitStmt_(tvm::tir::LetStmtNode const*)
   AddDebugInformation(value, op->var);
{...} 
File "/home/cbalint/rpmbuild/BUILD/tvm-0.21.0-build/tvm/src/target/llvm/codegen_llvm.cc",  line 2277, 
   in tvm::codegen::CodeGenLLVM::AddDebugInformation(llvm::Value*, tvm::tir::Var const&, llvm::Instruction*)
 auto dbg_dtype = GetDebugType(GetType(tir_var));
{...}

tvm.error.InternalError: Can't fetch the lanes of a scalable vector at a compile time.

This was discovered in PR#18182 by manual checking the TIR kernels.

Notes

  • More direct is_void() voidness check, .lanes() property check is bundled with exception throw.
  • In case of scalabe vector types do not emit debuginfo, also do not emit debug info for other unknown types.

A testcase now covers this issue for the future.

@cbalint13 cbalint13 force-pushed the llvm-dbginfo-vscale branch from f9236b2 to 7b766f9 Compare August 25, 2025 10:45
@cbalint13 cbalint13 marked this pull request as ready for review August 25, 2025 13:03
@tqchen tqchen merged commit ad9a201 into apache:main Aug 25, 2025
13 checks passed
@cbalint13 cbalint13 deleted the llvm-dbginfo-vscale branch August 28, 2025 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants