[ET-VK] Add per-operator dtype constraints to op_registry#17336
[ET-VK] Add per-operator dtype constraints to op_registry#17336meta-codesync[bot] merged 1 commit intogh/SS-JIA/414/basefrom
Conversation
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]
🔗 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 FailureAs of commit cc104d9 with merge base ba89c69 ( 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. |
This PR needs a
|
756fe3b
into
gh/SS-JIA/414/base
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
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
Stack from ghstack (oldest at bottom):
Previously, dtype validation for Vulkan operators was scattered across
individual node-checking functions (e.g.,
check_to_copy_nodehad inlinefloat16/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 aDtypeSetListwrapper class withbroadcasting semantics. The
check_node_dtypes()function validatestensor inputs/outputs against allowed dtype sets and returns descriptive
error messages.
op_registry.py: ExtendsOpFeatureswithinputs_dtypesandoutputs_dtypesparameters. Each operator registration now explicitlydeclares its supported dtypes. Simplified node-checking functions like
check_to_copy_nodesince dtype logic is now handled declaratively.vulkan_partitioner.py: Callsfeatures.check_dtypes()early invalidation, 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