[ExecuTorch][WebGPU] Port grid_sampler_2d#21179
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21179
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ❌ 77 New FailuresAs of commit d304004 with merge base 266e0dc ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
psiddh
left a comment
There was a problem hiding this comment.
Approving full WebGPU stack
Stack from ghstack (oldest at bottom):
Ports
aten.grid_sampler_2d.defaultas a bilinear grid sample, the last Phase B (vision) float op. Mirrors Vulkan's config-specific implementation: bilinear interpolation, border padding, align_corners=true.Key changes:
runtime/ops/grid_sampler_2d/{GridSampler2d.cpp, grid_sampler_2d.wgsl}(+ generated_wgsl.h) — per NCHW output element: read the normalized(gx, gy)fromgrid[N, out_h, out_w, 2], unnormalize(g+1)*0.5*(in_size-1)(align_corners), clamp to[0, in_size-1](border), gather the 4 neighbors,out = mix(mix(s00,s10,wx), mix(s01,s11,wx), wy). Registeredaten.grid_sampler_2d.default.CMakeLists.txt—runtime/ops/grid_sampler_2d/GridSampler2d.cppinWEBGPU_SRCS.Mirrors Vulkan
glsl/grid_sampler_2d.glsl(same coord/clamp/interp) +impl/GridSampler2d.cpp(arg order[in, grid, interp, padding, align, out]; fail-loudVK_CHECK_CONDguards for interp==bilinear / padding==border / align_corners==true; grid a contiguous[N,Hout,Wout,2]buffer). Buffer NCHW re-derivation (Vulkan is texture). The grid is bound as anarray<f32>read buffer. A dynamic-shape resize hook recomputes out=[in.N, in.C, grid.Hout, grid.Wout]+ params + dispatch; it triggers on BOTHinandgrid(the out shape depends on grid), mirroring howmulhooks both operands. Fail-loud guards: config, 4D in/out/grid, fp32 in/out + grid== N*Hout*Wout*2, out numel<= u32.Differential Revision: D112257585