Skip to content

Arm backend: Lower grid_sampler_2d to VGF TOSA CUSTOM#19547

Merged
digantdesai merged 5 commits into
pytorch:mainfrom
bdemirb:baris_mletorch-1945-Part2_2_vgf_integration
Jun 3, 2026
Merged

Arm backend: Lower grid_sampler_2d to VGF TOSA CUSTOM#19547
digantdesai merged 5 commits into
pytorch:mainfrom
bdemirb:baris_mletorch-1945-Part2_2_vgf_integration

Conversation

@bdemirb

@bdemirb bdemirb commented May 13, 2026

Copy link
Copy Markdown
Collaborator

@bdemirb bdemirb requested a review from digantdesai as a code owner May 13, 2026 12:28
@pytorch-bot

pytorch-bot Bot commented May 13, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19547

Note: Links to docs will display an error until the docs builds have been completed.

❌ 3 New Failures, 2 Unrelated Failures, 2 Unclassified Failures

As of commit be760f4 with merge base c5da8fb (image):

NEW FAILURES - The following jobs have failed:

UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 13, 2026
@github-actions github-actions Bot added ciflow/trunk module: arm Issues related to arm backend labels May 13, 2026
@bdemirb

bdemirb commented May 13, 2026

Copy link
Copy Markdown
Collaborator Author

@pytorchbot label "partner: arm"

@pytorch-bot pytorch-bot Bot added the partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm label May 13, 2026
@bdemirb

bdemirb commented May 13, 2026

Copy link
Copy Markdown
Collaborator Author

@pytorchbot label "release notes: arm"

@pytorch-bot pytorch-bot Bot added the release notes: arm Changes to the ARM backend delegate label May 13, 2026
@bdemirb bdemirb changed the title Baris mletorch 1945 part2 2 vgf integration Arm backend: Lower grid_sampler_2d to VGF TOSA CUSTOM May 13, 2026

@robell robell left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed internally,

Comment thread pyproject.toml
@zingo

zingo commented May 13, 2026

Copy link
Copy Markdown
Collaborator

Hi @digantdesai this one is probably good to tests internally at Meta :)

@zingo zingo added the help wanted Extra attention is needed label May 13, 2026
Comment thread backends/arm/vgf/shaders/grid_sampler.spirv.b64
Comment thread pyproject.toml
@meta-codesync

meta-codesync Bot commented May 13, 2026

Copy link
Copy Markdown
Contributor

@digantdesai has imported this pull request. If you are a Meta employee, you can view this in D105009413.

@bdemirb bdemirb force-pushed the baris_mletorch-1945-Part2_2_vgf_integration branch from 271a05b to 1020f0f Compare May 13, 2026 16:48
@zingo

zingo commented May 18, 2026

Copy link
Copy Markdown
Collaborator

Hi @digantdesai did the internal testing work? This also need a re-import after a small update.

Comment thread backends/arm/vgf/backend.py
@digantdesai

Copy link
Copy Markdown
Contributor

Can you please rebase?

@bdemirb bdemirb force-pushed the baris_mletorch-1945-Part2_2_vgf_integration branch from 288e48f to b0c25a2 Compare June 1, 2026 17:47
@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 1, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

@digantdesai

Copy link
Copy Markdown
Contributor

There were some changes in the CLA, I guess from the Foundation move, can you try it again?

bdemirb added 4 commits June 2, 2026 07:38
This patch builds on the preceding Arm TOSA custom-op
infrastructure changes in Gerrit changes 1222279, 1222280, and
1222278.

On top of that base, it adds the first concrete use case for
grid_sampler_2d by preserving aten.grid_sampler_2d through
partitioning and rewriting it in the Arm lowering pipeline to
tosa.CUSTOM instead of decomposing it into a large standard
TOSA subgraph.

The lowering attaches CustomAttribute metadata carrying a
placeholder shader payload in implementation_attrs, adjusts the
fake tosa.CUSTOM op to behave as a single-output tensor op so it
composes correctly with the existing Arm TOSA pipeline, and adds
a focused regression test showing that a
torch.nn.functional.grid_sample model lowers successfully and
produces exactly one CUSTOM op in the serialized TOSA graph.

Signed-off-by: Baris Demir <baris.demir@arm.com>
Change-Id: I183afd344715e38f613db89ad8945060df7f2f1f
Refactor the grid_sampler_2d TOSA CUSTOM payload into a helper
module so the custom shader contract, constants, and validation
logic live in one place.

Emit the ML SDK Vulkan custom-shader attribute format, including
the converter-recognized domain, entry point, workgroup sizes,
shader language/code, tensor storage-buffer bindings, descriptor
sets, and Vulkan format metadata.

Add focused tests for payload round-trip behavior and for the
grid_sampler_2d rewrite pass.

Signed-off-by: Baris Demir <baris.demir@arm.com>
Change-Id: I8f13f91b97e86b3b32bf2c25479684bc09faeddc
Add a VGF export/integration test for grid_sampler using the
existing VgfPipeline.

The test is gated on model-converter availability and runs with
quantization disabled and Vulkan runtime execution disabled, so
it validates the converter/export handoff without depending on
runtime shader dispatch.

Also register grid_sampler as a recognized custom edge op for the
Arm test-name validator.

Signed-off-by: Baris Demir <baris.demir@arm.com>
Change-Id: I495d4283b09de7dedebce5d2f24b240e79d37dfc
Change-Id: Iae92c23da049949f5f1d0719922d84581893d4f7
@bdemirb bdemirb force-pushed the baris_mletorch-1945-Part2_2_vgf_integration branch from b0c25a2 to 52830fe Compare June 2, 2026 06:39
robell added a commit to robell/executorch that referenced this pull request Jun 2, 2026
…h#19547

Signed-off-by: Rob Elliott <Robert.Elliott@arm.com>
Change-Id: Ic30ddbbdbf0a08d724d2dde9d2f6432918091932
Signed-off-by: Rob Elliott <Robert.Elliott@arm.com>

@digantdesai digantdesai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, and apologies for the lag.

@digantdesai digantdesai merged commit b5f8155 into pytorch:main Jun 3, 2026
478 of 485 checks passed
Gasoonjia pushed a commit that referenced this pull request Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. help wanted Extra attention is needed module: arm Issues related to arm backend partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm release notes: arm Changes to the ARM backend delegate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants