pytorch / pytorch/executorch

Aboud XNNStaticSlice op

Open
#12,271 8 comments 0 reactions 3 assignees View on GitHub

@cbilgin is already working on this.

Since Jul 8, 2025.

module: xnnpack triaged
Dominant language
Python
Stars
5k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
581

Description

🐛 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.