[mlir]Assertion `uminVal.getBitWidth() == umaxVal.getBitWidth() && umaxVal.getBitWidth() == sminVal.getBitWidth() && sminVal.getBitWidth() == smaxVal.getBitWidth() && "All bounds in the ranges must have the same bitwidth"' failed.
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
git version: 58031e519153fdbe637f9f135ac1fbfef6f0e224
system: `Ubuntu 18.04.6 LTS`
reproduce with: `mlir-opt -arith-int-range-narrowing=int-bitwidths-supported=8 a.mlir`
a.mlir:
```mlir
module {
llvm.func @test_add_i8_wrap2() -> i32 {
%cst1_i32 = spirv.Constant 1 : i32
%0 = test.with_bounds {smax = 127 : i8, smin = 0 : i8, umax = 127 : ui8, umin = 0 : i32} : i32
%1 = builtin.unrealized_conversion_cast %0 : i32 to i8
%2 = spirv.IAdd %0, %cst1_i32 : i32
%3 = builtin.unrealized_conversion_cast %2 : i32 to i8
%4 = test.reflect_bounds %3 : i8
%5 = builtin.unrealized_conversion_cast %4 : i8 to i32
llvm.return %5 : i32
}
}
```
stack trace:
```
mlir-opt: /data/szy/MLIR/llvm-release/llvm-project/mlir/include/mlir/Interfaces/InferIntRangeInterface.h:37: mlir::ConstantIntRanges::ConstantIntRanges(const APInt &, const APInt &, const APInt &, const APInt &): Assertion `uminVal.getBitWidth() == umaxVal.getBitWidth() && umaxVal.getBitWidth() == sminVal.getBitWidth() && sminVal.getBitWidth() == smaxVal.getBitWidth() && "All bounds in the ranges must have the same bitwidth"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: /data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt -arith-int-range-narrowing=int-bitwidths-supported=8 11.mlir
#0 0x000055660fc41798 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x1ff4798)
#1 0x000055660fc3e631 llvm::sys::RunSignalHandlers() (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x1ff1631)
#2 0x000055660fc428b6 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007fada98d1420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007fada8f0e00b raise /build/glibc-LcI20x/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#5 0x00007fada8eed859 abort /build/glibc-LcI20x/glibc-2.31/stdlib/abort.c:81:7
#6 0x00007fada8eed729 get_sysdep_segment_value /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:509:8
#7 0x00007fada8eed729 _nl_load_domain /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:970:34
#8 0x00007fada8efefd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#9 0x000055660fdbad30 test::TestWithoutBoundsOp::inferResultRangesFromOptional(llvm::ArrayRef, llvm::function_ref) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x216dd30)
#10 0x000055660fdbab59 test::TestWithBoundsOp::inferResultRanges(llvm::ArrayRef, llvm::function_ref) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x216db59)
#11 0x00005566103be2e1 mlir::detail::InferIntRangeInterfaceInterfaceTraits::Model::inferResultRanges(mlir::detail::InferIntRangeInterfaceInterfaceTraits::Concept const*, mlir::Operation*, llvm::ArrayRef, llvm::function_ref) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x27712e1)
#12 0x0000556618815116 mlir::intrange::detail::defaultInferResultRanges(mlir::InferIntRangeInterface, llvm::ArrayRef, llvm::function_ref) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xabc8116)
#13 0x000055661874a976 mlir::dataflow::IntegerRangeAnalysis::visitOperation(mlir::Operation*, llvm::ArrayRef, llvm::ArrayRef) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xaafd976)
#14 0x000055661875418f mlir::dataflow::AbstractSparseForwardDataFlowAnalysis::visitOperation(mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xab0718f)
#15 0x0000556618752315 mlir::dataflow::AbstractSparseForwardDataFlowAnalysis::initializeRecursively(mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xab05315)
#16 0x00005566187530db mlir::dataflow::AbstractSparseForwardDataFlowAnalysis::initializeRecursively(mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xab060db)
#17 0x00005566187530db mlir::dataflow::AbstractSparseForwardDataFlowAnalysis::initializeRecursively(mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xab060db)
#18 0x00005566186faaef mlir::DataFlowSolver::initializeAndRun(mlir::Operation*, llvm::function_ref) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xaaadaef)
#19 0x0000556616bc81a7 (anonymous namespace)::IntRangeNarrowingPass::runOnOperation() IntRangeOptimizations.cpp:0:0
#20 0x00005566185fdc22 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xa9b0c22)
#21 0x00005566185fea64 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xa9b1a64)
#22 0x000055661860597a mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xa9b897a)
#23 0x00005566186052af mlir::PassManager::run(mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xa9b82af)
#24 0x000055660fcf2940 performActions(llvm::raw_ostream&, std::shared_ptr const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#25 0x000055660fcf1b76 llvm::LogicalResult llvm::function_ref>, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>::callback_fn>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::$_0>(long, std::unique_ptr>, llvm::MemoryBufferRef const&, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#26 0x0000556618952ca5 mlir::splitAndProcessBuffer(std::unique_ptr>, llvm::function_ref>, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xad05ca5)
#27 0x000055660fce7776 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x209a776)
#28 0x000055660fce7b55 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x209ab55)
#29 0x000055660fce7eb5 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x209aeb5)
#30 0x000055660fc27222 main (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x1fda222)
#31 0x00007fada8eef083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#32 0x000055660fc26d5e _start (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x1fd9d5e)
Aborted (core dumped)
```
Contributor guide
Research direction
Run mlir-opt with -arith-int-range-narrowing=int-bitwidths-supported=8 on the supplied a.mlir reproducer. Read InferIntRangeInterface.h and trace TestWithBoundsOp and TestWithoutBoundsOp, as identified in the stack trace, to find where the mixed i8, ui8, and i32 bounds reach ConstantIntRanges. Done means the reproducer no longer aborts on the equal-bitwidth assertion.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100