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

[mlir][Vector] Historical assertion on malformed vector.mask in a custom parsing driver

Open lin334141-cell opened this issue 2 months ago • 2 comments

A saved run of a custom MLIR parsing/verification driver terminated with a SmallVector assertion on the malformed vector.mask input below. The missing-result-type condition appears to be addressed by #140319. This report is limited to the listed historical revision; it does not establish a separate defect or a failure after that fix.

Environment

  • Recorded LLVM revision: 13c6abfac84fca4bc55c0721d1853ce86a385678.
  • Observed executable: the custom parsing/verification driver ggfa-ir-facts-r1, receiving the input below on stdin with no additional arguments.
  • Historical executable SHA-256: 1cd422f2411a363f4bb66c5cecdaaab883788ae0585bbe1ab83f728e93766f83.

A publicly accessible reference listing for this driver is included in #226831. That link is a tooling reference only: #226831 concerns a different input and operation. The reference source has not been bound to this historical binary by a build record; the exact build configuration and linked-library identities remain unavailable. I am not substituting a mlir-opt invocation for the observed driver.

Reproducer

The original saved input is included unchanged. It is malformed IR; no valid-program miscompilation is claimed.

func.func @masked_vec_add(%arg0: vector<4xi1>, %arg1: vector<4xi1>) -> vector<4xi1> {
  %0 = vector.mask %arg0, %arg1 {
    %1 = arith.addi %arg0, %arg1 : vector<4xi1>
    vector.yield %1 : vector<4xi1>
  } : vector<4xi1>
  return %0 : vector<4xi1>
}

Steps to reproduce

The recorded invocation passed these exact bytes on stdin to ggfa-ir-facts-r1 with no additional arguments. This describes the saved call, not a newly tested command. The historical driver build cannot be reconstructed from a verified build recipe currently available in this report; the reference source and limitations are identified above. No equivalent mlir-opt result is claimed.

Actual behavior

The saved process record reports SIGABRT (subprocess return code -6). Stdout was empty. The complete diagnostic, with the private filesystem prefix removed, was:

llvm/include/llvm/ADT/SmallVector.h:291: reference llvm::SmallVectorTemplateCommon<mlir::Type>::operator[](size_type) [T = mlir::Type]: Assertion `idx < size()' failed.

There was no stack trace in the saved stderr.

Expected behavior

The malformed type list should be diagnosed normally. In particular, #140319 adds a parser check for a passthru operand without a result type, which supports a normal rejection for this condition rather than an assertion.

Analysis

The saved input supplies a passthru operand but has no arrow result-type list. In the recorded LLVM source, the parser indexes the first result type in that situation; #140319 adds an empty-list check before that access.

Unlike the regression examples in that PR, this input has a non-empty region and binds the operation result. There is no evidence that these differences bypass the fix. The source comparison supports association with the already-fixed condition; the saved stderr has no stack trace, so the precise historical dynamic call site is not established.

There has been no independent rerun or post-fix run of this exact driver/input pair. A shared root cause with #140319 is plausible, and this report is not evidence of a regression in current LLVM or of a new independent defect.

Related issues

  • #140319: merged fix and regression tests for the matching passthru/missing-result-type condition; likely relevant to this observation.
  • #226831: public reference source and build limitations for the same historical driver binary. That issue concerns a different input and operation; the link is for tooling context, not a claim of a shared defect.

AI assistance was used to review the saved evidence and draft this report.

lin334141-cell avatar Sep 28 '26 08:09 lin334141-cell

@llvm/issue-subscribers-mlir

Author: lin334141-cell

A saved run of a custom MLIR parsing/verification driver terminated with a SmallVector assertion on the malformed `vector.mask` input below. The missing-result-type condition appears to be addressed by #140319. This report is limited to the listed historical revision; it does not establish a separate defect or a failure after that fix.

Environment

  • Recorded LLVM revision: 13c6abfac84fca4bc55c0721d1853ce86a385678.
  • Observed executable: the custom parsing/verification driver ggfa-ir-facts-r1, receiving the input below on stdin with no additional arguments.
  • Historical executable SHA-256: 1cd422f2411a363f4bb66c5cecdaaab883788ae0585bbe1ab83f728e93766f83.

A publicly accessible reference listing for this driver is included in #226831. That link is a tooling reference only: #226831 concerns a different input and operation. The reference source has not been bound to this historical binary by a build record; the exact build configuration and linked-library identities remain unavailable. I am not substituting a mlir-opt invocation for the observed driver.

Reproducer

The original saved input is included unchanged. It is malformed IR; no valid-program miscompilation is claimed.

func.func @<!-- -->masked_vec_add(%arg0: vector&lt;4xi1&gt;, %arg1: vector&lt;4xi1&gt;) -&gt; vector&lt;4xi1&gt; {
  %0 = vector.mask %arg0, %arg1 {
    %1 = arith.addi %arg0, %arg1 : vector&lt;4xi1&gt;
    vector.yield %1 : vector&lt;4xi1&gt;
  } : vector&lt;4xi1&gt;
  return %0 : vector&lt;4xi1&gt;
}

Steps to reproduce

The recorded invocation passed these exact bytes on stdin to ggfa-ir-facts-r1 with no additional arguments. This describes the saved call, not a newly tested command. The historical driver build cannot be reconstructed from a verified build recipe currently available in this report; the reference source and limitations are identified above. No equivalent mlir-opt result is claimed.

Actual behavior

The saved process record reports SIGABRT (subprocess return code -6). Stdout was empty. The complete diagnostic, with the private filesystem prefix removed, was:

llvm/include/llvm/ADT/SmallVector.h:291: reference llvm::SmallVectorTemplateCommon&lt;mlir::Type&gt;::operator[](size_type) [T = mlir::Type]: Assertion `idx &lt; size()' failed.

There was no stack trace in the saved stderr.

Expected behavior

The malformed type list should be diagnosed normally. In particular, #140319 adds a parser check for a passthru operand without a result type, which supports a normal rejection for this condition rather than an assertion.

Analysis

The saved input supplies a passthru operand but has no arrow result-type list. In the recorded LLVM source, the parser indexes the first result type in that situation; #140319 adds an empty-list check before that access.

Unlike the regression examples in that PR, this input has a non-empty region and binds the operation result. There is no evidence that these differences bypass the fix. The source comparison supports association with the already-fixed condition; the saved stderr has no stack trace, so the precise historical dynamic call site is not established.

There has been no independent rerun or post-fix run of this exact driver/input pair. A shared root cause with #140319 is plausible, and this report is not evidence of a regression in current LLVM or of a new independent defect.

Related issues

  • #140319: merged fix and regression tests for the matching passthru/missing-result-type condition; likely relevant to this observation.
  • #226831: public reference source and build limitations for the same historical driver binary. That issue concerns a different input and operation; the link is for tooling context, not a claim of a shared defect.

AI assistance was used to review the saved evidence and draft this report.

Independent re-verification (historical-crash review)

We re-ran this observation against a rebuilt pre-fix tree and trees containing the fix. Result: the crash reproduces at 13c6abfac84fca4bc55c0721d1853ce86a385678 and is covered by #140319; after that fix the same bytes get a normal parser diagnostic. We suggest treating this report as fixed by #140319.

What we ran:

  • Pre-fix rebuild of 13c6abfac8… (Release, assertions ON, macOS arm64, MLIR-only build, clean checkout): the original vector.mask input, unchanged, aborts with SIGABRT and SmallVector.h:291: idx < size() raised inside the vector.mask custom parser — same file and line as the saved record. An lldb backtrace puts the abort in mlir::vector::MaskOp::parse, which is the unguarded resultTypes[0] access present in that tree.
  • The reference driver source listed in #226831 (SHA-256 d0bc516a…, byte-identical to the published listing), rebuilt against the same revision's libraries, aborts on the same bytes with the same assertion. This is a same-source rebuild of a published listing, not the historical binary, which remains unavailable.
  • Post-fix, the same input no longer aborts: on an llvmorg-22.1.6 build (the tag contains #140319 per the GitHub compare API) and on a current-main build with assertions ON (revision 61817b48e757…, LLVM 24.0.0git, tested 2026-10-29), parsing fails normally with error: custom op 'vector.mask' expects a result if passthru operand is provided (exit 1, no crash).
  • The two regression inputs added by #140319 behave exactly like the original input in our runs (pre-fix assert → post-fix diagnostic), so the input differences noted in the report (non-empty mask region, bound result) do not bypass the fix. A control input whose result-type list is non-empty parses without the assertion at the pre-fix revision, confirming the abort is specific to the passthru-without-result condition.

Classification: HISTORICAL_CRASH_FIXED_BY_140319 — no separate defect and no current regression. Detailed execution receipts are available upon request.

AI assistance was used to perform the tool runs and prepare this comment.

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