This is an automated email from the ASF dual-hosted git repository.
tlopex pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new 3d9cf2ec08 [BugFix][TIRx] Fix VerifyMemory crash for PrimFuncs without
target attribute (#19382)
3d9cf2ec08 is described below
commit 3d9cf2ec084432b75be31b97dbf9ab0d69b80eac
Author: Soowon Jeong <[email protected]>
AuthorDate: Sat Apr 11 08:51:36 2026 +0900
[BugFix][TIRx] Fix VerifyMemory crash for PrimFuncs without target
attribute (#19382)
## Problem
`VerifyMemory_` called `TVM_FFI_ICHECK(target.defined())`
unconditionally. When Relax lowers a model it generates host-side helper
PrimFuncs (e.g. for `reshape`, `mean`) that carry no `kTarget`
attribute. These functions hit the ICHECK and abort:
```
Check failed: (target.defined()) is false: Require the target attribute
```
This surfaces whenever `tvm.compile` is called on a Relax module
targeting CUDA, because the Relax lowering pipeline produces target-less
CPU helper functions alongside the GPU kernels.
## Fix
Return `{}` (no errors) when `target` is absent. This is semantically
correct: `MemoryAccessVerifier::Run()` is already gated on
`IsGPUDevice(dev_type_)`, so host-only functions carry no GPU memory
access constraints and require no verification. The same early-exit
pattern is already used for non-default calling conventions (line
184–186).
---
src/tirx/analysis/verify_memory.cc | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/tirx/analysis/verify_memory.cc
b/src/tirx/analysis/verify_memory.cc
index a6c3c0ef35..d97be6c5da 100644
--- a/src/tirx/analysis/verify_memory.cc
+++ b/src/tirx/analysis/verify_memory.cc
@@ -168,7 +168,9 @@ class MemoryAccessVerifier final : protected
StmtExprVisitor {
/// Interface of VerifyMemory pass
std::vector<ffi::String> VerifyMemory_(const PrimFunc& func) {
auto target = func->GetAttr<Target>(tvm::attr::kTarget);
- TVM_FFI_ICHECK(target.defined()) << "VerifyMemory: Require the target
attribute";
+ // Skip verification for functions without a target attribute, as they are
+ // typically host-only helper functions that do not have device-memory
constraints.
+ if (!target.defined()) return {};
VLOG(1) << "verifying memory for target '" << target.value()->str()
<< "' for primitive:" << std::endl