pytorch / pytorch/executorch

Share int64 → int32 cast insertion pass across backends (TOSA, XNNPACK, etc.)

Open
#12,957 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

🚀 The feature, motivation and pitch
Description

In PR #12242, we used a pass InsertCastForOpsWithInt64InputPass to insert an int32 cast node to convert inputs from int64 to int32 for nodes withaten.slice_copy.Tensor in TOSA backend. This enables certain operators to be delegated to the TOSA backend, which requires int32 inputs.

Based on @digantdesai suggestions, this pass can be reused across multiple backends (TOSA, XNNPACK, etc.) that have the similar case.

Proposal

Refactor and move this pass to exir/passes so that it can be shared across multiple backends.

Alternatives

No response

Additional context

No response

RFC (Optional)

No response

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.

Research direction

Review PR #12242 and locate InsertCastForOpsWithInt64InputPass in the TOSA backend. Trace how the pass handles aten.slice_copy.Tensor, then assess moving it into exir/passes for reuse by TOSA, XNNPACK, and similar backends. Done means the shared pass is available from exir/passes and the existing TOSA use continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, machine-learning
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.