Skip to content

Conversation

@SS-JIA
Copy link
Contributor

@SS-JIA SS-JIA commented May 5, 2025

Stack from ghstack (oldest at bottom):

Context

As title. Note that this PR was written mainly with a meta internal coding agent. This PR re-orders the arguments to DispatchNode to be more intuitive.

I asked the agent:


I want to change the constructor of the class

  explicit DispatchNode(
      ComputeGraph& graph,
      const vkapi::ShaderInfo& shader,
      const utils::uvec3& global_workgroup_size,
      const utils::uvec3& local_workgroup_size,
      const std::vector<ArgGroup>& args,
      const vkapi::ParamsBindList& params,
      const vkapi::SpecVarList& spec_vars = {},
      const ResizeFunction& resize_fn = nullptr,
      const std::vector<ValueRef>& resize_args = {},
      const std::vector<PushConstantDataInfo>& push_constants = {});

to instead be

  explicit DispatchNode(
      ComputeGraph& graph,
      const vkapi::ShaderInfo& shader,
      const utils::uvec3& global_workgroup_size,
      const utils::uvec3& local_workgroup_size,
      const std::vector<ArgGroup>& args,
      const vkapi::ParamsBindList& params,,
      const std::vector<PushConstantDataInfo>& push_constants = {},
      const vkapi::SpecVarList& spec_vars = {},
      const std::vector<ValueRef>& resize_args = {},
      const ResizeFunction& resize_fn = nullptr);

Can you make this change and update the callsites as well?


The motivation is to have the arguments match the order in which parameter UBOs, push constant blocks, and specialization variables are declared in a GLSL shader.

The order of resize_argsandresize_fnwas also swapped in the interest of having the function pointer be the last argument. It will also make more sense in a following diff where aDynamicDispatchNode` class is introduced, which will allow selecting a different compute shader depending on input sizes.

As a small additional change, I also asked the agent to


Go through all the files under xplat/executorch/backends/vulkan/runtime/graph/ops/impl

Change vkapi::MemoryAccessType::WRITE to vkapi::kWrite and vkapi::MemoryAccessType::READ to vkapi::kRead for each file.


Differential Revision: D74203482

…er layout spec

## Context

As title. Note that this PR was written mainly with a meta internal coding agent. This PR re-orders the arguments to `DispatchNode` to be more intuitive.

I asked the agent:

---

I want to change the constructor of the class

```
  explicit DispatchNode(
      ComputeGraph& graph,
      const vkapi::ShaderInfo& shader,
      const utils::uvec3& global_workgroup_size,
      const utils::uvec3& local_workgroup_size,
      const std::vector<ArgGroup>& args,
      const vkapi::ParamsBindList& params,
      const vkapi::SpecVarList& spec_vars = {},
      const ResizeFunction& resize_fn = nullptr,
      const std::vector<ValueRef>& resize_args = {},
      const std::vector<PushConstantDataInfo>& push_constants = {});
```

to instead be

```
  explicit DispatchNode(
      ComputeGraph& graph,
      const vkapi::ShaderInfo& shader,
      const utils::uvec3& global_workgroup_size,
      const utils::uvec3& local_workgroup_size,
      const std::vector<ArgGroup>& args,
      const vkapi::ParamsBindList& params,,
      const std::vector<PushConstantDataInfo>& push_constants = {},
      const vkapi::SpecVarList& spec_vars = {},
      const std::vector<ValueRef>& resize_args = {},
      const ResizeFunction& resize_fn = nullptr);
```

Can you make this change and update the callsites as well?

---

The motivation is to have the arguments match the order in which parameter UBOs, push constant blocks, and specialization variables are declared in a GLSL shader.

The order of `resize`_args` and `resize_fn` was also swapped in the interest of having the function pointer be the last argument. It will also make more sense in a following diff where a `DynamicDispatchNode` class is introduced, which will allow selecting a different compute shader depending on input sizes.

As a small additional change, I also asked the agent to

---

Go through all the files under `xplat/executorch/backends/vulkan/runtime/graph/ops/impl`

Change `vkapi::MemoryAccessType::WRITE` to `vkapi::kWrite` and `vkapi::MemoryAccessType::READ` to `vkapi::kRead` for each file.

---

Differential Revision: [D74203482](https://our.internmc.facebook.com/intern/diff/D74203482/)

[ghstack-poisoned]
SS-JIA added a commit that referenced this pull request May 5, 2025
…er layout spec

## Context

As title. Note that this PR was written mainly with a meta internal coding agent. This PR re-orders the arguments to `DispatchNode` to be more intuitive.

I asked the agent:

---

I want to change the constructor of the class

```
  explicit DispatchNode(
      ComputeGraph& graph,
      const vkapi::ShaderInfo& shader,
      const utils::uvec3& global_workgroup_size,
      const utils::uvec3& local_workgroup_size,
      const std::vector<ArgGroup>& args,
      const vkapi::ParamsBindList& params,
      const vkapi::SpecVarList& spec_vars = {},
      const ResizeFunction& resize_fn = nullptr,
      const std::vector<ValueRef>& resize_args = {},
      const std::vector<PushConstantDataInfo>& push_constants = {});
```

to instead be

```
  explicit DispatchNode(
      ComputeGraph& graph,
      const vkapi::ShaderInfo& shader,
      const utils::uvec3& global_workgroup_size,
      const utils::uvec3& local_workgroup_size,
      const std::vector<ArgGroup>& args,
      const vkapi::ParamsBindList& params,,
      const std::vector<PushConstantDataInfo>& push_constants = {},
      const vkapi::SpecVarList& spec_vars = {},
      const std::vector<ValueRef>& resize_args = {},
      const ResizeFunction& resize_fn = nullptr);
```

Can you make this change and update the callsites as well?

---

The motivation is to have the arguments match the order in which parameter UBOs, push constant blocks, and specialization variables are declared in a GLSL shader.

The order of `resize`_args` and `resize_fn` was also swapped in the interest of having the function pointer be the last argument. It will also make more sense in a following diff where a `DynamicDispatchNode` class is introduced, which will allow selecting a different compute shader depending on input sizes.

As a small additional change, I also asked the agent to

---

Go through all the files under `xplat/executorch/backends/vulkan/runtime/graph/ops/impl`

Change `vkapi::MemoryAccessType::WRITE` to `vkapi::kWrite` and `vkapi::MemoryAccessType::READ` to `vkapi::kRead` for each file.

---

Differential Revision: [D74203482](https://our.internmc.facebook.com/intern/diff/D74203482/)

ghstack-source-id: 282122344
Pull Request resolved: #10693
@pytorch-bot
Copy link

pytorch-bot bot commented May 5, 2025

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 1 New Failure

As of commit 14af33e with merge base 578358b (image):

NEW FAILURE - The following job has failed:

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

@facebook-github-bot facebook-github-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 5, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D74203482

@github-actions
Copy link

github-actions bot commented May 5, 2025

This PR needs a release notes: label

If your changes are user facing and intended to be a part of release notes, please use a label starting with release notes:.

If not, please add the topic: not user facing label.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "topic: not user facing"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@facebook-github-bot facebook-github-bot merged commit bd43ce8 into gh/SS-JIA/224/base May 5, 2025
85 of 89 checks passed
@facebook-github-bot facebook-github-bot deleted the gh/SS-JIA/224/head branch May 5, 2025 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants