From 2c96fe38540c4e35e55728b15df1762d6e9c5aa7 Mon Sep 17 00:00:00 2001 From: Stephen Jia Date: Thu, 7 Nov 2024 11:42:40 -0800 Subject: [PATCH] [ET-VK][ez] properly parse skip memory metadata pass Pull Request resolved: https://github.com/pytorch/executorch/pull/6712 As title. Currently, the compile option to skip memory metadata tagging is not being passed correctly to `vulkan_preprocess`. ghstack-source-id: 252359943 @exported-using-ghexport Differential Revision: [D65600049](https://our.internmc.facebook.com/intern/diff/D65600049/) --- backends/vulkan/partitioner/vulkan_partitioner.py | 4 ++++ backends/vulkan/vulkan_preprocess.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/backends/vulkan/partitioner/vulkan_partitioner.py b/backends/vulkan/partitioner/vulkan_partitioner.py index f1fd47fb2b6..7b2ad3fdfde 100644 --- a/backends/vulkan/partitioner/vulkan_partitioner.py +++ b/backends/vulkan/partitioner/vulkan_partitioner.py @@ -252,6 +252,10 @@ def parse_compile_options(compile_options: Dict[str, Any]) -> List[CompileSpec]: value_bytes = int(value).to_bytes(4, byteorder="little") compile_specs.append(CompileSpec(key, value_bytes)) + if isinstance(value, bool): + value_bytes = value.to_bytes(1, byteorder="little") + compile_specs.append(CompileSpec(key, value_bytes)) + if key == "texture_limits": compile_specs.append( CompileSpec( diff --git a/backends/vulkan/vulkan_preprocess.py b/backends/vulkan/vulkan_preprocess.py index f0a5fd67256..c938f9ff424 100644 --- a/backends/vulkan/vulkan_preprocess.py +++ b/backends/vulkan/vulkan_preprocess.py @@ -98,6 +98,10 @@ def parse_compile_spec(compile_specs: List[CompileSpec]) -> Dict[str, Any]: ) if spec.key in {"texture_limits_x", "texture_limits_y", "texture_limits_z"}: options[spec.key] = int.from_bytes(spec.value, byteorder="little") + + if spec.key == "skip_tag_memory_metadata": + options[spec.key] = bool.from_bytes(spec.value, byteorder="little") + # Unhandled options are ignored return options