mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-14 19:17:32 +08:00
mm: use aimdo to do transfer from disk to pin
Aimdo implements a faster threaded loader.
This commit is contained in:
parent
157965a1c9
commit
b66b642068
@ -48,6 +48,12 @@ def read_tensor_file_slice_into(tensor, destination):
|
|||||||
if info.size == 0:
|
if info.size == 0:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
hostbuf = getattr(destination.untyped_storage(), "_comfy_hostbuf", None)
|
||||||
|
if hostbuf is not None:
|
||||||
|
hostbuf.read_file_slice(file_obj, info.offset, info.size,
|
||||||
|
offset=destination.data_ptr() - hostbuf.get_raw_address())
|
||||||
|
return True
|
||||||
|
|
||||||
buf_type = ctypes.c_ubyte * info.size
|
buf_type = ctypes.c_ubyte * info.size
|
||||||
view = memoryview(buf_type.from_address(destination.data_ptr()))
|
view = memoryview(buf_type.from_address(destination.data_ptr()))
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user