You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The to_host() operation fails on the Vulkan backend—both in the output when running code compiled via the compiler and with manually allocated arrays. It fails due to a memory alignment error. ValueError: could not import host allocation: D:\a\iree\iree\c\runtime\src\iree\hal\drivers\vulkan\allocator.c:1985: INVALID_ARGUMENT; host allocation import pointer does not satisfy Vulkan minImportedHostPointerAlignment 4096
Steps to reproduce your issue
Reproduction code, for manualy created array is
`import iree.runtime
Thank you for submitting an issue to IREE! It looks like it's your first one.
The volume of issues is huge, and triage times may vary. If you need quicker assistance on the issue, consider posting it on IREE Discord and providing short context there.
Feel free to identify the most frequent contributors to the corresponding part of the codebase via Git history/CODEOWNERS and (gently!) tag them below.
IREE is a Linux Foundation project. All participants are expected to follow the LF Projects Code of Conduct.
Please note that all contributions to IREE, including GitHub issues, must follow our IREE AI Tool Use Policy. This means:
Issue reporters must fully understand the primary issue and the impact of the problem.
For bug reports, specifics of the use-case, workflow and/or crash scenario usually suffice.
For improvement suggestions, this usually implies deeper understanding of suboptimal code, IR design choices, assumed performance tradeoffs, etc.
Contributors must write the summary of the issue themselves, so that the exact impact and scenario is clear to other participants.
Issue authors are expected to review and understand all LLM/AI-assisted segments of the report, if any. E.g.: CLI commands and IR reproducers, model/framework details, lowering pipeline details, assumptions about problematic behaviors of IREE components.
Substantial use of LLM/generative AI tools must be disclaimed in the header or footer of the issue description.
Before the issue can be triaged, we kindly ask you to reply to this message and confirm that you understand and accept the proposed policy. As required, please adjust your initial issue description.
If you have any questions, feel free to leave a comment here, or ask away on IREE Discord.
Hello, I have read the contributor guidelines and agree to them. I wrote the reproduction code myself. I used a translator for some parts of the problem description, as English is not my native language.
@Honza-Hroch slightly awkward error. The device buffer you allocated is not host_visible, so calling to_host implicitly falls back to copy, which in turn allocates a host-buffer that doesn't adhere to alignment requirements that Vulkan would need to execute the copy. I'm not sure what exactly you are attempting to do, but the obvious fix would be to make the vulkan allocation host_visible / or to create a staging buffer that is on the host, to copy data into a device_local non-host-visible buffer.
@devtbi Thank you for your answer!
I try to explain what I did. The complete traceback is
Traceback (most recent call last):
File "C:\Users\honza\PycharmProjects\vulkan_torch\minimal_reproduction.py", line 9, in <module>
array.to_host()
~~~~~~~~~~~~~^^
File "C:\Users\honza\PycharmProjects\vulkan_torch\.venv\Lib\site-packages\iree\runtime\array_interop.py", line 126, in to_host
return self._transfer_to_host(False)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
File "C:\Users\honza\PycharmProjects\vulkan_torch\.venv\Lib\site-packages\iree\runtime\array_interop.py", line 151, in _transfer_to_host
return self._copy_to_host()
~~~~~~~~~~~~~~~~~~^^
File "C:\Users\honza\PycharmProjects\vulkan_torch\.venv\Lib\site-packages\iree\runtime\array_interop.py", line 197, in _copy_to_host
host_buf = alloc.import_host_allocation(
result,
memory_type=mem_type,
allowed_usage=import_usage,
)
ValueError: could not import host allocation: D:\a\iree\iree\c\runtime\src\iree\hal\drivers\vulkan\allocator.c:1985: INVALID_ARGUMENT; host allocation import pointer does not satisfy Vulkan minImportedHostPointerAlignment 4096
Method _copy_to_host has two ways. The
first way uses import_host_allocation, and which currently doesn´t work with Vulkan. The second one uses allocate_buffer and this approach works. My question is whether Vulkan should always use the second way, or if the first way should be fixed.
Here is what I have managed to find out so far:
The _copy_to_host() method allocates a buffer using np.empty, which does not guarantee any specific alignment.
It appears that the IREE runtime API lacks a mechanism to retrieve the required alignment for the current backend. A function designed to return the requirements for an external buffer—ensuring it can be imported—was proposed in a TODO comment within runtime/src/iree/hal/allocator.h, but it seems it was never implemented. Implementing it, however, would entail an API extension that all backends would be required to support.
Activity
github-actions commentedon Nov 15, 2026
Hello @Honza-Hroch 👋
Thank you for submitting an issue to IREE! It looks like it's your first one.
The volume of issues is huge, and triage times may vary. If you need quicker assistance on the issue, consider posting it on IREE Discord and providing short context there.
Feel free to identify the most frequent contributors to the corresponding part of the codebase via Git history/CODEOWNERS and (gently!) tag them below.
Action required: acknowledge IREE project policies
IREE is a Linux Foundation project. All participants are expected to follow the LF Projects Code of Conduct.
Please note that all contributions to IREE, including GitHub issues, must follow our IREE AI Tool Use Policy. This means:
For bug reports, specifics of the use-case, workflow and/or crash scenario usually suffice.
For improvement suggestions, this usually implies deeper understanding of suboptimal code, IR design choices, assumed performance tradeoffs, etc.
Before the issue can be triaged, we kindly ask you to reply to this message and confirm that you understand and accept the proposed policy. As required, please adjust your initial issue description.
If you have any questions, feel free to leave a comment here, or ask away on IREE Discord.
Thank you,
The IREE Community
Honza-Hroch commentedon Nov 15, 2026
Hello, I have read the contributor guidelines and agree to them. I wrote the reproduction code myself. I used a translator for some parts of the problem description, as English is not my native language.
devtbi commentedon Nov 16, 2026
@Honza-Hroch slightly awkward error. The device buffer you allocated is not host_visible, so calling to_host implicitly falls back to copy, which in turn allocates a host-buffer that doesn't adhere to alignment requirements that Vulkan would need to execute the copy. I'm not sure what exactly you are attempting to do, but the obvious fix would be to make the vulkan allocation host_visible / or to create a staging buffer that is on the host, to copy data into a device_local non-host-visible buffer.
Honza-Hroch commentedon Nov 16, 2026
@devtbi Thank you for your answer!
I try to explain what I did. The complete traceback is
Method _copy_to_host has two ways. The
first way uses import_host_allocation, and which currently doesn´t work with Vulkan. The second one uses allocate_buffer and this approach works. My question is whether Vulkan should always use the second way, or if the first way should be fixed.
devtbi commentedon Nov 17, 2026
should be fixed, but that might be non-trivial
Honza-Hroch commentedon Nov 20, 2026
Here is what I have managed to find out so far:
The
_copy_to_host()method allocates a buffer usingnp.empty, which does not guarantee any specific alignment.It appears that the IREE runtime API lacks a mechanism to retrieve the required alignment for the current backend. A function designed to return the requirements for an external buffer—ensuring it can be imported—was proposed in a TODO comment within
runtime/src/iree/hal/allocator.h, but it seems it was never implemented. Implementing it, however, would entail an API extension that all backends would be required to support.