Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error for Tutorial 4 #151

Closed
smc447 opened this issue Oct 5, 2022 · 4 comments
Closed

Error for Tutorial 4 #151

smc447 opened this issue Oct 5, 2022 · 4 comments
Labels
tutorial Issues with the HeteroCL tutorial

Comments

@smc447
Copy link
Collaborator

smc447 commented Oct 5, 2022

Code:

hcl.init()

A = hcl.placeholder((10, 100), "A")

def two_stage(A):
    B = hcl.compute(A.shape, lambda x, y: A[x, y] + 1, "B")
    C = hcl.compute(A.shape, lambda x, y: B[x, y] + 1, "C")
    return C

s = hcl.create_schedule([A], two_stage)
s_B = two_stage.B
print(hcl.lower(s))
try:
    s.dataflow_graph(plot=True)
except:
    pass
s[s_B].reorder(s_B.axis[1], s_B.axis[0])
print(hcl.lower(s))

It completes the first print, but not the second. I think it fails at the reorder
Bug Report:

 #0 0x00007fc257afa48f PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x00007fc257af817c SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fc3b3dec630 __restore_rt sigaction.c:0:0
 #3 0x00007fc255d6e98c mlir::OperationName::Impl::isRegistered() const /home/smc447/llvm-project/mlir/include/mlir/IR/OperationSupport.h:104:0
 #4 0x00007fc255d6e9b3 mlir::OperationName::isRegistered() const /home/smc447/llvm-project/mlir/include/mlir/IR/OperationSupport.h:135:0
 #5 0x00007fc255db8c62 mlir::OperationName::getRegisteredInfo() const /home/smc447/llvm-project/mlir/include/mlir/IR/OperationSupport.h:401:0
 #6 0x00007fc255db93f6 mlir::Operation::getRegisteredInfo() /home/smc447/llvm-project/mlir/include/mlir/IR/Operation.h:56:0
 #7 0x00007fc255dd6e0a mlir::Op<mlir::hcl::CreateLoopHandleOp, mlir::OpTrait::ZeroRegions, mlir::OpTrait::OneResult, mlir::OpTrait::OneTypedResult<mlir::hcl::LoopHandleType>::Impl, mlir::OpTrait::ZeroSuccessors, mlir::OpTrait::OneOperand, mlir::OpTrait::OpInvariants, mlir::InferTypeOpInterface::Trait>::classof(mlir::Operation*) /home/smc447/llvm-project/mlir/include/mlir/IR/OpDefinition.h:1647:0
 #8 0x00007fc255dcc9db llvm::CastInfo<mlir::hcl::CreateLoopHandleOp, mlir::Operation*, void>::isPossible(mlir::Operation*) /home/smc447/llvm-project/mlir/include/mlir/IR/Operation.h:817:0
 #9 0x00007fc255dbed57 llvm::DefaultDoCastIfPossible<mlir::hcl::CreateLoopHandleOp, mlir::Operation*, llvm::CastInfo<mlir::hcl::CreateLoopHandleOp, mlir::Operation*, void>>::doCastIfPossible(mlir::Operation*) /home/smc447/llvm-project/llvm/include/llvm/Support/Casting.h:312:0
#10 0x00007fc255dbb801 decltype(auto) llvm::dyn_cast<mlir::hcl::CreateLoopHandleOp, mlir::Operation>(mlir::Operation*) /home/smc447/llvm-project/llvm/include/llvm/Support/Casting.h:609:0
#11 0x00007fc255d9cad4 mlir::hcl::runReordering(mlir::func::FuncOp&, mlir::hcl::ReorderOp&) /home/smc447/hcl-dialect-prototype/lib/Transforms/LoopTransformations.cpp:343:0
#12 0x00007fc255db242b mlir::hcl::applyLoopTransformationOnSingleFunction(mlir::ModuleOp&, mlir::func::FuncOp&, std::map<std::string, mlir::hcl::CustomizationOp, std::less<std::string>, std::allocator<std::pair<std::string const, mlir::hcl::CustomizationOp>>>&) /home/smc447/hcl-dialect-prototype/lib/Transforms/LoopTransformations.cpp:3418:0
#13 0x00007fc255db2c7d mlir::hcl::applyLoopTransformation(mlir::ModuleOp&) /home/smc447/hcl-dialect-prototype/lib/Transforms/LoopTransformations.cpp:3502:0
#14 0x00007fc255d5f0d9 loopTransformation(MlirModule&) //home/smc447/hcl-dialect-prototype/lib/Bindings/Python/HCLModule.cpp:75:0
#15 0x00007fc255d842df bool pybind11::detail::argument_loader<MlirModule&>::call_impl<bool, bool (*&)(MlirModule&), 0ul, pybind11::detail::void_type>(bool (*&)(MlirModule&), std::integer_sequence<unsigned long, 0ul>, pybind11::detail::void_type&&) && /home/smc447/anaconda3/envs/hlc-env/lib/python3.9/site-packages/pybind11/include/pybind11/cast.h:1442:0
#16 0x00007fc255d81137 _ZNO8pybind116detail15argument_loaderIJR10MlirModuleEE4callIbNS0_9void_typeERPFbS3_EEENSt9enable_ifIXntsrSt7is_voidIT_E5valueESC_E4typeEOT1_ /home/smc447/anaconda3/envs/hlc-env/lib/python3.9/site-packages/pybind11/include/pybind11/cast.h:1410:0
#17 0x00007fc255d7be7c void pybind11::cpp_function::initialize<bool (*&)(MlirModule&), bool, MlirModule&, pybind11::name, pybind11::scope, pybind11::sibling>(bool (*&)(MlirModule&), bool (*)(MlirModule&), pybind11::name const&, pybind11::scope const&, pybind11::sibling const&)::'lambda1'(pybind11::detail::function_call&)::operator()(pybind11::detail::function_call&) const /home/smc447/anaconda3/envs/hlc-env/lib/python3.9/site-packages/pybind11/include/pybind11/pybind11.h:249:0
#18 0x00007fc255d7bef3 void pybind11::cpp_function::initialize<bool (*&)(MlirModule&), bool, MlirModule&, pybind11::name, pybind11::scope, pybind11::sibling>(bool (*&)(MlirModule&), bool (*)(MlirModule&), pybind11::name const&, pybind11::scope const&, pybind11::sibling const&)::'lambda1'(pybind11::detail::function_call&)::_FUN(pybind11::detail::function_call&) /home/smc447/anaconda3/envs/hlc-env/lib/python3.9/site-packages/pybind11/include/pybind11/pybind11.h:224:0
#19 0x00007fc255d6c0c1 pybind11::cpp_function::dispatcher(_object*, _object*, _object*) /home/smc447/anaconda3/envs/hlc-env/lib/python3.9/site-packages/pybind11/include/pybind11/pybind11.h:929:0
#20 0x0000000000508127 _PyErr_Occurred /usr/local/src/conda/python-3.9.13/Include/internal/pycore_pyerrors.h:14:18
#21 0x0000000000508127 _Py_CheckFunctionResult /usr/local/src/conda/python-3.9.13/Objects/call.c:39:14
#22 0x0000000000508127 cfunction_call /usr/local/src/conda/python-3.9.13/Objects/methodobject.c:554:12
#23 0x00000000004f0edc _PyObject_MakeTpCall /usr/local/src/conda/python-3.9.13/Objects/call.c:191:18
#24 0x00000000004ed255 _PyObject_VectorcallTstate /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:116:16
#25 0x00000000004ed255 _PyObject_VectorcallTstate /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:103:1
#26 0x00000000004ed255 PyObject_Vectorcall /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:127:12
#27 0x00000000004ed255 call_function /usr/local/src/conda/python-3.9.13/Python/ceval.c:5077:13
#28 0x00000000004ed255 _PyEval_EvalFrameDefault /usr/local/src/conda/python-3.9.13/Python/ceval.c:3489:23
#29 0x00000000004e70ca _PyEval_EvalCode /usr/local/src/conda/python-3.9.13/Python/ceval.c:4338:9
#30 0x00000000004f8515 _PyFunction_Vectorcall /usr/local/src/conda/python-3.9.13/Objects/call.c:404:1
#31 0x00000000004eccef _Py_CheckFunctionResult /usr/local/src/conda/python-3.9.13/Objects/call.c:38:8
#32 0x00000000004eccef _PyObject_VectorcallTstate /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:119:12
#33 0x00000000004eccef PyObject_Vectorcall /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:127:12
#34 0x00000000004eccef call_function /usr/local/src/conda/python-3.9.13/Python/ceval.c:5077:13
#35 0x00000000004eccef _PyEval_EvalFrameDefault /usr/local/src/conda/python-3.9.13/Python/ceval.c:3489:23
#36 0x00000000004e70ca _PyEval_EvalCode /usr/local/src/conda/python-3.9.13/Python/ceval.c:4338:9
#37 0x00000000004e6d57 _PyEval_EvalCodeWithName /usr/local/src/conda/python-3.9.13/Python/ceval.c:4361:12
#38 0x00000000004e6d09 PyEval_EvalCodeEx /usr/local/src/conda/python-3.9.13/Python/ceval.c:4384:1
#39 0x0000000000594e7b PyEval_EvalCode /usr/local/src/conda/python-3.9.13/Python/ceval.c:834:1
#40 0x00000000005c2307 run_eval_code_obj /usr/local/src/conda/python-3.9.13/Python/pythonrun.c:1222:8
#41 0x00000000005be270 _Py_DECREF /usr/local/src/conda/python-3.9.13/Include/object.h:422:8
#42 0x00000000005be270 run_mod /usr/local/src/conda/python-3.9.13/Python/pythonrun.c:1243:5
#43 0x00000000004563ed pyrun_file.cold /usr/local/src/conda/python-3.9.13/Python/pythonrun.c:1140:15
#44 0x00000000005b8062 pyrun_simple_file /usr/local/src/conda/python-3.9.13/Python/pythonrun.c:450:13
#45 0x00000000005b8062 PyRun_SimpleFileExFlags /usr/local/src/conda/python-3.9.13/Python/pythonrun.c:483:15
#46 0x00000000005b55ce _Py_DECREF /usr/local/src/conda/python-3.9.13/Include/object.h:422:8
#47 0x00000000005b55ce _Py_XDECREF /usr/local/src/conda/python-3.9.13/Include/object.h:497:9
#48 0x00000000005b55ce pymain_run_file /usr/local/src/conda/python-3.9.13/Modules/main.c:380:5
#49 0x00000000005b55ce pymain_run_python /usr/local/src/conda/python-3.9.13/Modules/main.c:604:21
#50 0x00000000005b55ce Py_RunMain /usr/local/src/conda/python-3.9.13/Modules/main.c:683:5
#51 0x0000000000588ff9 Py_BytesMain /usr/local/src/conda/python-3.9.13/Modules/main.c:1130:1
#52 0x00007fc3b3328555 __libc_start_main (/lib64/libc.so.6+0x22555)
#53 0x0000000000588eae _start (/home/smc447/anaconda3/envs/hlc-env/bin/python3.9+0x588eae)
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Segmentation fault
@smc447 smc447 added the tutorial Issues with the HeteroCL tutorial label Oct 5, 2022
@chhzh123
Copy link
Member

chhzh123 commented Oct 5, 2022

Currently we cannot support two consequential hcl.lower functions. We expect users to apply all the primitives before the lowering process. Could you comment the first hcl.lower and try again? @smc447

@zhangzhiru
Copy link

We need to prompt proper error messages instead of letting the tool crash.

@chhzh123
Copy link
Member

chhzh123 commented Oct 5, 2022

Added error messages in the latest HeteroCL commit.

@zzzDavid
Copy link
Collaborator

Closing this thread as tutorial 4 passes test and is added in the CI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tutorial Issues with the HeteroCL tutorial
Projects
None yet
Development

No branches or pull requests

4 participants