Skip to content

Arm backend: Lower grid_sampler_2d to VGF TOSA CUSTOM#19547

Open
bdemirb wants to merge 4 commits into
pytorch:mainfrom
bdemirb:baris_mletorch-1945-Part2_2_vgf_integration
Open

Arm backend: Lower grid_sampler_2d to VGF TOSA CUSTOM#19547
bdemirb wants to merge 4 commits into
pytorch:mainfrom
bdemirb:baris_mletorch-1945-Part2_2_vgf_integration

Conversation

@bdemirb
Copy link
Copy Markdown
Collaborator

@bdemirb bdemirb commented May 13, 2026

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

pytorch-bot Bot commented May 13, 2026

🔗 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.

❌ 1 New Failure, 1 Unrelated Failure

As of commit b0c25a2 with merge base 4469d84 (image):

NEW FAILURE - The following job has failed:

BROKEN TRUNK - The following job 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
Copy link
Copy Markdown
Collaborator Author

bdemirb commented May 13, 2026

@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
Copy link
Copy Markdown
Collaborator Author

bdemirb commented May 13, 2026

@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
Copy link
Copy Markdown
Collaborator

@robell robell left a comment

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
Copy link
Copy Markdown
Collaborator

zingo commented May 13, 2026

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
Copy link
Copy Markdown
Contributor

meta-codesync Bot commented May 13, 2026

@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
Copy link
Copy Markdown
Collaborator

zingo commented May 18, 2026

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?

Baris Demir added 4 commits June 1, 2026 18:47
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 288e48f to b0c25a2 Compare June 1, 2026 17:47
@linux-foundation-easycla
Copy link
Copy Markdown

CLA Missing ID

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