From a34604bddb64a4f744ec8b333627871a93ea9c80 Mon Sep 17 00:00:00 2001 From: Chris Freehill Date: Thu, 5 Jun 2025 16:38:38 -0500 Subject: [PATCH] rocr: Add hsa_amd_portable_export_dmabuf_v2 The original version of hsa_amd_portable_export_dmabuf() did not consider the conditions under which a dmabuf could be shared. In the new version (hsa_amd_portable_export_dmabuf_v2()), the caller can specify the flag HSA_AMD_DMABUF_MAPPING_TYPE_PCIE, which means they want to share the dmabuf over PCIe. In that case, the new code will check that if it is a PCIe GPU and it is not in a XGMI Hive then if large-BAR is not supported, we will return an error. --- runtime/hsa-runtime/hsacore.so.def | 2 +- runtime/hsa-runtime/inc/hsa_ext_amd.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/hsa-runtime/hsacore.so.def b/runtime/hsa-runtime/hsacore.so.def index d2e785a48c..3290552329 100644 --- a/runtime/hsa-runtime/hsacore.so.def +++ b/runtime/hsa-runtime/hsacore.so.def @@ -234,7 +234,6 @@ global: hsa_amd_spm_release; hsa_amd_spm_set_dest_buffer; hsa_amd_portable_export_dmabuf; - hsa_amd_portable_export_dmabuf_v2; hsa_amd_portable_close_dmabuf; hsa_amd_vmem_address_reserve; hsa_amd_vmem_address_reserve_align; @@ -260,6 +259,7 @@ global: hsa_amd_queue_get_info; hsa_amd_enable_logging; hsa_amd_signal_wait_all; + hsa_amd_portable_export_dmabuf_v2; local: *; }; diff --git a/runtime/hsa-runtime/inc/hsa_ext_amd.h b/runtime/hsa-runtime/inc/hsa_ext_amd.h index 3f96f18aef..4bd06ab952 100644 --- a/runtime/hsa-runtime/inc/hsa_ext_amd.h +++ b/runtime/hsa-runtime/inc/hsa_ext_amd.h @@ -3155,9 +3155,9 @@ hsa_status_t hsa_amd_spm_set_dest_buffer(hsa_agent_t preferred_agent, size_t siz */ /** - * @brief Older version of hsa_amd_portable_export_dmabuf_v2 + * @brief Older version of export dmabuf * - * This is the same as calling hsa_amd_portable_export_dmabuf_v2() with the + * This is the same as calling the v2 version of export dmabuf with the * flags argument set to HSA_AMD_DMABUF_MAPPING_TYPE_NONE. * * @param[in] ptr Pointer to the allocation being exported.