Skip to content

Commit 61517ae

Browse files
committed
[ET-VK] Add util to extract VkGraph from Program
Pull Request resolved: #8199 Missing piece to facilitate VkGraph debugging. Differential Revision: [D69151587](https://our.internmc.facebook.com/intern/diff/D69151587/) ghstack-source-id: 264726843
1 parent a3455d9 commit 61517ae

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

backends/vulkan/serialization/vulkan_graph_serialize.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ def flatbuffer_to_vk_graph(flatbuffers: bytes) -> VkGraph:
6161
return _json_to_dataclass(json.load(output_file), VkGraph)
6262

6363

64+
def extract_vk_flatbuffer(data: bytes) -> bytes:
65+
h: VulkanDelegateHeader = VulkanDelegateHeader.from_bytes(
66+
data[: VulkanDelegateHeader.EXPECTED_LENGTH]
67+
)
68+
start = h.flatbuffer_offset
69+
end = h.flatbuffer_offset + h.flatbuffer_size
70+
return data[start:end]
71+
72+
6473
@dataclass
6574
class VulkanDelegateHeader:
6675
# Defines the byte region that each component of the header corresponds to

0 commit comments

Comments
 (0)