-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[Vulkan] Enable Codegen ShaderInfo Registry from GLSLT + Params YAML files (conv2d_pw) #91916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…files (conv2d_pw) @bypass-github-export-checks This diff allows for adding entries to the shader registry by specifying which op names and registry keys should map to a template codegen Shader in the codegen Shader's glslt and params yaml files. This can be done by - adding a REGISTER_FOR entry which maps to either a tuple of (op name, list of registry keys) or null to the YAML file, and - adding a ```REGISTER_FOR = $REGISTER_FOR``` line to the ShaderInfo comment in the glslt file Ex. YAML File: ``` conv2d_pw: parameter_names_with_default_values: ... REGISTER_FOR: - !!python/tuple ["conv2d_pw", ["catchall"]] parameter_values: - ... REGISTER_FOR: null ``` GLSLT File: ``` ... * REGISTER_FOR = $REGISTER_FOR ... ``` This diff also registers the conv2d_pw_2x2 Shader under ```'conv2d_pw → 'catchall'``` in the registry and uses ```VK_REGISTRY_KERNEL``` to retrieve the shader by look up in the registry The shader registry generated in spv.cpp now looks like ``` ShaderRegistry shader_registry = { {"conv2d", {{"catchall", "conv2d"}}}, {"conv2d_pw", {{"catchall", "conv2d_pw_2x2"}}}}; ``` and the generated conv2d_p2_KxK.glsl files look like: K=1 ``` ... /* * TILE_SIZE = (1, 1, 1) * WEIGHT_STORAGE = TEXTURE_2D * WEIGHT_STORAGE_LAYOUT = OC4,IC4,4ic,4oc * BIAS_STORAGE = TEXTURE_2D * REGISTER_FOR = None */ ... ``` K=2 ``` ... /* * TILE_SIZE = (2, 2, 1) * WEIGHT_STORAGE = TEXTURE_2D * WEIGHT_STORAGE_LAYOUT = OC4,IC4,4ic,4oc * BIAS_STORAGE = TEXTURE_2D * REGISTER_FOR = ('conv2d_pw', ['catchall']) */ ... ``` Differential Revision: [D42198560](https://our.internmc.facebook.com/intern/diff/D42198560/) [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/91916
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ❌ 2 FailuresAs of commit 32b7714: NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
…arams YAML files (conv2d_pw)" bypass-github-export-checks This diff allows for adding entries to the shader registry by specifying which op names and registry keys should map to a template codegen Shader in the codegen Shader's glslt and params yaml files. This can be done by - adding a REGISTER_FOR entry which maps to either a tuple of (op name, list of registry keys) or null to the YAML file, and - adding a ```REGISTER_FOR = $REGISTER_FOR``` line to the ShaderInfo comment in the glslt file Ex. YAML File: ``` conv2d_pw: parameter_names_with_default_values: ... REGISTER_FOR: - !!python/tuple ["conv2d_pw", ["catchall"]] parameter_values: - ... REGISTER_FOR: null ``` GLSLT File: ``` ... * REGISTER_FOR = $REGISTER_FOR ... ``` This diff also registers the conv2d_pw_2x2 Shader under ```'conv2d_pw → 'catchall'``` in the registry and uses ```VK_REGISTRY_KERNEL``` to retrieve the shader by look up in the registry The shader registry generated in spv.cpp now looks like ``` ShaderRegistry shader_registry = { {"conv2d", {{"catchall", "conv2d"}}}, {"conv2d_pw", {{"catchall", "conv2d_pw_2x2"}}}}; ``` and the generated conv2d_p2_KxK.glsl files look like: K=1 ``` ... /* * TILE_SIZE = (1, 1, 1) * WEIGHT_STORAGE = TEXTURE_2D * WEIGHT_STORAGE_LAYOUT = OC4,IC4,4ic,4oc * BIAS_STORAGE = TEXTURE_2D * REGISTER_FOR = None */ ... ``` K=2 ``` ... /* * TILE_SIZE = (2, 2, 1) * WEIGHT_STORAGE = TEXTURE_2D * WEIGHT_STORAGE_LAYOUT = OC4,IC4,4ic,4oc * BIAS_STORAGE = TEXTURE_2D * REGISTER_FOR = ('conv2d_pw', ['catchall']) */ ... ``` Differential Revision: [D42198560](https://our.internmc.facebook.com/intern/diff/D42198560/) [ghstack-poisoned]
…arams YAML files (conv2d_pw)" bypass-github-export-checks This diff allows for adding entries to the shader registry by specifying which op names and registry keys should map to a template codegen Shader in the codegen Shader's glslt and params yaml files. This can be done by - adding a REGISTER_FOR entry which maps to either a tuple of (op name, list of registry keys) or null to the YAML file, and - adding a ```REGISTER_FOR = $REGISTER_FOR``` line to the ShaderInfo comment in the glslt file Ex. YAML File: ``` conv2d_pw: parameter_names_with_default_values: ... REGISTER_FOR: - !!python/tuple ["conv2d_pw", ["catchall"]] parameter_values: - ... REGISTER_FOR: null ``` GLSLT File: ``` ... * REGISTER_FOR = $REGISTER_FOR ... ``` This diff also registers the conv2d_pw_2x2 Shader under ```'conv2d_pw → 'catchall'``` in the registry and uses ```VK_REGISTRY_KERNEL``` to retrieve the shader by look up in the registry The shader registry generated in spv.cpp now looks like ``` ShaderRegistry shader_registry = { {"conv2d", {{"catchall", "conv2d"}}}, {"conv2d_pw", {{"catchall", "conv2d_pw_2x2"}}}}; ``` and the generated conv2d_p2_KxK.glsl files look like: K=1 ``` ... /* * TILE_SIZE = (1, 1, 1) * WEIGHT_STORAGE = TEXTURE_2D * WEIGHT_STORAGE_LAYOUT = OC4,IC4,4ic,4oc * BIAS_STORAGE = TEXTURE_2D * REGISTER_FOR = None */ ... ``` K=2 ``` ... /* * TILE_SIZE = (2, 2, 1) * WEIGHT_STORAGE = TEXTURE_2D * WEIGHT_STORAGE_LAYOUT = OC4,IC4,4ic,4oc * BIAS_STORAGE = TEXTURE_2D * REGISTER_FOR = ('conv2d_pw', ['catchall']) */ ... ``` Differential Revision: [D42198560](https://our.internmc.facebook.com/intern/diff/D42198560/) [ghstack-poisoned]
@pytorchbot merge -f 'Landed internally' (Initiating merge automatically since Phabricator Diff has merged, using force because this PR might not pass merge_rules.json but landed internally) |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Stack from ghstack (oldest at bottom):
@bypass-github-export-checks
This diff allows for adding entries to the shader registry by specifying which op names and registry keys should map to a template codegen Shader in the codegen Shader's glslt and params yaml files.
This can be done by
REGISTER_FOR = $REGISTER_FOR
line to the ShaderInfo comment in the glslt fileEx.
YAML File:
GLSLT File:
This diff also registers the conv2d_pw_2x2 Shader under
'conv2d_pw → 'catchall'
in the registry and usesVK_REGISTRY_KERNEL
to retrieve the shader by look up in the registryThe shader registry generated in spv.cpp now looks like
and the generated conv2d_p2_KxK.glsl files look like:
K=1
K=2
Differential Revision: D42198560