Skip to content

Commit

Permalink
Merge pull request #1829 from callumfare/callum/bindless_workaround
Browse files Browse the repository at this point in the history
Treat bindless images handle types as native handles
  • Loading branch information
kbenzie authored Jul 11, 2024
2 parents 342bdff + 199287b commit 642e343
Show file tree
Hide file tree
Showing 20 changed files with 390 additions and 481 deletions.
141 changes: 68 additions & 73 deletions include/ur_api.h

Large diffs are not rendered by default.

27 changes: 14 additions & 13 deletions include/ur_ddi.h
Original file line number Diff line number Diff line change
Expand Up @@ -1531,14 +1531,14 @@ typedef ur_result_t(UR_APICALL *ur_pfnGetEnqueueExpProcAddrTable_t)(
typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesUnsampledImageHandleDestroyExp_t)(
ur_context_handle_t,
ur_device_handle_t,
ur_exp_image_handle_t);
ur_exp_image_native_handle_t);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urBindlessImagesSampledImageHandleDestroyExp
typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesSampledImageHandleDestroyExp_t)(
ur_context_handle_t,
ur_device_handle_t,
ur_exp_image_handle_t);
ur_exp_image_native_handle_t);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urBindlessImagesImageAllocateExp
Expand All @@ -1547,35 +1547,35 @@ typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesImageAllocateExp_t)(
ur_device_handle_t,
const ur_image_format_t *,
const ur_image_desc_t *,
ur_exp_image_mem_handle_t *);
ur_exp_image_mem_native_handle_t *);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urBindlessImagesImageFreeExp
typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesImageFreeExp_t)(
ur_context_handle_t,
ur_device_handle_t,
ur_exp_image_mem_handle_t);
ur_exp_image_mem_native_handle_t);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urBindlessImagesUnsampledImageCreateExp
typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesUnsampledImageCreateExp_t)(
ur_context_handle_t,
ur_device_handle_t,
ur_exp_image_mem_handle_t,
ur_exp_image_mem_native_handle_t,
const ur_image_format_t *,
const ur_image_desc_t *,
ur_exp_image_handle_t *);
ur_exp_image_native_handle_t *);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urBindlessImagesSampledImageCreateExp
typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesSampledImageCreateExp_t)(
ur_context_handle_t,
ur_device_handle_t,
ur_exp_image_mem_handle_t,
ur_exp_image_mem_native_handle_t,
const ur_image_format_t *,
const ur_image_desc_t *,
ur_sampler_handle_t,
ur_exp_image_handle_t *);
ur_exp_image_native_handle_t *);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urBindlessImagesImageCopyExp
Expand All @@ -1597,7 +1597,8 @@ typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesImageCopyExp_t)(
///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urBindlessImagesImageGetInfoExp
typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesImageGetInfoExp_t)(
ur_exp_image_mem_handle_t,
ur_context_handle_t,
ur_exp_image_mem_native_handle_t,
ur_image_info_t,
void *,
size_t *);
Expand All @@ -1607,16 +1608,16 @@ typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesImageGetInfoExp_t)(
typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesMipmapGetLevelExp_t)(
ur_context_handle_t,
ur_device_handle_t,
ur_exp_image_mem_handle_t,
ur_exp_image_mem_native_handle_t,
uint32_t,
ur_exp_image_mem_handle_t *);
ur_exp_image_mem_native_handle_t *);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urBindlessImagesMipmapFreeExp
typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesMipmapFreeExp_t)(
ur_context_handle_t,
ur_device_handle_t,
ur_exp_image_mem_handle_t);
ur_exp_image_mem_native_handle_t);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urBindlessImagesImportExternalMemoryExp
Expand All @@ -1636,7 +1637,7 @@ typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesMapExternalArrayExp_t)(
const ur_image_format_t *,
const ur_image_desc_t *,
ur_exp_interop_mem_handle_t,
ur_exp_image_mem_handle_t *);
ur_exp_image_mem_native_handle_t *);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urBindlessImagesReleaseInteropExp
Expand Down
46 changes: 24 additions & 22 deletions include/ur_print.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ struct is_handle<ur_kernel_handle_t> : std::true_type {};
template <>
struct is_handle<ur_queue_handle_t> : std::true_type {};
template <>
struct is_handle<ur_native_handle_t> : std::true_type {};
template <>
struct is_handle<ur_sampler_handle_t> : std::true_type {};
template <>
struct is_handle<ur_mem_handle_t> : std::true_type {};
Expand All @@ -49,14 +47,12 @@ struct is_handle<ur_physical_mem_handle_t> : std::true_type {};
template <>
struct is_handle<ur_usm_pool_handle_t> : std::true_type {};
template <>
struct is_handle<ur_exp_image_handle_t> : std::true_type {};
template <>
struct is_handle<ur_exp_image_mem_handle_t> : std::true_type {};
template <>
struct is_handle<ur_exp_interop_mem_handle_t> : std::true_type {};
template <>
struct is_handle<ur_exp_interop_semaphore_handle_t> : std::true_type {};
template <>
struct is_handle<ur_exp_win32_handle_t> : std::true_type {};
template <>
struct is_handle<ur_exp_command_buffer_handle_t> : std::true_type {};
template <>
struct is_handle<ur_exp_command_buffer_command_handle_t> : std::true_type {};
Expand Down Expand Up @@ -14646,8 +14642,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct
os << ", ";
os << ".hImage = ";

ur::details::printPtr(os,
*(params->phImage));
ur::details::printPtr(os, reinterpret_cast<void *>(
*(params->phImage)));

return os;
}
Expand All @@ -14672,8 +14668,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct
os << ", ";
os << ".hImage = ";

ur::details::printPtr(os,
*(params->phImage));
ur::details::printPtr(os, reinterpret_cast<void *>(
*(params->phImage)));

return os;
}
Expand Down Expand Up @@ -14736,8 +14732,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct
os << ", ";
os << ".hImageMem = ";

ur::details::printPtr(os,
*(params->phImageMem));
ur::details::printPtr(os, reinterpret_cast<void *>(
*(params->phImageMem)));

return os;
}
Expand All @@ -14762,8 +14758,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct
os << ", ";
os << ".hImageMem = ";

ur::details::printPtr(os,
*(params->phImageMem));
ur::details::printPtr(os, reinterpret_cast<void *>(
*(params->phImageMem)));

os << ", ";
os << ".pImageFormat = ";
Expand Down Expand Up @@ -14806,8 +14802,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct
os << ", ";
os << ".hImageMem = ";

ur::details::printPtr(os,
*(params->phImageMem));
ur::details::printPtr(os, reinterpret_cast<void *>(
*(params->phImageMem)));

os << ", ";
os << ".pImageFormat = ";
Expand Down Expand Up @@ -14929,10 +14925,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct
/// std::ostream &
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_bindless_images_image_get_info_exp_params_t *params) {

os << ".hImageMem = ";
os << ".hContext = ";

ur::details::printPtr(os,
*(params->phImageMem));
*(params->phContext));

os << ", ";
os << ".hImageMem = ";

ur::details::printPtr(os, reinterpret_cast<void *>(
*(params->phImageMem)));

os << ", ";
os << ".propName = ";
Expand Down Expand Up @@ -14974,8 +14976,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct
os << ", ";
os << ".hImageMem = ";

ur::details::printPtr(os,
*(params->phImageMem));
ur::details::printPtr(os, reinterpret_cast<void *>(
*(params->phImageMem)));

os << ", ";
os << ".mipmapLevel = ";
Expand Down Expand Up @@ -15011,8 +15013,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct
os << ", ";
os << ".hMem = ";

ur::details::printPtr(os,
*(params->phMem));
ur::details::printPtr(os, reinterpret_cast<void *>(
*(params->phMem)));

return os;
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/core/EXP-BINDLESS-IMAGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ Enums
Types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* ${x}_exp_sampler_mip_properties_t
* ${x}_exp_image_handle_t
* ${x}_exp_image_mem_handle_t
* ${x}_exp_image_native_handle_t
* ${x}_exp_image_mem_native_handle_t
* ${x}_exp_interop_mem_handle_t
* ${x}_exp_interop_semaphore_handle_t
* ${x}_exp_interop_mem_desc_t
Expand Down
Loading

0 comments on commit 642e343

Please sign in to comment.