mllm icon indicating copy to clipboard operation
mllm copied to clipboard

Android crashed and forcely rebooted when executing main_qwen_npu

Open taegeonum opened this issue 6 months ago • 9 comments

Hello, I've execute main_qwen_npu folloing the guideline. In fact, there were minor bugs so I've manually fixed them. (e.g., missing adb push ../vocab/qwen_merges.txt ...).

When I ran main_qwen_npu, Android crahsed and forecly rebooted. I've logged where it is crashed using the following code in QNNExecutor.cpp:

    for (int i = 0; i < (int)net->subGraph().size(); ++i) {
        string name = graphNamingRule(i);
        auto &g = net->subGraph()[name];

        std::cout << "graph name: " << name << "\n" << std::flush;
        // cast graph to QNNGraph
        // the qnn_graph below is where we cast the Graph to QNNGraph
        auto expectedBackend = ctx->sub_backend_[i];
        if (graphOffloadRule(expectedBackend, i) == MLLM_CPU) {
            std::cout << "cpu backend\n" << std::flush;
            g->reshape();
            g->setUpTensors();
            std::cout << "cpu backend - reshape, setup tensors\n" << std::flush;
        } else if (graphOffloadRule(expectedBackend, i) == MLLM_QNN) {
            std::cout << "qnn backend\n" << std::flush;
            auto *qnn_graph = dynamic_cast<QNNGraph *>(g.get());
            std::cout << "qnn backend cast\n" << std::flush;
            g->reshape();
            std::cout << "qnn backend reshape\n" << std::flush;
            qnn_graph->setUpTensors(name);
            std::cout << "qnn backend setup tensors\n" << std::flush;
        } else {
            std::cerr << "Backend Not Support" << std::endl;
            exit(1);
        }
    }

When I set -c 0, Android crashes while casting Prompt_Graph.43 and performing qnn_graph->setUpTensors(name):

graph name: Prompt_Graph.43
qnn backend
qnn backend cast
qnn backend reshape
(crash and reboot)

May I ask what the root cause of this problem is?

taegeonum avatar Aug 12 '24 08:08 taegeonum