cornell-zhang/hcl-dialect

[Binding] ReduceOp with FixedType crashed

Closed this issue · 0 comments

When casting the result of ReduceOp with FixedType, the program directly crashes:

llvm-project/mlir/include/mlir/IR/Types.h:251: U mlir::Type::cast() const [with U = mlir::IntegerType]: Assertion `isa<U>()' failed.
 #0 0x00007f4fc7031edf PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x00007f4fc702f909 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f4fd50c3630 __restore_rt sigaction.c:0:0
 #3 0x00007f4fd4d1c387 raise (/lib64/libc.so.6+0x36387)
 #4 0x00007f4fd4d1da78 abort (/lib64/libc.so.6+0x37a78)
 #5 0x00007f4fd4d151a6 __assert_fail_base (/lib64/libc.so.6+0x2f1a6)
 #6 0x00007f4fd4d15252 (/lib64/libc.so.6+0x2f252)
 #7 0x00007f4fc86a8e29 (/home/hc676/hcl-dialect-prototype/build/tools/hcl/python_packages/hcl_core/hcl_mlir/_mlir_libs/libHCLMLIRAggregateCAPI.so.14+0xda2e29)
 #8 0x00007f4fc8612a29 mlirIntegerAttrGet (/home/hc676/hcl-dialect-prototype/build/tools/hcl/python_packages/hcl_core/hcl_mlir/_mlir_libs/libHCLMLIRAggregateCAPI.so.14+0xd0ca29)
 #9 0x00007f4fcde5c0ab (anonymous namespace)::PyIntegerAttribute::bindDerived(pybind11::class_<(anonymous namespace)::PyIntegerAttribute, mlir::python::PyAttribute>&)::'lambda'(mlir::python::PyType&, long)::operator()(mlir::python::PyType&, long) const /scratch/users/hc676/llvm-project/mlir/lib/Bindings/Python/IRAttributes.cpp:254:0
#10 0x00007f4fcde80e1c (anonymous namespace)::PyIntegerAttribute pybind11::detail::argument_loader<mlir::python::PyType&, long>::call_impl<(anonymous namespace)::PyIntegerAttribute, (anonymous namespace)::PyIntegerAttribute::bindDerived(pybind11::class_<(anonymous namespace)::PyIntegerAttribute, mlir::python::PyAttribute>&)::'lambda'(mlir::python::PyType&, long)&, 0ul, 1ul, pybind11::detail::void_type>((anonymous namespace)::PyIntegerAttribute::bindDerived(pybind11::class_<(anonymous namespace)::PyIntegerAttribute, mlir::python::PyAttribute>&)::'lambda'(mlir::python::PyType&, long)&, std::integer_sequence<unsigned long, 0ul, 1ul>, pybind11::detail::void_type&&) && /home/hc676/.conda/envs/pydev/lib/python3.6/site-packages/pybind11/include/pybind11/cast.h:1206:0
#11 0x00007f4fcde76efe _ZNO8pybind116detail15argument_loaderIJRN4mlir6python6PyTypeElEE4callIN12_GLOBAL__N_118PyIntegerAttributeENS0_9void_typeERZNS9_11bindDerivedERNS_6class_IS9_JNS3_11PyAttributeEEEEEUlS5_lE_EENSt9enable_ifIXntsrSt7is_voidIT_E5valueESJ_E4typeEOT1_ /home/hc676/.conda/envs/pydev/lib/python3.6/site-packages/pybind11/include/pybind11/cast.h:1177:0

This is because we give FixedType to IntegerAttr, which does not inherently support customized types. See this line.