Skip to content

[ET-VK] Add per-operator dtype constraints to op_registry#17336

Merged
meta-codesync[bot] merged 1 commit intogh/SS-JIA/414/basefrom
gh/SS-JIA/414/head
Feb 10, 2026
Merged

[ET-VK] Add per-operator dtype constraints to op_registry#17336
meta-codesync[bot] merged 1 commit intogh/SS-JIA/414/basefrom
gh/SS-JIA/414/head

Conversation

@SS-JIA
Copy link
Copy Markdown
Contributor

@SS-JIA SS-JIA commented Feb 10, 2026

Stack from ghstack (oldest at bottom):

Previously, dtype validation for Vulkan operators was scattered across
individual node-checking functions (e.g., check_to_copy_node had inline
float16/float32 checks). This made it difficult to see at a glance which
dtypes each operator supports.

This diff introduces a centralized dtype constraint system:

  • utils.py: Adds dtype set constants (FP_T, INT_T, FP_INT32_T,
    FP_INT32_BOOL_T, etc.) and a DtypeSetList wrapper class with
    broadcasting semantics. The check_node_dtypes() function validates
    tensor inputs/outputs against allowed dtype sets and returns descriptive
    error messages.

  • op_registry.py: Extends OpFeatures with inputs_dtypes and
    outputs_dtypes parameters. Each operator registration now explicitly
    declares its supported dtypes. Simplified node-checking functions like
    check_to_copy_node since dtype logic is now handled declaratively.

  • vulkan_partitioner.py: Calls features.check_dtypes() early in
    validation, failing fast with a clear skip reason if dtypes are invalid.

This approach improves maintainability by making dtype support explicit and
centralizing the validation logic.

Authored with assistance from Claude.

Differential Revision: D92740295

Previously, dtype validation for Vulkan operators was scattered across
individual node-checking functions (e.g., `check_to_copy_node` had inline
float16/float32 checks). This made it difficult to see at a glance which
dtypes each operator supports.

This diff introduces a centralized dtype constraint system:

- `utils.py`: Adds dtype set constants (`FP_T`, `INT_T`, `FP_INT32_T`,
  `FP_INT32_BOOL_T`, etc.) and a `DtypeSetList` wrapper class with
  broadcasting semantics. The `check_node_dtypes()` function validates
  tensor inputs/outputs against allowed dtype sets and returns descriptive
  error messages.

- `op_registry.py`: Extends `OpFeatures` with `inputs_dtypes` and
  `outputs_dtypes` parameters. Each operator registration now explicitly
  declares its supported dtypes. Simplified node-checking functions like
  `check_to_copy_node` since dtype logic is now handled declaratively.

- `vulkan_partitioner.py`: Calls `features.check_dtypes()` early in
  validation, failing fast with a clear skip reason if dtypes are invalid.

This approach improves maintainability by making dtype support explicit and
centralizing the validation logic.

Authored with assistance from Claude.

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

[ghstack-poisoned]
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Feb 10, 2026

🔗 Helpful Links

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

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

❌ 8 New Failures, 1 Unrelated Failure

As of commit cc104d9 with merge base ba89c69 (image):

NEW FAILURES - The following jobs have 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 Feb 10, 2026
@github-actions
Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

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

@meta-codesync meta-codesync Bot merged commit 756fe3b into gh/SS-JIA/414/base Feb 10, 2026
180 of 205 checks passed
@meta-codesync meta-codesync Bot deleted the gh/SS-JIA/414/head branch February 10, 2026 22:18
SS-JIA pushed a commit that referenced this pull request Feb 11, 2026
Previously, dtype validation for Vulkan operators was scattered across
individual node-checking functions (e.g., `check_to_copy_node` had inline
float16/float32 checks). This made it difficult to see at a glance which
dtypes each operator supports.

This diff introduces a centralized dtype constraint system:

- `utils.py`: Adds dtype set constants (`FP_T`, `INT_T`, `FP_INT32_T`,
  `FP_INT32_BOOL_T`, etc.) and a `DtypeSetList` wrapper class with
  broadcasting semantics. The `check_node_dtypes()` function validates
  tensor inputs/outputs against allowed dtype sets and returns descriptive
  error messages.

- `op_registry.py`: Extends `OpFeatures` with `inputs_dtypes` and
  `outputs_dtypes` parameters. Each operator registration now explicitly
  declares its supported dtypes. Simplified node-checking functions like
  `check_to_copy_node` since dtype logic is now handled declaratively.

- `vulkan_partitioner.py`: Calls `features.check_dtypes()` early in
  validation, failing fast with a clear skip reason if dtypes are invalid.

This approach improves maintainability by making dtype support explicit and
centralizing the validation logic.

Authored with assistance from Claude.

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

ghstack-source-id: 339885885
Pull Request resolved: #17336
SS-JIA pushed a commit that referenced this pull request Feb 11, 2026
Previously, dtype validation for Vulkan operators was scattered across
individual node-checking functions (e.g., `check_to_copy_node` had inline
float16/float32 checks). This made it difficult to see at a glance which
dtypes each operator supports.

This diff introduces a centralized dtype constraint system:

- `utils.py`: Adds dtype set constants (`FP_T`, `INT_T`, `FP_INT32_T`,
  `FP_INT32_BOOL_T`, etc.) and a `DtypeSetList` wrapper class with
  broadcasting semantics. The `check_node_dtypes()` function validates
  tensor inputs/outputs against allowed dtype sets and returns descriptive
  error messages.

- `op_registry.py`: Extends `OpFeatures` with `inputs_dtypes` and
  `outputs_dtypes` parameters. Each operator registration now explicitly
  declares its supported dtypes. Simplified node-checking functions like
  `check_to_copy_node` since dtype logic is now handled declaratively.

- `vulkan_partitioner.py`: Calls `features.check_dtypes()` early in
  validation, failing fast with a clear skip reason if dtypes are invalid.

This approach improves maintainability by making dtype support explicit and
centralizing the validation logic.

Authored with assistance from Claude.

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

ghstack-source-id: 339885885
Pull Request resolved: #17336
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 meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants