From 9952ea29bb5dd591f75b9220e0cf977756620f95 Mon Sep 17 00:00:00 2001 From: Stephen Jia Date: Thu, 7 Nov 2024 06:24:13 -0800 Subject: [PATCH 1/2] [ET-VK][ez] properly parse skip memory metadata pass As title. Currently, the compile option to skip memory metadata tagging is not being passed correctly to `vulkan_preprocess`. Differential Revision: [D65600049](https://our.internmc.facebook.com/intern/diff/D65600049/) [ghstack-poisoned] --- 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..cce26b82fb6 100644 --- a/backends/vulkan/partitioner/vulkan_partitioner.py +++ b/backends/vulkan/partitioner/vulkan_partitioner.py @@ -251,6 +251,10 @@ def parse_compile_options(compile_options: Dict[str, Any]) -> List[CompileSpec]: if isinstance(value, (VkStorageType, VkMemoryLayout)): 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( diff --git a/backends/vulkan/vulkan_preprocess.py b/backends/vulkan/vulkan_preprocess.py index f0a5fd67256..b64c843720b 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 From 69e96f20b9c8e84f0686a8cc5c304eedc9c468c8 Mon Sep 17 00:00:00 2001 From: Stephen Jia Date: Thu, 7 Nov 2024 11:42:40 -0800 Subject: [PATCH 2/2] Update on "[ET-VK][ez] properly parse skip memory metadata pass" As title. Currently, the compile option to skip memory metadata tagging is not being passed correctly to `vulkan_preprocess`. Differential Revision: [D65600049](https://our.internmc.facebook.com/intern/diff/D65600049/) [ghstack-poisoned] --- backends/vulkan/partitioner/vulkan_partitioner.py | 2 +- backends/vulkan/vulkan_preprocess.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backends/vulkan/partitioner/vulkan_partitioner.py b/backends/vulkan/partitioner/vulkan_partitioner.py index cce26b82fb6..7b2ad3fdfde 100644 --- a/backends/vulkan/partitioner/vulkan_partitioner.py +++ b/backends/vulkan/partitioner/vulkan_partitioner.py @@ -251,7 +251,7 @@ def parse_compile_options(compile_options: Dict[str, Any]) -> List[CompileSpec]: if isinstance(value, (VkStorageType, VkMemoryLayout)): 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)) diff --git a/backends/vulkan/vulkan_preprocess.py b/backends/vulkan/vulkan_preprocess.py index b64c843720b..c938f9ff424 100644 --- a/backends/vulkan/vulkan_preprocess.py +++ b/backends/vulkan/vulkan_preprocess.py @@ -98,7 +98,7 @@ 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")