Skip to content

Conversation

@SS-JIA
Copy link
Contributor

@SS-JIA SS-JIA commented Jan 9, 2025

Stack from ghstack (oldest at bottom):

Context

Now that we are using GLSL/SPIR-V extensions more heavily in our shaders, there is a risk that a particular shader uses an extension that is not supported by the physical device.

It is tedious to manually check that all the extensions required by a shader is supported by the device; it would be much more convenient for developers if there was an automated way to perform this check. This diff provides a solution for this.

Materially, this has manifested into an issue with our internal CI tests that run on Android emulator (which uses swiftshader under the hood). If the emulator tries to compile a shader that requires the shaderInt16 feature, then the emulator will crash.

Solution

  1. Update ShaderInfo to have fields indicating whether certain extensions that require device support is required.
  2. Update the gen_vulkan_spv.py shader compilation script to parse the GLSL code and log whether aforemention extensions are needed in the generated ShaderInfo.
  3. Introduce a new exception class, ShaderNotSupportedError.
  4. Before dispatching, check that all extensions required by the shader is supported by the device. If not, throw the new exception class.
  5. In the generated operator correctness tests, skip the test if ShaderNotSupportedError is thrown.

Differential Revision: D67992067

…uring dispatch

## Context

Now that we are using GLSL/SPIR-V extensions more heavily in our shaders, there is a risk that a particular shader uses an extension that is not supported by the physical device.

It is tedious to manually check that all the extensions required by a shader is supported by the device; it would be much more convenient for developers if there was an automated way to perform this check. This diff provides a solution for this.

Materially, this has manifested into an issue with our internal CI tests that run on Android emulator (which uses swiftshader under the hood). If the emulator tries to compile a shader that requires the `shaderInt16` feature, then the emulator will crash.

## Solution

1. Update `ShaderInfo` to have fields indicating whether certain extensions that require device support is required.
2. Update the `gen_vulkan_spv.py` shader compilation script to parse the GLSL code and log whether aforemention extensions are needed in the generated `ShaderInfo`.
3. Introduce a new exception class, `ShaderNotSupportedError`.
4. Before dispatching, check that all extensions required by the shader is supported by the device. If not, throw the new exception class.
4. In the generated operator correctness tests, skip the test if `ShaderNotSupportedError` is thrown.

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

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Jan 9, 2025

🔗 Helpful Links

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

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:

✅ No Failures

As of commit a29b5c7 with merge base e1c0bcf (image):
💚 Looks good so far! There are no failures yet. 💚

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

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

@facebook-github-bot facebook-github-bot merged commit afff37c into gh/SS-JIA/162/base Jan 10, 2025
45 of 48 checks passed
@facebook-github-bot facebook-github-bot deleted the gh/SS-JIA/162/head branch January 10, 2025 18:01
JacobSzwejbka pushed a commit that referenced this pull request Jan 10, 2025
…uring dispatch (#7592)

## Context

Now that we are using GLSL/SPIR-V extensions more heavily in our shaders, there is a risk that a particular shader uses an extension that is not supported by the physical device.

It is tedious to manually check that all the extensions required by a shader is supported by the device; it would be much more convenient for developers if there was an automated way to perform this check. This diff provides a solution for this.

Materially, this has manifested into an issue with our internal CI tests that run on Android emulator (which uses swiftshader under the hood). If the emulator tries to compile a shader that requires the `shaderInt16` feature, then the emulator will crash.

## Solution

1. Update `ShaderInfo` to have fields indicating whether certain extensions that require device support is required.
2. Update the `gen_vulkan_spv.py` shader compilation script to parse the GLSL code and log whether aforemention extensions are needed in the generated `ShaderInfo`.
3. Introduce a new exception class, `ShaderNotSupportedError`.
4. Before dispatching, check that all extensions required by the shader is supported by the device. If not, throw the new exception class.
4. In the generated operator correctness tests, skip the test if `ShaderNotSupportedError` is thrown.

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

ghstack-source-id: 260809479
Pull Request resolved: #7576

Co-authored-by: Stephen Jia <[email protected]>
SS-JIA added a commit that referenced this pull request Jan 10, 2025
## Context

Follow up from #7576. Apply two "fixes" that were missed in the first diff:

1. Check device capability for Prepacking nodes as well
2. Remove conditional skips during generated operator correctness tests; rely on the device capability check to determine if a skip is needed.

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

[ghstack-poisoned]
SS-JIA added a commit that referenced this pull request Jan 10, 2025
## Context

Follow up from #7576. Apply two "fixes" that were missed in the first diff:

1. Check device capability for Prepacking nodes as well
2. Remove conditional skips during generated operator correctness tests; rely on the device capability check to determine if a skip is needed.

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

ghstack-source-id: 260953918
Pull Request resolved: #7601
SS-JIA added a commit that referenced this pull request Jan 10, 2025
## Context

Follow up from #7576. Apply two "fixes" that were missed in the first diff:

1. Check device capability for Prepacking nodes as well
2. Remove conditional skips during generated operator correctness tests; rely on the device capability check to determine if a skip is needed.

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

[ghstack-poisoned]
SS-JIA added a commit that referenced this pull request Jan 10, 2025
Pull Request resolved: #7601

## Context

Follow up from #7576. Apply two "fixes" that were missed in the first diff:

1. Check device capability for Prepacking nodes as well
2. Remove conditional skips during generated operator correctness tests; rely on the device capability check to determine if a skip is needed.

Differential Revision: [D68035430](https://our.internmc.facebook.com/intern/diff/D68035430/)
ghstack-source-id: 260961960
lucylq pushed a commit that referenced this pull request Jan 13, 2025
* [ET-VK] Parse required extensions of shaders and check capabilities during dispatch

## Context

Now that we are using GLSL/SPIR-V extensions more heavily in our shaders, there is a risk that a particular shader uses an extension that is not supported by the physical device.

It is tedious to manually check that all the extensions required by a shader is supported by the device; it would be much more convenient for developers if there was an automated way to perform this check. This diff provides a solution for this.

Materially, this has manifested into an issue with our internal CI tests that run on Android emulator (which uses swiftshader under the hood). If the emulator tries to compile a shader that requires the `shaderInt16` feature, then the emulator will crash.

## Solution

1. Update `ShaderInfo` to have fields indicating whether certain extensions that require device support is required.
2. Update the `gen_vulkan_spv.py` shader compilation script to parse the GLSL code and log whether aforemention extensions are needed in the generated `ShaderInfo`.
3. Introduce a new exception class, `ShaderNotSupportedError`.
4. Before dispatching, check that all extensions required by the shader is supported by the device. If not, throw the new exception class.
4. In the generated operator correctness tests, skip the test if `ShaderNotSupportedError` is thrown.

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

ghstack-source-id: 260809479
Pull Request resolved: #7576

* [ET-VK][ez][buck] Simplify test buck file

## Context

The targets file for the op tests define a binary and test rule for each c++ file; instead of manually defining these rules each time, create a helper function to condense the code.

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

ghstack-source-id: 260809480
Pull Request resolved: #7577

---------

Co-authored-by: Stephen Jia <[email protected]>
YIWENX14 pushed a commit that referenced this pull request Jan 28, 2025
…uring dispatch (#7592)

## Context

Now that we are using GLSL/SPIR-V extensions more heavily in our shaders, there is a risk that a particular shader uses an extension that is not supported by the physical device.

It is tedious to manually check that all the extensions required by a shader is supported by the device; it would be much more convenient for developers if there was an automated way to perform this check. This diff provides a solution for this.

Materially, this has manifested into an issue with our internal CI tests that run on Android emulator (which uses swiftshader under the hood). If the emulator tries to compile a shader that requires the `shaderInt16` feature, then the emulator will crash.

## Solution

1. Update `ShaderInfo` to have fields indicating whether certain extensions that require device support is required.
2. Update the `gen_vulkan_spv.py` shader compilation script to parse the GLSL code and log whether aforemention extensions are needed in the generated `ShaderInfo`.
3. Introduce a new exception class, `ShaderNotSupportedError`.
4. Before dispatching, check that all extensions required by the shader is supported by the device. If not, throw the new exception class.
4. In the generated operator correctness tests, skip the test if `ShaderNotSupportedError` is thrown.

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

ghstack-source-id: 260809479
Pull Request resolved: #7576

Co-authored-by: Stephen Jia <[email protected]>
YIWENX14 pushed a commit that referenced this pull request Jan 28, 2025
* [ET-VK] Parse required extensions of shaders and check capabilities during dispatch

## Context

Now that we are using GLSL/SPIR-V extensions more heavily in our shaders, there is a risk that a particular shader uses an extension that is not supported by the physical device.

It is tedious to manually check that all the extensions required by a shader is supported by the device; it would be much more convenient for developers if there was an automated way to perform this check. This diff provides a solution for this.

Materially, this has manifested into an issue with our internal CI tests that run on Android emulator (which uses swiftshader under the hood). If the emulator tries to compile a shader that requires the `shaderInt16` feature, then the emulator will crash.

## Solution

1. Update `ShaderInfo` to have fields indicating whether certain extensions that require device support is required.
2. Update the `gen_vulkan_spv.py` shader compilation script to parse the GLSL code and log whether aforemention extensions are needed in the generated `ShaderInfo`.
3. Introduce a new exception class, `ShaderNotSupportedError`.
4. Before dispatching, check that all extensions required by the shader is supported by the device. If not, throw the new exception class.
4. In the generated operator correctness tests, skip the test if `ShaderNotSupportedError` is thrown.

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

ghstack-source-id: 260809479
Pull Request resolved: #7576

* [ET-VK][ez][buck] Simplify test buck file

## Context

The targets file for the op tests define a binary and test rule for each c++ file; instead of manually defining these rules each time, create a helper function to condense the code.

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

ghstack-source-id: 260809480
Pull Request resolved: #7577

---------

Co-authored-by: Stephen Jia <[email protected]>
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 topic: not user facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants