Skip to content

[Mobile] How to print the xnnpack EP related information when created the sesson? #25491

@kangli2025

Description

@kangli2025

Describe the issue

I want to use libonnxruntime(1.22.0) and compare the acceleration performance of XNNPACK EP. However, I found that the logs from XNNPACK EP are not detailed enough. They only show the available EPs but do not indicate which EP is currently being used or how many nodes in the ONNX model are being accelerated by XNNPACK EP. The xnnpack delegate in tflite provide such information like

INFO: Created TensorFlow Lite XNNPACK delegate for CPU
VERBOSE: Replacing xxx out of xxx node(s) with delegate (TfLiteXNNPackDelegate) node, yielding xx partitions for subgraps

To reproduce

int main() {
    Ort::Env env(ORT_LOGGING_LEVEL_VERBOSE, "test");
    Ort::SessionOptions session_options;
    // Append EPs as desired
    session_options.AppendExecutionProvider("XNNPACK", { {"intra_op_num_threads", "4"} });
    session_options.SetGraphOptimizationLevel(GraphOptimizationLevel::ORT_ENABLE_BASIC);


  // Print available execution providers
    auto providers = Ort::GetAvailableProviders();
    std::cout << "Available EPs:\n";
    for (const auto& ep : providers) {
        std::cout << ep << std::endl;
    }

// Print available execution providers
    auto providers = Ort::GetAvailableProviders();
    std::cout << "Available EPs:\n";
    for (const auto& ep : providers) {
        std::cout << ep << std::endl;
    }

    // Load your model
    Ort::Session session(env, "your_model.onnx", session_options);
}

Urgency

No response

Platform

Android

OS Version

15

ONNX Runtime Installation

Built from Source

Compiler Version (if 'Built from Source')

bazel 6.5.0

Package Name (if 'Released Package')

None

ONNX Runtime Version or Commit ID

f217402

ONNX Runtime API

C++/C

Architecture

ARM64

Execution Provider

Other / Unknown

Execution Provider Library Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    ep:Xnnpackissues related to XNNPACK EPplatform:mobileissues related to ONNX Runtime mobile; typically submitted using template

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions