Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/17382
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 New Failures, 1 Unrelated FailureAs of commit 0534658 with merge base eb888f8 ( 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. |
Adds missing float to int32 conversion support in the Vulkan backend's view_convert_buffer shader. This fixes runtime errors when models require float to int32 dtype conversions. Fixes ShaderInfo not found error for 'view_convert_buffer_float_int32'
7ded14f to
0534658
Compare
There was a problem hiding this comment.
Pull request overview
Adds the missing float -> int32 shader variant for the Vulkan backend’s view_convert_buffer op so models requiring that dtype conversion no longer fail at runtime due to an unregistered shader name.
Changes:
- Add
float,int32to the generated shader combination list forview_convert_buffer. - Remove an editable-install warning block from the “building from source” docs.
Reviewed changes
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| docs/source/using-executorch-building-from-source.md | Removes an editable-install warning/workaround block from the build-from-source guide. |
| backends/vulkan/runtime/graph/ops/glsl/view_convert_buffer.yaml | Adds the float -> int32 combo so view_convert_buffer_float_int32 gets generated/registered. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - parameter_values: [uint8, float] | ||
| - parameter_values: [uint8, half] | ||
| - parameter_values: [uint8, int32] | ||
| - parameter_values: [float, int32] |
There was a problem hiding this comment.
Adding the float→int32 combo makes view_convert_buffer perform a direct GLSL cast from float to int (OUT_T(t_inp[...]) where OUT_T becomes int). In GLSL, float-to-int conversion is undefined/unspecified for NaNs and for values outside the representable int32 range, which can lead to non-deterministic results. Consider updating the shader logic for this combo to explicitly define behavior (e.g., clamp to int32 min/max before casting and decide how to handle NaNs), so the new variant is robust and matches the expected runtime semantics.
| - parameter_values: [float, int32] |
| - parameter_values: [uint8, float] | ||
| - parameter_values: [uint8, half] | ||
| - parameter_values: [uint8, int32] | ||
| - parameter_values: [float, int32] |
There was a problem hiding this comment.
This change fixes a runtime crash path (missing shader variant), but there doesn’t appear to be a Vulkan test that exercises float→int32 view/copy conversion. Adding a small unit/integration test that runs a minimal graph/model requiring float→int32 conversion and validates output (and/or that the shader is present in the registry) would help prevent regressions.
|
@pytorchbot label "release notes: vulkan" |
Summary
Adds missing float to int32 conversion support in the Vulkan backend's view_convert_buffer shader.
Problem
When exporting models that require float-to-int32 dtype conversion to the Vulkan backend, execution fails at runtime with:
Exception raised from get_shader_info at /pytorch/executorch/backends/vulkan/runtime/api/ShaderRegistry.cpp:54:
(it != listings_.end()) is false! Could not find ShaderInfo with name view_convert_buffer_float_int32
This occurs because the view_convert_buffer shader only supports conversions FROM int32/uint8 TO float/half, but not the reverse direction.
Solution
Added float → int32 conversion variant to the shader generation configuration in
view_convert_buffer.yaml
.
Changed file:
backends/vulkan/runtime/graph/ops/glsl/view_convert_buffer.yaml
Change:
yaml
combos:
Testing
Unable to test on Windows due to build environment constraints (requires CMake + MSVC). The change follows the existing pattern for other dtype conversion combinations in the same file.
Test case that would trigger this:
Models with operations requiring float→int32 conversion (e.g., certain quantization or indexing operations)
Export to Vulkan backend using VulkanPartitioner
Additional Context
This issue was encountered while exporting a depth estimation model (PanDA) to the Vulkan backend for Android deployment. The model worked with XNNPACK but failed with Vulkan due to this missing shader variant.
cc @SS-JIA @manuelcandales @digantdesai @cbilgin