MCPcopy Create free account
hub / github.com/pytorch/executorch / materialize_buffer

Function materialize_buffer

exir/memory_planning.py:754–766  ·  view source on GitHub ↗

r""" Assign concrete location in the buffer for each SharedObject.offset. Assuming all the passed in shared objects belong to the same memory buffer.

(
    shared_objects: List[SharedObject], input_total_size: int = 0
)

Source from the content-addressed store, hash-verified

752
753
754def materialize_buffer(
755 shared_objects: List[SharedObject], input_total_size: int = 0
756) -> int:
757 r"""
758 Assign concrete location in the buffer for each SharedObject.offset.
759
760 Assuming all the passed in shared objects belong to the same memory buffer.
761 """
762 total_size = input_total_size
763 for sobj in shared_objects:
764 sobj.offset = total_size
765 total_size += sobj.size
766 return total_size
767
768
769def _does_not_overlap(sobj: SharedObject, spec: TensorSpec) -> bool:

Callers 1

greedyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected