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

Crash with ONNX Split operator #891

Open
abcdrm opened this issue Nov 3, 2023 · 0 comments
Open

Crash with ONNX Split operator #891

abcdrm opened this issue Nov 3, 2023 · 0 comments

Comments

@abcdrm
Copy link

abcdrm commented Nov 3, 2023

When I make a ONNX node Split:

node = onnx.helper.make_node(
    "Split",
    inputs=["input"],
    outputs=["output_1", "output_2", "output_3"],
    axis=1
)

The ONNX split doc says that the split input is optional. So I did not use this input.
Then I run this node with ppl.nn.llm, which gives:

[ERROR][2023-11-03 16:34:43.746][reshape_split.cc:51] ERROR: output_count[3] != split point size[2]
[ERROR][2023-11-03 16:34:43.746][kernel.cc:39] Reshape kernel[ppl_anonymous_node_0] failed: invalid value
[ERROR][2023-11-03 16:34:43.746][sequential_scheduler.cc:130] exec kernel[ppl_anonymous_node_0] of type[:Split:13] failed: invalid value
[ERROR][2023-11-03 16:34:43.746][runtime_impl.cc:333] Run() failed: invalid value
[ERROR][2023-11-03 16:34:43.746][pplnn_llm.cc:1213] Run() failed: invalid value

I check the code in pplnn/src/ppl/nn/oputils/onnx/reshape_split.cc

RetCode ReshapeSplit(InputOutputInfo* info, const ir::Attr* arg, const int64_t* split_point) {
    auto param = static_cast<const SplitParam*>(arg);
    auto split_size = info->GetInput<TensorImpl>(1)->GetShape()->GetDim(0);
    const TensorShape& shape = *info->GetInput<TensorImpl>(0)->GetShape();
    int dim_count = shape.GetDimCount();
    uint32_t split_axis = param->axis >= 0 ? param->axis : param->axis + dim_count;

I print info->GetInputCount(), which gives 1, means it has a single input. But split_size accesses info->GetInput<TensorImpl>(1), which is the second input. Plz check this issue.

Also in ppl.nn.llm src/ppl/nn/engines/llm_cuda/ops/onnx/split_op.cc.
Line 59-62:

auto split = info->GetInput<TensorImpl>(1);
if (!split->GetBufferPtr()) {
    return RC_NOT_FOUND;
}

This check seems not work.

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