This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm-tirx.git


The following commit(s) were added to refs/heads/main by this push:
     new 5a78c9d04 [Fix][LLVM] Diagnose unsupported non-contiguous masked 
accesses (#253)
5a78c9d04 is described below

commit 5a78c9d045c34c842993a11130a9579ce2312e1c
Author: Shushi Hong <[email protected]>
AuthorDate: Mon Nov 23 08:22:53 2026 -0500

    [Fix][LLVM] Diagnose unsupported non-contiguous masked accesses (#253)
    
    Non-contiguous masked loads/stores currently fail LLVM module
    verification with a type-mismatch error. This PR reject these accesses
    earlier with a clear diagnostic stating that LLVM codegen currently only
    supports contiguous vector accesses. It supercedes #245.
---
 src/codegen/llvm/codegen_llvm.cc | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/codegen/llvm/codegen_llvm.cc b/src/codegen/llvm/codegen_llvm.cc
index 1b579bbcf..eabdf15e0 100644
--- a/src/codegen/llvm/codegen_llvm.cc
+++ b/src/codegen/llvm/codegen_llvm.cc
@@ -1823,11 +1823,18 @@ void CodeGenLLVM::BufferAccessHelper(
     }
   }
 
+  bool last_index_is_scalar =
+      !PrimType(last_index.ty()->dtype).IsScalableVector() && last_index_lanes 
== 1;
+  // Masked intrinsics describe one contiguous vector access. The per-index
+  // fallback below would require explicit lowering of both the value and mask.
+  if (predicate.has_value() && !last_index_is_scalar) {
+    TVM_FFI_THROW(ValueError)
+        << "LLVM codegen currently only supports contiguous vector accesses 
for masked load/store.";
+  }
+
   // All TVM arrays are densely packed.  If the vectorized LLVM type
   // contains padding for alignment, we need to index based on the
   // size of the scalar type to avoid introducing that padding.
-  bool last_index_is_scalar =
-      !PrimType(last_index.ty()->dtype).IsScalableVector() && last_index_lanes 
== 1;
   if (last_index_is_scalar && HasAlignmentPadding(buffer_element_dtype)) {
     last_index = buffer_element_lanes * last_index;
     buffer_element_dtype = buffer_element_dtype.WithLanes(1);

Reply via email to