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

Reorder and buffer_at problem #186

Open
smc447 opened this issue May 1, 2023 · 0 comments
Open

Reorder and buffer_at problem #186

smc447 opened this issue May 1, 2023 · 0 comments

Comments

@smc447
Copy link
Collaborator

smc447 commented May 1, 2023

note axis[1] is output fmap, [2] is y, [3] is x, 4 ,5, 6 reduction axis. The problem I think is reordering not really the buffer at

`hcl.init()
def bnn_conv(INPUT, w_conv1):
conv1 = bnn.conv2d_nchw(INPUT,w_conv1, padding=[1, 1], name="conv1", out_dtype=hcl.Int(32))
return conv1

INPUT = hcl.placeholder((1,16,8,8),"input", hcl.UInt(1))
w_conv1 = hcl.placeholder((32,16,3,3),"w_conv1", hcl.UInt(1))
s = hcl.create_schedule([INPUT, w_conv1], bnn_conv)

s[bnn_conv.conv1].reorder( bnn_conv.conv1.axis[1], bnn_conv.conv1.axis[2],bnn_conv.conv1.axis[4], bnn_conv.conv1.axis[5], bnn_conv.conv1.axis[6], bnn_conv.conv1.axis[3] )
s.buffer_at(bnn_conv.conv1, s[bnn_conv.conv1], bnn_conv.conv1.axis[2])
f_sim = hcl.build(s, target="vhls")
print(f_sim)`

error
(hlc-env) smc447@zhang-x1:/scratch/users/smc447/simpl_bnn$ python3 inter_acc.py python3: /home/smc447/llvm-project/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp:1496: unsigned int mlir::permuteLoops(llvm::MutableArrayRef<mlir::AffineForOp>, llvm::ArrayRef<unsigned int>): Assertion false && "invalid permutation map"' failed.
#0 0x00007fb4ccd271cf PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
#1 0x00007fb4ccd24ebc SignalHandler(int) Signals.cpp:0:0
#2 0x00007fb629069630 __restore_rt sigaction.c:0:0
#3 0x00007fb6285b9387 raise (/lib64/libc.so.6+0x36387)
#4 0x00007fb6285baa78 abort (/lib64/libc.so.6+0x37a78)
#5 0x00007fb6285b21a6 __assert_fail_base (/lib64/libc.so.6+0x2f1a6)
#6 0x00007fb6285b2252 (/lib64/libc.so.6+0x2f252)
#7 0x00007fb4cd8f5e67 mlir::permuteLoops(llvm::MutableArrayRefmlir::AffineForOp, llvm::ArrayRef) (/home/smc447/hcl-dialect-prototype/build/tools/hcl/python_packages/hcl_core/hcl_mlir/_mlir_libs/libHCLMLIRAggregateCAPI.so.15+0x1d64e67)
#8 0x00007fb4caf643ab mlir::hcl::runReordering(mlir::func::FuncOp&, mlir::hcl::ReorderOp&) /home/smc447/hcl-dialect-prototype/lib/Transforms/LoopTransformations.cpp:439:0
#9 0x00007fb4caf79b49 mlir::hcl::applyLoopTransformationOnSingleFunction(mlir::ModuleOp&, mlir::func::FuncOp&, std::map<std::string, mlir::hcl::CustomizationOp, std::lessstd::string, std::allocator<std::pair<std::string const, mlir::hcl::CustomizationOp>>>&) /home/smc447/hcl-dialect-prototype/lib/Transforms/LoopTransformations.cpp:3473:0
#10 0x00007fb4caf7a4a1 mlir::hcl::applyLoopTransformation(mlir::ModuleOp&) /home/smc447/hcl-dialect-prototype/lib/Transforms/LoopTransformations.cpp:3566:0
#11 0x00007fb4caf26279 loopTransformation(MlirModule&) //home/smc447/hcl-dialect-prototype/lib/Bindings/Python/HCLModule.cpp:74:0
#12 0x00007fb4caf4b47f 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
#13 0x00007fb4caf482d7 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
#14 0x00007fb4caf4301c 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
#15 0x00007fb4caf43093 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
#16 0x00007fb4caf33261 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
#17 0x0000000000508127 _PyErr_Occurred /usr/local/src/conda/python-3.9.13/Include/internal/pycore_pyerrors.h:14:18
#18 0x0000000000508127 _Py_CheckFunctionResult /usr/local/src/conda/python-3.9.13/Objects/call.c:39:14
#19 0x0000000000508127 cfunction_call /usr/local/src/conda/python-3.9.13/Objects/methodobject.c:554:12
#20 0x00000000004f0edc _PyObject_MakeTpCall /usr/local/src/conda/python-3.9.13/Objects/call.c:191:18
#21 0x00000000004ed255 _PyObject_VectorcallTstate /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:116:16
#22 0x00000000004ed255 _PyObject_VectorcallTstate /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:103:1
#23 0x00000000004ed255 PyObject_Vectorcall /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:127:12
#24 0x00000000004ed255 call_function /usr/local/src/conda/python-3.9.13/Python/ceval.c:5077:13
#25 0x00000000004ed255 _PyEval_EvalFrameDefault /usr/local/src/conda/python-3.9.13/Python/ceval.c:3489:23
#26 0x00000000004f87f3 function_code_fastcall /usr/local/src/conda/python-3.9.13/Objects/call.c:332:9
#27 0x00000000004e83a1 _Py_CheckFunctionResult /usr/local/src/conda/python-3.9.13/Objects/call.c:38:8
#28 0x00000000004e83a1 _PyObject_VectorcallTstate /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:119:12
#29 0x00000000004e83a1 PyObject_Vectorcall /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:127:12
#30 0x00000000004e83a1 call_function /usr/local/src/conda/python-3.9.13/Python/ceval.c:5077:13
#31 0x00000000004e83a1 _PyEval_EvalFrameDefault /usr/local/src/conda/python-3.9.13/Python/ceval.c:3520:19
#32 0x00000000004e70ca _PyEval_EvalCode /usr/local/src/conda/python-3.9.13/Python/ceval.c:4338:9
#33 0x00000000004f8515 _PyFunction_Vectorcall /usr/local/src/conda/python-3.9.13/Objects/call.c:404:1
#34 0x00000000004e83a1 _Py_CheckFunctionResult /usr/local/src/conda/python-3.9.13/Objects/call.c:38:8
#35 0x00000000004e83a1 _PyObject_VectorcallTstate /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:119:12
#36 0x00000000004e83a1 PyObject_Vectorcall /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:127:12
#37 0x00000000004e83a1 call_function /usr/local/src/conda/python-3.9.13/Python/ceval.c:5077:13
#38 0x00000000004e83a1 _PyEval_EvalFrameDefault /usr/local/src/conda/python-3.9.13/Python/ceval.c:3520:19
#39 0x00000000004e70ca _PyEval_EvalCode /usr/local/src/conda/python-3.9.13/Python/ceval.c:4338:9
#40 0x00000000004f8515 _PyFunction_Vectorcall /usr/local/src/conda/python-3.9.13/Objects/call.c:404:1
#41 0x00000000004e920a _Py_CheckFunctionResult /usr/local/src/conda/python-3.9.13/Objects/call.c:38:8
#42 0x00000000004e920a _PyObject_VectorcallTstate /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:119:12
#43 0x00000000004e920a PyObject_Vectorcall /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:127:12
#44 0x00000000004e920a call_function /usr/local/src/conda/python-3.9.13/Python/ceval.c:5077:13
#45 0x00000000004e920a _PyEval_EvalFrameDefault /usr/local/src/conda/python-3.9.13/Python/ceval.c:3537:19
#46 0x00000000004e70ca _PyEval_EvalCode /usr/local/src/conda/python-3.9.13/Python/ceval.c:4338:9
#47 0x00000000004e6d57 _PyEval_EvalCodeWithName /usr/local/src/conda/python-3.9.13/Python/ceval.c:4361:12
#48 0x00000000004e6d09 PyEval_EvalCodeEx /usr/local/src/conda/python-3.9.13/Python/ceval.c:4384:1
#49 0x0000000000594e7b PyEval_EvalCode /usr/local/src/conda/python-3.9.13/Python/ceval.c:834:1
#50 0x00000000005c2307 run_eval_code_obj /usr/local/src/conda/python-3.9.13/Python/pythonrun.c:1222:8
#51 0x00000000005be270 _Py_DECREF /usr/local/src/conda/python-3.9.13/Include/object.h:422:8
#52 0x00000000005be270 run_mod /usr/local/src/conda/python-3.9.13/Python/pythonrun.c:1243:5
#53 0x00000000004563ed pyrun_file.cold /usr/local/src/conda/python-3.9.13/Python/pythonrun.c:1140:15
#54 0x00000000005b8062 pyrun_simple_file /usr/local/src/conda/python-3.9.13/Python/pythonrun.c:450:13
#55 0x00000000005b8062 PyRun_SimpleFileExFlags /usr/local/src/conda/python-3.9.13/Python/pythonrun.c:483:15
#56 0x00000000005b55ce _Py_DECREF /usr/local/src/conda/python-3.9.13/Include/object.h:422:8
#57 0x00000000005b55ce _Py_XDECREF /usr/local/src/conda/python-3.9.13/Include/object.h:497:9
#58 0x00000000005b55ce pymain_run_file /usr/local/src/conda/python-3.9.13/Modules/main.c:380:5
#59 0x00000000005b55ce pymain_run_python /usr/local/src/conda/python-3.9.13/Modules/main.c:604:21
#60 0x00000000005b55ce Py_RunMain /usr/local/src/conda/python-3.9.13/Modules/main.c:683:5
#61 0x0000000000588ff9 Py_BytesMain /usr/local/src/conda/python-3.9.13/Modules/main.c:1130:1
#62 0x00007fb6285a5555 __libc_start_main (/lib64/libc.so.6+0x22555)
#63 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.
Aborted`

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

No branches or pull requests

1 participant