Skip to content

Aboud XNNStaticSlice op #12271

@barbecacov

Description

@barbecacov

🐛 Describe the bug

when i run my pte file by executorch_runner, it report

I 00:00:00.000624 executorch:executor_runner.cpp:175] Using method forward
I 00:00:00.000627 executorch:executor_runner.cpp:226] Setting up planned buffer 0, size 157344.
E 00:00:00.001586 executorch:XNNCompiler.cpp:1416] Failed to create static slice node 149 with code: xnn_status_invalid_parameter
E 00:00:00.001613 executorch:XNNPACKBackend.cpp:119] XNNCompiler::compileModel failed: 0x1
E 00:00:00.001617 executorch:method.cpp:109] Init failed for backend XnnpackBackend: 0x1
F 00:00:00.001621 executorch:executor_runner.cpp:246] In function main(), assert failed (method.ok()): Loading of method forward failed with status 0x1

details

this is XNNStaticSlice op in my pte file,

num_dims 4
offsets 0, 2, 0, 0
sizes 1, 4, 1, 240
input_id name: 41
flags 0

when i run my pte file by executorch_runner, it report

I 00:00:00.000624 executorch:executor_runner.cpp:175] Using method forward
I 00:00:00.000627 executorch:executor_runner.cpp:226] Setting up planned buffer 0, size 157344.
E 00:00:00.001586 executorch:XNNCompiler.cpp:1416] Failed to create static slice node 149 with code: xnn_status_invalid_parameter
E 00:00:00.001613 executorch:XNNPACKBackend.cpp:119] XNNCompiler::compileModel failed: 0x1
E 00:00:00.001617 executorch:method.cpp:109] Init failed for backend XnnpackBackend: 0x1
F 00:00:00.001621 executorch:executor_runner.cpp:246] In function main(), assert failed (method.ok()): Loading of method forward failed with status 0x1

and i check the executorch/backends/xnnpack/third-party/XNNPACK/src/subgraph/static-slice.c, found

    if (!xnn_datatype_is_byte_addressable(input_value->datatype)) {
      xnn_log_error(
        "failed to define %s operator with input ID #%" PRIu32 ": unsupported Value datatype %s (%d)",
        xnn_node_type_to_string(xnn_node_type_static_slice), input_id,
        xnn_datatype_to_string(input_value->datatype), input_value->datatype);
      return xnn_status_invalid_parameter;
    }


      if (strides[i] != 1) {
        xnn_log_error(
          "failed to define %s operator with input ID #%" PRIu32 ": Illegal stride value %" PRIi64 " in dimension #%zu",
          xnn_node_type_to_string(xnn_node_type_static_slice), input_id,
          strides[i], i);
        return xnn_status_invalid_parameter;
      }

and found in executorch/backends/xnnpack/third-party/XNNPACK/src/datatype.c

bool xnn_datatype_is_byte_addressable(enum xnn_datatype t) {
  switch (t) {
    case xnn_datatype_invalid:
    case xnn_datatype_qcint4:
    case xnn_datatype_qbint4:
    case xnn_datatype_pfp16:
    case xnn_datatype_pfp32:
    case xnn_datatype_qpint8:
      return false;
    case xnn_datatype_fp16:
    case xnn_datatype_bf16:
    case xnn_datatype_qint8:
    case xnn_datatype_pqint8:
    case xnn_datatype_quint8:
    case xnn_datatype_qint32:
    case xnn_datatype_qcint8:
    case xnn_datatype_qcint32:
    case xnn_datatype_qdint8:
    case xnn_datatype_qduint8:
    case xnn_datatype_int32:
    case xnn_datatype_fp32:
      return true;
  }
  XNN_UNREACHABLE;
  return false;
}

so How could i run the StaticSlice op correctly?

Thank you very much

cc @digantdesai @mcr229 @cbilgin

Metadata

Metadata

Labels

module: xnnpackIssues related to xnnpack delegation and the code under backends/xnnpack/triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

Status

To triage

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions