Skip to content

Commit

Permalink
[ET-VK] Add util to extract VkGraph from Program
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jorgep31415 committed Feb 5, 2025
1 parent a3455d9 commit 61517ae
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions backends/vulkan/serialization/vulkan_graph_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ def flatbuffer_to_vk_graph(flatbuffers: bytes) -> VkGraph:
return _json_to_dataclass(json.load(output_file), VkGraph)


def extract_vk_flatbuffer(data: bytes) -> bytes:
h: VulkanDelegateHeader = VulkanDelegateHeader.from_bytes(
data[: VulkanDelegateHeader.EXPECTED_LENGTH]
)
start = h.flatbuffer_offset
end = h.flatbuffer_offset + h.flatbuffer_size
return data[start:end]


@dataclass
class VulkanDelegateHeader:
# Defines the byte region that each component of the header corresponds to
Expand Down

0 comments on commit 61517ae

Please sign in to comment.