Repository navigation
[ET-VK][convolution] Nest convolution sources by route - #23722
Closed
pytorchbot wants to merge 1 commit into
Closed
pytorchbot wants to merge 1 commit into
pytorchbot wants to merge 1 commit into
Conversation
Pull Request resolved: #23492 ## Ulterior Motive Organize Vulkan operators by implementation family so operators with multiple routes can use clear, scalable directory layouts. ## Rationale **What**: Move convolution C++ implementations, GLSL templates, YAML variant definitions, and convolution-only shader headers under `convolution/` in both `impl/` and `glsl/`, split into `conv1d/` and `conv2d/`. Split the monolithic `Convolution.cpp` and `Q8taConv2d.{h,cpp}` so each file holds either routing logic or a single implementation route. **Why**: Convolution is implemented through several routes (direct, depthwise, pointwise, im2col/GEMM, transposed), and the q8ta quantized family repeats most of them. In the flat directories their sources were interleaved by name, and single files mixed routing with several route implementations. This prepares for adding further routes such as Winograd. ## Details - Layout (`impl/` and `glsl/` mirror each other) - `convolution/`: `Convolution.{h,cpp}` registers `aten.convolution` and dispatches to conv1d or conv2d by input rank; it also holds `prepack_biases` and `check_conv_args`, used by both. - `convolution/conv1d/`: `Conv1d.{h,cpp}` (`conv1d_impl` routing), `Conv1dDirect.{h,cpp}`, `Conv1dDW.cpp`, `Conv1dPW.cpp`, and the conv1d shaders. - `convolution/conv2d/`: `Conv2d.{h,cpp}` (`conv2d_impl` routing, `Conv2dMethod`, `resize_conv2d_node`), `Conv2dDirect.{h,cpp}` (direct and transposed shader dispatch), `Conv2dDW.cpp`, `Conv2dPW.cpp`, `ConvolutionUtils.h`, `conv2d_common.glslh`, and the direct/depthwise/pointwise shaders. - `convolution/conv2d/{im2col,transposed}/`: im2col/GEMM sources and shaders; transposed shaders. - `convolution/conv2d/q8ta/`: `Q8taConv2d.{h,cpp}` (`q8ta_conv2d` routing and the im2col heuristic, formerly `Q8taConv2dRoute`), `Q8taConv2dCommon.{h,cpp}` (`ActivationType`, packed-dim checks), `Q8taConv2dDirect.{h,cpp}` (general route), `Q8taConv2dDW.{h,cpp}`, `Q8taConv2dPW.{h,cpp}`, plus `im2col/` and `transposed/`. Each route has its own header; consumers include only what they use. - `convolution/conv2d/quantized_legacy/`: `QuantizedConvolution.{h,cpp}` and its shaders and headers. - Weight packing shaders sit in `pack_weights/` subdirectories of the route that dispatches them (`conv2d/`, `conv2d/im2col/`, `conv2d/q8ta/`, `conv2d/transposed/`). - Naming - Functions that add a `DynamicDispatchNode` are named `add_*_node()`; functions that call `add_*_node()` to implement an operator are named `*_impl()`. Registered operator names are unchanged. - `add_conv2d_node` is folded into `conv2d_impl`. Its test-only `force_direct` flag is removed; the conv2d test's `direct` selector calls `conv2d_direct_impl` directly, which is equivalent for its sliding-window cases. - Includes - Route shaders include `conv2d_common.glslh` unchanged through ancestor include resolution. - Root shaders `quantize_and_pack_4w4c` and `unpack_4w4c_and_dequantize` include `convolution/conv2d/conv2d_common.glslh`. - Headers shared with other operator families (`linear_*`, `conv2d_fp_input_tile_load.glslh`, indexing headers) stay at the shader root. - Moved files are recorded as renames; files split from or merged into another file are recorded as copies of their source, so reviews show moved code as unchanged. - Moving code into new files exposes it to CLANGTIDY, so its findings there are fixed: `utils::safe_downcast<int32_t>` for narrowing, `(void)` for unused parameters, an anonymous namespace for the file-local `Conv2dParams`, and removal of an unused `ShaderNameUtils.h` include. Generated shader names and runtime dispatch behavior are unchanged. ghstack-source-id: 446951717 @exported-using-ghexport Differential Revision: [D123450342](https://our.internmc.facebook.com/intern/diff/D123450342/)
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/23722
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was created by the merge bot to help merge the original PR into the main branch.
ghstack PR number: #23492 by @SS-JIA
^ Please use this as the source of truth for the PR details, comments, and reviews
ghstack PR base: https://github.com/pytorch/executorch/tree/gh/SS-JIA/659/base
ghstack PR head: https://github.com/pytorch/executorch/tree/gh/SS-JIA/659/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/gh/SS-JIA/658/orig
Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/SS-JIA/659/orig
Differential Revision: D123450342
@diff-train-skip-merge