Skip to content

add caller location for util functions for better error message#282

Draft
YouJiacheng wants to merge 1 commit intodeepseek-ai:mainfrom
YouJiacheng:caller-location-util-assert
Draft

add caller location for util functions for better error message#282
YouJiacheng wants to merge 1 commit intodeepseek-ai:mainfrom
YouJiacheng:caller-location-util-assert

Conversation

@YouJiacheng
Copy link

vllm-project/vllm#32647

RuntimeError: Assertion error (csrc/apis/../jit_kernels/impls/../heuristics/../../utils/layout.hpp:39): t.dim() == N error like this is uninformative. this draft improves the error message by adding source location of caller of these util functions.

passing location might have performance penalty if compiler doesn't optimize it.

stacktrace libraries will need DWARF debug info to print line number, and they also need addr2line/libbfd or custom parsing logics to work.


#ifndef DG_STATIC_ASSERT
#define DG_STATIC_ASSERT(cond, ...) static_assert(cond, __VA_ARGS__)
#define DG_STATIC_ASSERT(cond, ...) static_assert(cond __VA_OPT__(,) __VA_ARGS__)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without __VA_OPT__, DG_STATIC_ASSERT will fail to compile if __VA_ARGS__ is empty (i.e. no message is provided)

Comment on lines +21 to +22
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CUDA_STANDARD 20)
Copy link
Author

@YouJiacheng YouJiacheng Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both std::source_location and __VA_OPT__ need C++20.

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.

1 participant