-
Notifications
You must be signed in to change notification settings - Fork 623
[ET-VK] Fix caching mechanism to account for included files #12441
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
## Changes * Update the `gen_vulkan_spv.py` script to account for changes to included files when decided whether to perform a re-compilation ## Additional Changes Also applied some misc fixes: * Allow the Python preprocessor to handle unescaped `\` used to extend macros to multiple lines. Fixed this by replacing these with `\` before running the preprocessor. * Fixed an issue where build would unexpectedly pass when trying to recompile a failing build multiple time. This would cause the caching mechanism to use a old cached build artifact since no changes were detected. Fixed this by removing any existing cached artifacts on unsuccessful build. ## Context The `gen_vulkan_spv.py` script which handles GLSL shader codegen and GLSL -> SPIR-V compilation for the ExecuTorch Vulkan backend has a caching mechanism to only recompile modified files for the purpose of developer efficiency. However, this mechanism currently doesn't consider whether included files have been changed. Therefore, if a include file is modified without first modifying the source file which uses it, the changes to the include file will not be captured. Differential Revision: [D78275585](https://our.internmc.facebook.com/intern/diff/D78275585/) [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/12441
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New FailureAs of commit bb3c625 with merge base 1540659 ( NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This pull request was exported from Phabricator. Differential Revision: D78275585 |
This PR needs a
|
b63cb72
into
gh/SS-JIA/256/base
@@ -545,6 +545,9 @@ def escape(line: str) -> str: | |||
def preprocess( | |||
input_text: str, variables: Dict[str, Any], input_path: str = "codegen" | |||
) -> str: | |||
# Workaround to handle source files using \ to extend mecros to a new line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Workaround to handle source files using \ to extend mecros to a new line | |
# Workaround to handle source files using \ to extend macros to a new line |
@@ -654,8 +657,8 @@ def addSrcAndYamlFiles(self, src_dir_paths: List[str]) -> None: | |||
for src_path in src_dir_paths: | |||
# Collect glsl source files | |||
src_files_list = glob.glob( | |||
os.path.join(src_path, "**", "*.glsl*"), recursive=True | |||
) | |||
os.path.join(src_path, "**", "*.[gh]lsl*"), recursive=True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the comment to include hlsl
. Not sure if you intended to put this change in this PR.
cache_dir, os.path.basename(src_file_fullpath) + ".t" | ||
) | ||
shutil.copyfile(src_file_fullpath, cached_src_file) | ||
print(spv_to_glsl_map) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print(spv_to_glsl_map) |
Stack from ghstack (oldest at bottom):
run_prepack()
toprepack()
and replaceencode_prepack()
+prepack()
with justprepack()
#12443Changes
gen_vulkan_spv.py
script to account for changes to included files when decided whether to perform a re-compilationAdditional Changes
Also applied some misc fixes:
\
used to extend macros to multiple lines. Fixed this by replacing these with\
before running the preprocessor.Context
The
gen_vulkan_spv.py
script which handles GLSL shader codegen and GLSL -> SPIR-V compilation for the ExecuTorch Vulkan backend has a caching mechanism to only recompile modified files for the purpose of developer efficiency. However, this mechanism currently doesn't consider whether included files have been changed. Therefore, if a include file is modified without first modifying the source file which uses it, the changes to the include file will not be captured.Differential Revision: D78275585