llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[mlir][xegpu] SIGSEGV in an MLIR API driver on the upstream test_load_nd_vc_3 input (13c6abf)

Open lin334141-cell opened this issue 1 month ago • 3 comments

A small MLIR-based parsing/verification and IR-facts driver terminated with SIGSEGV while processing the test_load_nd_vc_3 example from the same LLVM revision's test suite. The test expects a warning for packed on a one-dimensional descriptor. I am reporting the saved integration observation and providing the original input, complete driver source and recovered build information so the failure can be investigated. Its location within MLIR or the custom driver has not been determined.

Environment

  • LLVM/MLIR revision recorded for this tool: 13c6abfac84fca4bc55c0721d1853ce86a385678 (2025-01-21).
  • Tool: custom ggfa-ir-facts-r1, Linux x86-64, reading stdin with no command-line options. The supplied driver parses and verifies a module, walks it to collect type/operation facts, then prints JSON and canonical IR. It does not execute a transformation pass or GPU code.
  • Historical driver build: GCC 7.5.0, CMake 3.26.4, Unix Makefiles, Release, C++17. Its generated compile flags end in -UNDEBUG.
  • Observed executable SHA-256: 1cd422f2411a363f4bb66c5cecdaaab883788ae0585bbe1ab83f728e93766f83. A retained executable in the recovered build directory has the same SHA-256; its source/object dependencies, compile flags, link command and completed build log were recovered together.

Reproducer

This is the complete saved 321-byte stdin, unchanged by this review. It came from the upstream regression test, with only its expected-warning comment omitted during the original extraction.

func.func @test_load_nd_vc_3(%src: memref<8x16xf16>) {
  %1 = xegpu.create_nd_tdesc %src[0, 0] : memref<8x16xf16> -> !xegpu.tensor_desc<16xf16>
  %2 = xegpu.load_nd %1 <{packed, l1_hint = #xegpu.cache_hint<cached>, l2_hint = #xegpu.cache_hint<uncached>}>
        : !xegpu.tensor_desc<16xf16> -> vector<16xf16>
  return
}

SHA-256: 8568f07a986fca8679f144e7ad9a63416fb73a54a63d0a2076a831c0691c25a7.

Steps to reproduce

The observed invocation supplied the input above to ggfa-ir-facts-r1 on stdin, with no additional arguments. In shell notation, the saved invocation is:

ggfa-ir-facts-r1 < input.mlir

The actual driver is supplied below; this observation is not a run of mlir-opt. The recovered CMake file and build details identify the historical integration, rather than substituting a different driver. The source and configuration have not been rebuilt or rerun as part of this material recovery.

Complete historical driver: ir_facts_r1.cpp
// Read-only, verifier-backed IR facts. No pass execution or source generation.
#include "mlir/IR/AsmState.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Verifier.h"
#include "mlir/InitAllDialects.h"
#include "mlir/Parser/Parser.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Interfaces/LoopLikeInterface.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/JSON.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h"

using namespace mlir;
namespace json = llvm::json;

static std::string printType(Type type) {
  std::string s;
  llvm::raw_string_ostream stream(s);
  type.print(stream);
  return s;
}

static json::Object typeFacts(Type type) {
  json::Object result{{"text", printType(type)}, {"kind", "other"}};
  if (auto integer = dyn_cast<IntegerType>(type)) {
    result["kind"] = "integer";
    result["width"] = int64_t(integer.getWidth());
  } else if (isa<IndexType>(type)) {
    result["kind"] = "index";
  }
  if (auto shaped = dyn_cast<ShapedType>(type)) {
    result["kind"] = isa<BaseMemRefType>(type) ? "memref" :
                     isa<TensorType>(type) ? "tensor" : "shaped";
    result["element_type"] = printType(shaped.getElementType());
    result["ranked"] = shaped.hasRank();
    json::Array shape;
    if (shaped.hasRank())
      for (int64_t dim : shaped.getShape())
        shape.push_back(ShapedType::isDynamic(dim) ? json::Value(nullptr) : json::Value(dim));
    result["shape"] = std::move(shape);
    if (auto memref = dyn_cast<MemRefType>(type)) {
      std::string layout;
      llvm::raw_string_ostream stream(layout);
      memref.getLayout().print(stream);
      result["layout"] = layout;
      SmallVector<int64_t> strides;
      int64_t offset;
      if (succeeded(memref.getStridesAndOffset(strides, offset))) {
        result["offset"] = ShapedType::isDynamic(offset) ? json::Value(nullptr) : json::Value(offset);
        json::Array values;
        for (int64_t stride : strides)
          values.push_back(ShapedType::isDynamic(stride) ? json::Value(nullptr) : json::Value(stride));
        result["strides"] = std::move(values);
      }
    }
  }
  return result;
}

int main(int argc, char **argv) {
  if (argc != 1) {
    llvm::errs() << "usage: ggfa-ir-facts-r1 < input.mlir\n";
    return 2;
  }
  auto input = llvm::MemoryBuffer::getSTDIN();
  if (!input || (*input)->getBufferSize() > 262144) {
    llvm::errs() << "input missing or exceeds admitted 262144 bytes\n";
    return 2;
  }
  DialectRegistry registry;
  registerAllDialects(registry);
  MLIRContext context(registry);
  context.disableMultithreading();
  llvm::SourceMgr mgr;
  mgr.AddNewSourceBuffer(std::move(*input), llvm::SMLoc());
  auto module = parseSourceFile<ModuleOp>(mgr, &context);
  if (!module || failed(verify(*module))) {
    llvm::outs() << "{\"schema\":\"ggfa.ir_facts.r1\",\"verified\":false}\n";
    return 1;
  }
  llvm::DenseMap<Operation *, int64_t> opIds;
  llvm::DenseMap<Value, int64_t> valueIds;
  llvm::DenseMap<Region *, int64_t> regionIds;
  int64_t oi = 0, vi = 0, ri = 0;
  module->walk<WalkOrder::PreOrder>([&](Operation *op) {
    opIds[op] = oi++;
    for (Value value : op->getResults()) valueIds[value] = vi++;
    for (Region &region : op->getRegions()) {
      regionIds[&region] = ri++;
      for (Block &block : region)
        for (Value value : block.getArguments()) valueIds[value] = vi++;
    }
  });
  if (oi > 4096) {
    llvm::errs() << "operation bound exceeded\n";
    return 2;
  }
  auto valueFact = [&](Value value) {
    return json::Object{{"id", valueIds.lookup(value)}, {"type", typeFacts(value.getType())}};
  };
  json::Array operations;
  module->walk<WalkOrder::PreOrder>([&](Operation *op) {
    json::Object node{{"id", opIds.lookup(op)}, {"name", op->getName().getStringRef().str()},
                      {"regions", int64_t(op->getNumRegions())},
                      {"loop_like", isa<LoopLikeOpInterface>(op)}};
    node["parent"] = op->getParentOp() ? json::Value(opIds.lookup(op->getParentOp())) : json::Value(nullptr);
    node["region"] = op->getParentRegion() ? json::Value(regionIds.lookup(op->getParentRegion())) : json::Value(nullptr);
    json::Array operands, results, arguments;
    for (Value value : op->getOperands()) operands.push_back(valueFact(value));
    for (Value value : op->getResults()) results.push_back(valueFact(value));
    for (Region &region : op->getRegions())
      for (Block &block : region)
        for (Value value : block.getArguments()) arguments.push_back(valueFact(value));
    node["operands"] = std::move(operands);
    node["results"] = std::move(results);
    node["block_arguments"] = std::move(arguments);
    if (auto linalg = dyn_cast<linalg::LinalgOp>(op))
      node["linalg_semantics"] = linalg.hasPureTensorSemantics() ? "tensor" :
                                  linalg.hasPureBufferSemantics() ? "buffer" : "mixed";
    if (auto load = dyn_cast<memref::LoadOp>(op))
      node["access_memref"] = valueIds.lookup(load.getMemRef());
    if (auto store = dyn_cast<memref::StoreOp>(op))
      node["access_memref"] = valueIds.lookup(store.getMemRef());
    operations.push_back(std::move(node));
  });
  std::string canonical;
  llvm::raw_string_ostream stream(canonical);
  module->print(stream, OpPrintingFlags().enableDebugInfo(false));
  json::Object result{{"schema", "ggfa.ir_facts.r1"}, {"verified", true},
                      {"operations", std::move(operations)}, {"canonical_ir", canonical}};
  llvm::outs() << json::Value(std::move(result)) << "\n";
  return 0;
}
Historical CMakeLists.txt
cmake_minimum_required(VERSION 3.20)
project(mlirvkf_native LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(MLIR REQUIRED CONFIG)
list(APPEND CMAKE_MODULE_PATH "${MLIR_CMAKE_DIR}" "${LLVM_CMAKE_DIR}")
include(AddLLVM)
include(AddMLIR)
include(HandleLLVMOptions)
include_directories(${LLVM_INCLUDE_DIRS} ${MLIR_INCLUDE_DIRS})
add_definitions(${LLVM_DEFINITIONS})
add_llvm_executable(ggfa-ir-facts-r1 ir_facts_r1.cpp)
llvm_update_compile_flags(ggfa-ir-facts-r1)
get_property(MLIRVKF_DIALECT_LIBS GLOBAL PROPERTY MLIR_DIALECT_LIBS)
get_property(MLIRVKF_EXTENSION_LIBS GLOBAL PROPERTY MLIR_EXTENSION_LIBS)
target_link_libraries(ggfa-ir-facts-r1 PRIVATE
  ${MLIRVKF_DIALECT_LIBS} ${MLIRVKF_EXTENSION_LIBS} MLIRIR MLIRParser
  MLIRLinalgDialect MLIRMemRefDialect MLIRLoopLikeInterface LLVMSupport)
mlir_check_all_link_libraries(ggfa-ir-facts-r1)
install(TARGETS ggfa-ir-facts-r1 RUNTIME DESTINATION bin)
Recovered compiler, linkage and configuration details

Recovered historical build information

These are saved build records, not results from a new configure/build or execution.

  • LLVM/MLIR revision recorded for the tool: 13c6abfac84fca4bc55c0721d1853ce86a385678 (2025-01-21).
  • Executable: ELF x86-64; GNU build ID 84ca44170004c19c6ba4d329eeff5740b70a5486.
  • Executable SHA-256: 1cd422f2411a363f4bb66c5cecdaaab883788ae0585bbe1ab83f728e93766f83.
  • CMake 3.26.4, generator Unix Makefiles, CMAKE_BUILD_TYPE=Release, C++17.
  • Driver compiler: /usr/bin/c++, GNU 7.5.0; ELF comment identifies Ubuntu 7.5.0-3ubuntu1~18.04.
  • The generated compile rule ends with -UNDEBUG; the Release setting alone therefore does not imply assertions were disabled.
  • LLVM_DIR and MLIR_DIR pointed into the same LLVM build tree, whose source include paths name the revision above.
  • DependInfo.cmake and the generated compile rule name the supplied ir_facts_r1.cpp; the generated link rule names its object and ggfa-ir-facts-r1.
  • The saved build log ends in successful compile/link/target-completion records. A retained executable from this build directory is byte-identical to the checker hash in the failed call.
  • Source, object and executable modification times are 2026-09-23 14:24:40, 14:25:16 and 14:25:27 UTC respectively. These support the artifact association; they are not a reproducible-build attestation.

Actual driver compile definitions/flags from flags.make (unchanged):

CXX_DEFINES = -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
CXX_FLAGS =  -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -Wimplicit-fallthrough -Wno-nonnull -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=gnu++1z   -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS  -fno-exceptions -funwind-tables -fno-rtti -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG

The supplied historical CMakeLists.txt is the configuration entry point. It links the MLIR dialect and extension libraries plus MLIR IR/parser, Linalg, MemRef, LoopLikeInterface and LLVMSupport. The generated historical link line contains 327 static archive references (244 distinct names), including MLIRXeGPUDialect and MLIRXeGPUTransforms. ELF dependencies are libdl.so.2, libpthread.so.0, libz.so.1, libstdc++.so.6, libm.so.6, libgcc_s.so.1, libc.so.6 and ld-linux-x86-64.so.2; there is no dynamic MLIR/LLVM library entry.

To configure this recovered project, the two CMake package variables must reference lib/cmake/llvm and lib/cmake/mlir in a build of the stated revision; the historical target is ggfa-ir-facts-r1. No new build recipe, compiler flags or executed result is being substituted for the recovered files.

The original LLVM build tree and its full CMake cache are no longer present at the recorded location. The recovered files identify the historical driver build, but a byte-for-byte rebuild, the original runtime shared-library versions, and the failure location have not been established.

Actual behavior

The saved process record reports:

status: SIGNAL
return_code: -11 (SIGSEGV, as reported by the subprocess API)
reaped: true
stdout: 0 bytes
stderr: 0 bytes
elapsed: 0.289126 seconds
configured timeout: 10 seconds

No assertion text, warning or backtrace was captured. The process record classifies the termination as a signal, not a timeout. It does not identify the failing function.

Expected behavior

At the stated revision, the upstream test expects Invalid Packed Attr. for this exact function. In LoadNdOp::verify, packed on a rank-one descriptor emits a warning and is ignored for verification; both descriptor and result shapes here are [16]. The warning's display depends on the diagnostic handler installed by the driver.

I would expect this integration to finish verification/fact extraction, or report an ordinary diagnostic for an unsupported use. If the driver violates an MLIR API requirement, identifying that requirement would also resolve the report; I am not claiming that a transformation of a valid program was miscompiled.

Analysis

The recovered driver registers all dialects and disables multithreading. It calls parseSourceFile<ModuleOp> and verify, then inspects operation/value/type information and prints the module. Its historical link records include the XeGPU dialect library. Nothing in the saved logs identifies which of these stages failed, and the same input has not been tested through standard mlir-opt in this review.

The evidence is limited to the saved custom-driver invocation on the revision above. There is no new independent replay, latest-version result, symbolized fault location or verified patch. The driver build records were recovered, but the full original LLVM build cache and historical runtime shared-library identities are not available. A byte-identical rebuild is therefore not claimed. These limitations leave root cause, current-version behavior and novelty open.

Related issues

  • #226074 reports xegpu.load_nd with an invalid transpose array. This input has no transpose attribute; no evidence currently establishes the same mechanism.
  • #124548 added tensor-descriptor validation and adjusted distribution checks. I found no saved evidence that connects that change to this custom-driver SIGSEGV; this input has no subgroup map.

AI-assisted material review and report drafting.

lin334141-cell avatar Oct 19 '26 10:10 lin334141-cell

@llvm/issue-subscribers-mlir

Author: lin334141-cell

A small MLIR-based parsing/verification and IR-facts driver terminated with SIGSEGV while processing the `test_load_nd_vc_3` example from the same LLVM revision's test suite. The test expects a warning for `packed` on a one-dimensional descriptor. I am reporting the saved integration observation and providing the original input, complete driver source and recovered build information so the failure can be investigated. Its location within MLIR or the custom driver has not been determined.

Environment

  • LLVM/MLIR revision recorded for this tool: 13c6abfac84fca4bc55c0721d1853ce86a385678 (2025-01-21).
  • Tool: custom ggfa-ir-facts-r1, Linux x86-64, reading stdin with no command-line options. The supplied driver parses and verifies a module, walks it to collect type/operation facts, then prints JSON and canonical IR. It does not execute a transformation pass or GPU code.
  • Historical driver build: GCC 7.5.0, CMake 3.26.4, Unix Makefiles, Release, C++17. Its generated compile flags end in -UNDEBUG.
  • Observed executable SHA-256: 1cd422f2411a363f4bb66c5cecdaaab883788ae0585bbe1ab83f728e93766f83. A retained executable in the recovered build directory has the same SHA-256; its source/object dependencies, compile flags, link command and completed build log were recovered together.

Reproducer

This is the complete saved 321-byte stdin, unchanged by this review. It came from the upstream regression test, with only its expected-warning comment omitted during the original extraction.

func.func @<!-- -->test_load_nd_vc_3(%src: memref&lt;8x16xf16&gt;) {
  %1 = xegpu.create_nd_tdesc %src[0, 0] : memref&lt;8x16xf16&gt; -&gt; !xegpu.tensor_desc&lt;16xf16&gt;
  %2 = xegpu.load_nd %1 &lt;{packed, l1_hint = #xegpu.cache_hint&lt;cached&gt;, l2_hint = #xegpu.cache_hint&lt;uncached&gt;}&gt;
        : !xegpu.tensor_desc&lt;16xf16&gt; -&gt; vector&lt;16xf16&gt;
  return
}

SHA-256: 8568f07a986fca8679f144e7ad9a63416fb73a54a63d0a2076a831c0691c25a7.

Steps to reproduce

The observed invocation supplied the input above to ggfa-ir-facts-r1 on stdin, with no additional arguments. In shell notation, the saved invocation is:

ggfa-ir-facts-r1 &lt; input.mlir

The actual driver is supplied below; this observation is not a run of mlir-opt. The recovered CMake file and build details identify the historical integration, rather than substituting a different driver. The source and configuration have not been rebuilt or rerun as part of this material recovery.

<details> <summary>Complete historical driver: ir_facts_r1.cpp</summary>

// Read-only, verifier-backed IR facts. No pass execution or source generation.
#include "mlir/IR/AsmState.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Verifier.h"
#include "mlir/InitAllDialects.h"
#include "mlir/Parser/Parser.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Interfaces/LoopLikeInterface.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/JSON.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h"

using namespace mlir;
namespace json = llvm::json;

static std::string printType(Type type) {
  std::string s;
  llvm::raw_string_ostream stream(s);
  type.print(stream);
  return s;
}

static json::Object typeFacts(Type type) {
  json::Object result{{"text", printType(type)}, {"kind", "other"}};
  if (auto integer = dyn_cast&lt;IntegerType&gt;(type)) {
    result["kind"] = "integer";
    result["width"] = int64_t(integer.getWidth());
  } else if (isa&lt;IndexType&gt;(type)) {
    result["kind"] = "index";
  }
  if (auto shaped = dyn_cast&lt;ShapedType&gt;(type)) {
    result["kind"] = isa&lt;BaseMemRefType&gt;(type) ? "memref" :
                     isa&lt;TensorType&gt;(type) ? "tensor" : "shaped";
    result["element_type"] = printType(shaped.getElementType());
    result["ranked"] = shaped.hasRank();
    json::Array shape;
    if (shaped.hasRank())
      for (int64_t dim : shaped.getShape())
        shape.push_back(ShapedType::isDynamic(dim) ? json::Value(nullptr) : json::Value(dim));
    result["shape"] = std::move(shape);
    if (auto memref = dyn_cast&lt;MemRefType&gt;(type)) {
      std::string layout;
      llvm::raw_string_ostream stream(layout);
      memref.getLayout().print(stream);
      result["layout"] = layout;
      SmallVector&lt;int64_t&gt; strides;
      int64_t offset;
      if (succeeded(memref.getStridesAndOffset(strides, offset))) {
        result["offset"] = ShapedType::isDynamic(offset) ? json::Value(nullptr) : json::Value(offset);
        json::Array values;
        for (int64_t stride : strides)
          values.push_back(ShapedType::isDynamic(stride) ? json::Value(nullptr) : json::Value(stride));
        result["strides"] = std::move(values);
      }
    }
  }
  return result;
}

int main(int argc, char **argv) {
  if (argc != 1) {
    llvm::errs() &lt;&lt; "usage: ggfa-ir-facts-r1 &lt; input.mlir\n";
    return 2;
  }
  auto input = llvm::MemoryBuffer::getSTDIN();
  if (!input || (*input)-&gt;getBufferSize() &gt; 262144) {
    llvm::errs() &lt;&lt; "input missing or exceeds admitted 262144 bytes\n";
    return 2;
  }
  DialectRegistry registry;
  registerAllDialects(registry);
  MLIRContext context(registry);
  context.disableMultithreading();
  llvm::SourceMgr mgr;
  mgr.AddNewSourceBuffer(std::move(*input), llvm::SMLoc());
  auto module = parseSourceFile&lt;ModuleOp&gt;(mgr, &amp;context);
  if (!module || failed(verify(*module))) {
    llvm::outs() &lt;&lt; "{\"schema\":\"ggfa.ir_facts.r1\",\"verified\":false}\n";
    return 1;
  }
  llvm::DenseMap&lt;Operation *, int64_t&gt; opIds;
  llvm::DenseMap&lt;Value, int64_t&gt; valueIds;
  llvm::DenseMap&lt;Region *, int64_t&gt; regionIds;
  int64_t oi = 0, vi = 0, ri = 0;
  module-&gt;walk&lt;WalkOrder::PreOrder&gt;([&amp;](Operation *op) {
    opIds[op] = oi++;
    for (Value value : op-&gt;getResults()) valueIds[value] = vi++;
    for (Region &amp;region : op-&gt;getRegions()) {
      regionIds[&amp;region] = ri++;
      for (Block &amp;block : region)
        for (Value value : block.getArguments()) valueIds[value] = vi++;
    }
  });
  if (oi &gt; 4096) {
    llvm::errs() &lt;&lt; "operation bound exceeded\n";
    return 2;
  }
  auto valueFact = [&amp;](Value value) {
    return json::Object{{"id", valueIds.lookup(value)}, {"type", typeFacts(value.getType())}};
  };
  json::Array operations;
  module-&gt;walk&lt;WalkOrder::PreOrder&gt;([&amp;](Operation *op) {
    json::Object node{{"id", opIds.lookup(op)}, {"name", op-&gt;getName().getStringRef().str()},
                      {"regions", int64_t(op-&gt;getNumRegions())},
                      {"loop_like", isa&lt;LoopLikeOpInterface&gt;(op)}};
    node["parent"] = op-&gt;getParentOp() ? json::Value(opIds.lookup(op-&gt;getParentOp())) : json::Value(nullptr);
    node["region"] = op-&gt;getParentRegion() ? json::Value(regionIds.lookup(op-&gt;getParentRegion())) : json::Value(nullptr);
    json::Array operands, results, arguments;
    for (Value value : op-&gt;getOperands()) operands.push_back(valueFact(value));
    for (Value value : op-&gt;getResults()) results.push_back(valueFact(value));
    for (Region &amp;region : op-&gt;getRegions())
      for (Block &amp;block : region)
        for (Value value : block.getArguments()) arguments.push_back(valueFact(value));
    node["operands"] = std::move(operands);
    node["results"] = std::move(results);
    node["block_arguments"] = std::move(arguments);
    if (auto linalg = dyn_cast&lt;linalg::LinalgOp&gt;(op))
      node["linalg_semantics"] = linalg.hasPureTensorSemantics() ? "tensor" :
                                  linalg.hasPureBufferSemantics() ? "buffer" : "mixed";
    if (auto load = dyn_cast&lt;memref::LoadOp&gt;(op))
      node["access_memref"] = valueIds.lookup(load.getMemRef());
    if (auto store = dyn_cast&lt;memref::StoreOp&gt;(op))
      node["access_memref"] = valueIds.lookup(store.getMemRef());
    operations.push_back(std::move(node));
  });
  std::string canonical;
  llvm::raw_string_ostream stream(canonical);
  module-&gt;print(stream, OpPrintingFlags().enableDebugInfo(false));
  json::Object result{{"schema", "ggfa.ir_facts.r1"}, {"verified", true},
                      {"operations", std::move(operations)}, {"canonical_ir", canonical}};
  llvm::outs() &lt;&lt; json::Value(std::move(result)) &lt;&lt; "\n";
  return 0;
}

</details>

<details> <summary>Historical CMakeLists.txt</summary>

cmake_minimum_required(VERSION 3.20)
project(mlirvkf_native LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(MLIR REQUIRED CONFIG)
list(APPEND CMAKE_MODULE_PATH "${MLIR_CMAKE_DIR}" "${LLVM_CMAKE_DIR}")
include(AddLLVM)
include(AddMLIR)
include(HandleLLVMOptions)
include_directories(${LLVM_INCLUDE_DIRS} ${MLIR_INCLUDE_DIRS})
add_definitions(${LLVM_DEFINITIONS})
add_llvm_executable(ggfa-ir-facts-r1 ir_facts_r1.cpp)
llvm_update_compile_flags(ggfa-ir-facts-r1)
get_property(MLIRVKF_DIALECT_LIBS GLOBAL PROPERTY MLIR_DIALECT_LIBS)
get_property(MLIRVKF_EXTENSION_LIBS GLOBAL PROPERTY MLIR_EXTENSION_LIBS)
target_link_libraries(ggfa-ir-facts-r1 PRIVATE
  ${MLIRVKF_DIALECT_LIBS} ${MLIRVKF_EXTENSION_LIBS} MLIRIR MLIRParser
  MLIRLinalgDialect MLIRMemRefDialect MLIRLoopLikeInterface LLVMSupport)
mlir_check_all_link_libraries(ggfa-ir-facts-r1)
install(TARGETS ggfa-ir-facts-r1 RUNTIME DESTINATION bin)

</details>

<details> <summary>Recovered compiler, linkage and configuration details</summary>

Recovered historical build information

These are saved build records, not results from a new configure/build or execution.

  • LLVM/MLIR revision recorded for the tool: 13c6abfac84fca4bc55c0721d1853ce86a385678 (2025-01-21).
  • Executable: ELF x86-64; GNU build ID 84ca44170004c19c6ba4d329eeff5740b70a5486.
  • Executable SHA-256: 1cd422f2411a363f4bb66c5cecdaaab883788ae0585bbe1ab83f728e93766f83.
  • CMake 3.26.4, generator Unix Makefiles, CMAKE_BUILD_TYPE=Release, C++17.
  • Driver compiler: /usr/bin/c++, GNU 7.5.0; ELF comment identifies Ubuntu 7.5.0-3ubuntu1~18.04.
  • The generated compile rule ends with -UNDEBUG; the Release setting alone therefore does not imply assertions were disabled.
  • LLVM_DIR and MLIR_DIR pointed into the same LLVM build tree, whose source include paths name the revision above.
  • DependInfo.cmake and the generated compile rule name the supplied ir_facts_r1.cpp; the generated link rule names its object and ggfa-ir-facts-r1.
  • The saved build log ends in successful compile/link/target-completion records. A retained executable from this build directory is byte-identical to the checker hash in the failed call.
  • Source, object and executable modification times are 2026-09-23 14:24:40, 14:25:16 and 14:25:27 UTC respectively. These support the artifact association; they are not a reproducible-build attestation.

Actual driver compile definitions/flags from flags.make (unchanged):

CXX_DEFINES = -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
CXX_FLAGS =  -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -Wimplicit-fallthrough -Wno-nonnull -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=gnu++1z   -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS  -fno-exceptions -funwind-tables -fno-rtti -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG

The supplied historical CMakeLists.txt is the configuration entry point. It links the MLIR dialect and extension libraries plus MLIR IR/parser, Linalg, MemRef, LoopLikeInterface and LLVMSupport. The generated historical link line contains 327 static archive references (244 distinct names), including MLIRXeGPUDialect and MLIRXeGPUTransforms. ELF dependencies are libdl.so.2, libpthread.so.0, libz.so.1, libstdc++.so.6, libm.so.6, libgcc_s.so.1, libc.so.6 and ld-linux-x86-64.so.2; there is no dynamic MLIR/LLVM library entry.

To configure this recovered project, the two CMake package variables must reference lib/cmake/llvm and lib/cmake/mlir in a build of the stated revision; the historical target is ggfa-ir-facts-r1. No new build recipe, compiler flags or executed result is being substituted for the recovered files.

The original LLVM build tree and its full CMake cache are no longer present at the recorded location. The recovered files identify the historical driver build, but a byte-for-byte rebuild, the original runtime shared-library versions, and the failure location have not been established.

</details>

Actual behavior

The saved process record reports:

status: SIGNAL
return_code: -11 (SIGSEGV, as reported by the subprocess API)
reaped: true
stdout: 0 bytes
stderr: 0 bytes
elapsed: 0.289126 seconds
configured timeout: 10 seconds

No assertion text, warning or backtrace was captured. The process record classifies the termination as a signal, not a timeout. It does not identify the failing function.

Expected behavior

At the stated revision, the upstream test expects Invalid Packed Attr. for this exact function. In LoadNdOp::verify, packed on a rank-one descriptor emits a warning and is ignored for verification; both descriptor and result shapes here are [16]. The warning's display depends on the diagnostic handler installed by the driver.

I would expect this integration to finish verification/fact extraction, or report an ordinary diagnostic for an unsupported use. If the driver violates an MLIR API requirement, identifying that requirement would also resolve the report; I am not claiming that a transformation of a valid program was miscompiled.

Analysis

The recovered driver registers all dialects and disables multithreading. It calls parseSourceFile&lt;ModuleOp&gt; and verify, then inspects operation/value/type information and prints the module. Its historical link records include the XeGPU dialect library. Nothing in the saved logs identifies which of these stages failed, and the same input has not been tested through standard mlir-opt in this review.

The evidence is limited to the saved custom-driver invocation on the revision above. There is no new independent replay, latest-version result, symbolized fault location or verified patch. The driver build records were recovered, but the full original LLVM build cache and historical runtime shared-library identities are not available. A byte-identical rebuild is therefore not claimed. These limitations leave root cause, current-version behavior and novelty open.

Related issues

  • #226074 reports xegpu.load_nd with an invalid transpose array. This input has no transpose attribute; no evidence currently establishes the same mechanism.
  • #124548 added tensor-descriptor validation and adjusted distribution checks. I found no saved evidence that connects that change to this custom-driver SIGSEGV; this input has no subgroup map.

AI-assisted material review and report drafting.

I independently reproduced and root-caused this. Summary: the SIGSEGV is a real MLIR issue — an infinite verifier/diagnostic recursion — and this trigger path was already fixed upstream three days after the revision this report observed, in #124148 ("[mlir][xegpu] Fix verifier diagnostic recursion", merged 2025-01-24). The custom driver is not at fault; stock mlir-opt crashes on the same input too.

Reproduction

I rebuilt both binaries from source at 13c6abfac84fca4bc55c0721d1853ce86a385678 (LLVM 20.0.0git, Release + assertions; macOS arm64 — a different platform from the original observation, so not a byte-identical rebuild of the historical executable):

  • Stock mlir-opt (no custom code at all) aborts on the 321-byte input (8568f07a986fca8679f144e7ad9a63416fb73a54a63d0a2076a831c0691c25a7) with no output, in plain printing mode: exit -4 (SIGILL from stack exhaustion) on this platform. It does not crash with -verify-diagnostics -split-input-file (exit 1, "unexpected warning") nor with --mlir-print-op-generic (exit 0, warning printed normally).
  • The driver from this issue, rebuilt verbatim against the same build tree (parseSourceFile → verify → walk → print), exits with -11 (SIGSEGV) and 0 bytes of stdout/stderr — matching the saved observation (return_code -11, SIGNAL, no output). Removing only the packed attribute makes both binaries succeed normally. A smaller variant that keeps just <{packed}> (dropping the cache hints; the rest unchanged) still crashes both:
func.func @test_load_nd_vc_3(%src: memref<8x16xf16>) {
  %1 = xegpu.create_nd_tdesc %src[0, 0] : memref<8x16xf16> -> !xegpu.tensor_desc<16xf16>
  %2 = xegpu.load_nd %1 <{packed}>
        : !xegpu.tensor_desc<16xf16> -> vector<16xf16>
  return
}

Call stack

Captured by breaking on Diagnostic::appendOp at its first hit (symbolized; from the rebuilt driver — mlir-opt shows the same chain):

main
 → mlir::parseSourceFile → mlir::parseAsmSourceFile
   → mlir::verify(module)
     → OperationVerifier::verifyOpAndDominance   (descends into the function body)
       → mlir::xegpu::LoadNdOp::verifyInvariants
         → mlir::xegpu::LoadNdOp::verify()
           → Operation::emitWarning (inlined)                        [XeGPUOps.cpp:274]
             → diag.attachNote(getLoc()) << "see current operation: " << *this
                                                                   [Operation.cpp:283]
               → mlir::Diagnostic::operator<<(Operation&) → mlir::Diagnostic::appendOp
                 → op.print with default (custom-form) flags
                   → AsmState(op) → verifyOpAndAdjustFlags → mlir::verify(op)
                     → mlir::xegpu::LoadNdOp::verify() → …  (same cycle repeats)

The recursion runs until stack exhaustion. The first failing stage is parse-time verification — before any of the driver's own logic executes.

Root cause

The input is the upstream regression-test case where packed on a 1D descriptor is expected to produce a verifier warning ("Invalid Packed Attr."). At this revision, LoadNdOp::verify emits it via the member Operation::emitWarning (mlir/lib/Dialect/XeGPU/IR/XeGPUOps.cpp:274). That member attaches a "see current operation" note by streaming the operation into the diagnostic (mlir/lib/IR/Operation.cpp:283):

diag.attachNote(getLoc()) << "see current operation: " << *this;

Diagnostic::operator<<(Operation&) eagerly renders the operation with default (custom-form) printing flags. Operation::print builds an AsmState, whose verifyOpAndAdjustFlags re-runs verify(op) for non-generic, non-assume-verified flags — so the verifier runs again, emits the same warning again, attaches the note again, and the recursion never terminates.

The upstream -verify-diagnostics test mode does not trigger this recursion: it disables op notes (MlirOptMain.cpp:529-531, context.printOpOnDiagnostic(false)), so the note is never constructed — which is why the existing regression tests did not surface it. Also note the error path is already guarded: Operation::emitError renders its note with OpPrintingFlags().printGenericOpForm() (Operation.cpp:270-277), which skips re-verification. emitWarning and emitRemark have no such guard.

Fix status

This trigger path was fixed by #124148 ("[mlir][xegpu] Fix verifier diagnostic recursion", merged 2025-01-24 — three days after 13c6abf), which switches the two LoadNdOp::verify warnings to the free-function mlir::emitWarning(getLoc()) << ..., attaching no op note. I verified LLVM 22.1.6 does not crash on this input and prints the warning without a note. Given the above, it would seem reasonable to treat #233396 as a historical issue already fixed by #124148.

Residual hardening note (source observation, not a new reproducer)

Source-level observation only — I have not reproduced a new failure on current main: Operation::emitWarning and Operation::emitRemark still attach their note via << *this with default flags (checked against current sources as of 2026-10-28), while Operation::emitError uses the generic-form guard. Any other dialect whose verifier emits a warning through the member function on the operation under verification could hit the same recursion from a plain parse/print/verify tool run. Applying the same OpPrintingFlags().printGenericOpForm() treatment to the warning/remark note sites (or skipping re-verification when printing diagnostics) would close that general case.

lin334141-cell avatar Oct 29 '26 15:10 lin334141-cell

Closing as already fixed by #124148, merged January 24, 2025. The reported crash affects revision 13c6abf from January 21, 2025, which predates that fix. Thanks for reproducing the failure and identifying the root cause.

silee2 avatar Nov 05 '26 20:11 silee2