forked from iree-org/iree
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reworking constant upload with a HAL file API. (iree-org#14665)
This changes the compiler-generated map/staging IR into file reads that are managed by the runtime HAL targets. In this initial version only one type of file is supported that wraps host memory and exposes it via the file API. For targets that don't natively support file streaming a utility for asynchronously streaming files using an iree_loop_t is available and all targets currently use that. In the future targets like CUDA/Metal/Direct3D12 can use cuFile/MTLIOCommandBuffer/DirectStorage to directly stream file contents from/to disk. Future changes will expand the iree_hal_file_t vtable with what can be reliably implemented or guarded with feature flags. When any form of asynchronous loop is implemented (such as a task-system fiber loop) we'll be able to perform overlapped copies to reduce total transfer latency by letting the CPU and GPU do their respective staging operations concurrently. Today only synchronous loops are used so it's fully serialized. Now that the compiler doesn't emit staging with iree_allocator_allocate_buffer's initial_data that can be removed in iree-org#14605 to remove the primary use of the existing buffer_transfer util. The remaining places using it can be switched to memory file streaming instead such as numpy IO and support much larger content. This is a breaking HAL change and all existing VMFBs will fail to load on newer runtimes. CPU and CUDA targets benefit from this as should all other backends though some may need to have zero-copy paths added - they'll at least benefit from streaming and bounded staging buffer sizes. Vulkan has been optimized a bit and the follow-on sparse bindings support improves it further. Vulkan dedicated GPU w/ 1GB model before this change (1024MB + 1024MB of staging, even when mmapped): ![image](https://github.com/openxla/iree/assets/75337/62b4b144-efe6-4116-8192-3f7bbfbbfaeb) Vulkan dedicated GPU w/ 1GB model now (1024MB + ~64MB of staging used as streamed from a memory mapped file): ![image](https://github.com/openxla/iree/assets/75337/4e44a186-9c11-4d83-951b-b6bc1ad6e3f2) Vulkan integrated GPU w/ 1GB model now (1024MB of host memory imported and used directly with no copies): ![image](https://github.com/openxla/iree/assets/75337/0d036ede-0aac-45be-b069-6bb8d6e06cb6) Progress on iree-org#14607.
- Loading branch information
Showing
104 changed files
with
4,057 additions
and
839 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.