Skip to content

Conversation

@Ubospica
Copy link
Contributor

@Ubospica Ubospica commented Mar 15, 2024

Currently the ABI of tvm::runtime::Map will change if TVM_LOG_DEBUG is enabled or not:

// In MapNode::iterator
#if TVM_LOG_DEBUG
    uint64_t state_marker;
    ...
#else
    ...
#endif  // TVM_LOG_DEBUG

When TVM_LOG_DEBUG is inconsistent between different libraries (e.g. in TVM and in MLC-LLM), the inconsistency in ABI will lead to an invalid read/write.

This PR introduces another macro TVM_DEBUG_WITH_ABI_CHANGE for such cases to warn users that this debug option can lead to changes in ABI. It is not enabled by default.

This fixes the segfault issue introduced in #9842

cc @areusch @tqchen

@github-actions github-actions bot requested review from areusch and tqchen March 15, 2024 18:26
@Ubospica Ubospica changed the title [Fix] Introduce TVM_DEBUG_WITH_ABI_CHANGE for debug code that may involve ABI changes [Fix] Introduce TVM_DEBUG_WITH_ABI_CHANGE to warn ABI changes in debug mode Mar 15, 2024
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