Skip to content

Commit

Permalink
Merge branch 'main' into user-after-free
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanZyne committed Apr 10, 2024
2 parents def6bd0 + 85b7559 commit 7a5c1ad
Show file tree
Hide file tree
Showing 19 changed files with 269 additions and 23 deletions.
48 changes: 40 additions & 8 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ typedef enum ur_structure_type_t {
UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR = 0x2003, ///< ::ur_exp_file_descriptor_t
UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE = 0x2004, ///< ::ur_exp_win32_handle_t
UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES = 0x2005, ///< ::ur_exp_sampler_addr_modes_t
UR_STRUCTURE_TYPE_EXP_SAMPLER_CUBEMAP_PROPERTIES = 0x2006, ///< ::ur_exp_sampler_cubemap_properties_t
/// @cond
UR_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff
/// @endcond
Expand Down Expand Up @@ -1625,6 +1626,10 @@ typedef enum ur_device_info_t {
///< semaphore resources
UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP = 0x200F, ///< [::ur_bool_t] returns true if the device supports exporting internal
///< event resources
UR_DEVICE_INFO_CUBEMAP_SUPPORT_EXP = 0x2010, ///< [::ur_bool_t] returns true if the device supports allocating and
///< accessing cubemap resources
UR_DEVICE_INFO_CUBEMAP_SEAMLESS_FILTERING_SUPPORT_EXP = 0x2011, ///< [::ur_bool_t] returns true if the device supports sampling cubemapped
///< images across face boundaries
/// @cond
UR_DEVICE_INFO_FORCE_UINT32 = 0x7fffffff
/// @endcond
Expand All @@ -1650,7 +1655,7 @@ typedef enum ur_device_info_t {
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `NULL == hDevice`
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
/// + `::UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP < propName`
/// + `::UR_DEVICE_INFO_CUBEMAP_SEAMLESS_FILTERING_SUPPORT_EXP < propName`
/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION
/// + If `propName` is not supported by the adapter.
/// - ::UR_RESULT_ERROR_INVALID_SIZE
Expand Down Expand Up @@ -2421,13 +2426,14 @@ typedef enum ur_mem_flag_t {
///////////////////////////////////////////////////////////////////////////////
/// @brief Memory types
typedef enum ur_mem_type_t {
UR_MEM_TYPE_BUFFER = 0, ///< Buffer object
UR_MEM_TYPE_IMAGE2D = 1, ///< 2D image object
UR_MEM_TYPE_IMAGE3D = 2, ///< 3D image object
UR_MEM_TYPE_IMAGE2D_ARRAY = 3, ///< 2D image array object
UR_MEM_TYPE_IMAGE1D = 4, ///< 1D image object
UR_MEM_TYPE_IMAGE1D_ARRAY = 5, ///< 1D image array object
UR_MEM_TYPE_IMAGE1D_BUFFER = 6, ///< 1D image buffer object
UR_MEM_TYPE_BUFFER = 0, ///< Buffer object
UR_MEM_TYPE_IMAGE2D = 1, ///< 2D image object
UR_MEM_TYPE_IMAGE3D = 2, ///< 3D image object
UR_MEM_TYPE_IMAGE2D_ARRAY = 3, ///< 2D image array object
UR_MEM_TYPE_IMAGE1D = 4, ///< 1D image object
UR_MEM_TYPE_IMAGE1D_ARRAY = 5, ///< 1D image array object
UR_MEM_TYPE_IMAGE1D_BUFFER = 6, ///< 1D image buffer object
UR_MEM_TYPE_IMAGE_CUBEMAP_EXP = 0x2000, ///< Experimental cubemap image object
/// @cond
UR_MEM_TYPE_FORCE_UINT32 = 0x7fffffff
/// @endcond
Expand Down Expand Up @@ -7241,6 +7247,17 @@ typedef enum ur_exp_image_copy_flag_t {
/// @brief Bit Mask for validating ur_exp_image_copy_flags_t
#define UR_EXP_IMAGE_COPY_FLAGS_MASK 0xfffffff8

///////////////////////////////////////////////////////////////////////////////
/// @brief Sampler cubemap seamless filtering mode.
typedef enum ur_exp_sampler_cubemap_filter_mode_t {
UR_EXP_SAMPLER_CUBEMAP_FILTER_MODE_DISJOINTED = 0, ///< Disable seamless filtering
UR_EXP_SAMPLER_CUBEMAP_FILTER_MODE_SEAMLESS = 1, ///< Enable Seamless filtering
/// @cond
UR_EXP_SAMPLER_CUBEMAP_FILTER_MODE_FORCE_UINT32 = 0x7fffffff
/// @endcond

} ur_exp_sampler_cubemap_filter_mode_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief File descriptor
typedef struct ur_exp_file_descriptor_t {
Expand Down Expand Up @@ -7295,6 +7312,21 @@ typedef struct ur_exp_sampler_addr_modes_t {

} ur_exp_sampler_addr_modes_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Describes cubemap sampler properties
///
/// @details
/// - Specify these properties in ::urSamplerCreate via ::ur_sampler_desc_t
/// as part of a `pNext` chain.
typedef struct ur_exp_sampler_cubemap_properties_t {
ur_structure_type_t stype; ///< [in] type of this structure, must be
///< ::UR_STRUCTURE_TYPE_EXP_SAMPLER_CUBEMAP_PROPERTIES
void *pNext; ///< [in,out][optional] pointer to extension-specific structure
ur_exp_sampler_cubemap_filter_mode_t cubemapFilterMode; ///< [in] enables or disables seamless cubemap filtering between cubemap
///< faces

} ur_exp_sampler_cubemap_properties_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Describes an interop memory resource descriptor
typedef struct ur_exp_interop_mem_desc_t {
Expand Down
16 changes: 16 additions & 0 deletions include/ur_print.h
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmMigrationFlags(enum ur_usm_migrati
/// - `buff_size < out_size`
UR_APIEXPORT ur_result_t UR_APICALL urPrintExpImageCopyFlags(enum ur_exp_image_copy_flag_t value, char *buffer, const size_t buff_size, size_t *out_size);

///////////////////////////////////////////////////////////////////////////////
/// @brief Print ur_exp_sampler_cubemap_filter_mode_t enum
/// @returns
/// - ::UR_RESULT_SUCCESS
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// - `buff_size < out_size`
UR_APIEXPORT ur_result_t UR_APICALL urPrintExpSamplerCubemapFilterMode(enum ur_exp_sampler_cubemap_filter_mode_t value, char *buffer, const size_t buff_size, size_t *out_size);

///////////////////////////////////////////////////////////////////////////////
/// @brief Print ur_exp_file_descriptor_t struct
/// @returns
Expand Down Expand Up @@ -914,6 +922,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urPrintExpSamplerMipProperties(const struct
/// - `buff_size < out_size`
UR_APIEXPORT ur_result_t UR_APICALL urPrintExpSamplerAddrModes(const struct ur_exp_sampler_addr_modes_t params, char *buffer, const size_t buff_size, size_t *out_size);

///////////////////////////////////////////////////////////////////////////////
/// @brief Print ur_exp_sampler_cubemap_properties_t struct
/// @returns
/// - ::UR_RESULT_SUCCESS
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// - `buff_size < out_size`
UR_APIEXPORT ur_result_t UR_APICALL urPrintExpSamplerCubemapProperties(const struct ur_exp_sampler_cubemap_properties_t params, char *buffer, const size_t buff_size, size_t *out_size);

///////////////////////////////////////////////////////////////////////////////
/// @brief Print ur_exp_interop_mem_desc_t struct
/// @returns
Expand Down
86 changes: 86 additions & 0 deletions include/ur_print.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,12 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_execution_info_t value
inline std::ostream &operator<<(std::ostream &os, enum ur_map_flag_t value);
inline std::ostream &operator<<(std::ostream &os, enum ur_usm_migration_flag_t value);
inline std::ostream &operator<<(std::ostream &os, enum ur_exp_image_copy_flag_t value);
inline std::ostream &operator<<(std::ostream &os, enum ur_exp_sampler_cubemap_filter_mode_t value);
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_file_descriptor_t params);
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_win32_handle_t params);
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_sampler_mip_properties_t params);
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_sampler_addr_modes_t params);
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_sampler_cubemap_properties_t params);
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_interop_mem_desc_t params);
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_interop_semaphore_desc_t params);
inline std::ostream &operator<<(std::ostream &os, enum ur_exp_command_buffer_info_t value);
Expand Down Expand Up @@ -1068,6 +1070,9 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_structure_type_t value
case UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES:
os << "UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES";
break;
case UR_STRUCTURE_TYPE_EXP_SAMPLER_CUBEMAP_PROPERTIES:
os << "UR_STRUCTURE_TYPE_EXP_SAMPLER_CUBEMAP_PROPERTIES";
break;
default:
os << "unknown enumerator";
break;
Expand Down Expand Up @@ -1319,6 +1324,11 @@ inline ur_result_t printStruct(std::ostream &os, const void *ptr) {
const ur_exp_sampler_addr_modes_t *pstruct = (const ur_exp_sampler_addr_modes_t *)ptr;
printPtr(os, pstruct);
} break;

case UR_STRUCTURE_TYPE_EXP_SAMPLER_CUBEMAP_PROPERTIES: {
const ur_exp_sampler_cubemap_properties_t *pstruct = (const ur_exp_sampler_cubemap_properties_t *)ptr;
printPtr(os, pstruct);
} break;
default:
os << "unknown enumerator";
return UR_RESULT_ERROR_INVALID_ENUMERATION;
Expand Down Expand Up @@ -2546,6 +2556,12 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_device_info_t value) {
case UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP:
os << "UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP";
break;
case UR_DEVICE_INFO_CUBEMAP_SUPPORT_EXP:
os << "UR_DEVICE_INFO_CUBEMAP_SUPPORT_EXP";
break;
case UR_DEVICE_INFO_CUBEMAP_SEAMLESS_FILTERING_SUPPORT_EXP:
os << "UR_DEVICE_INFO_CUBEMAP_SEAMLESS_FILTERING_SUPPORT_EXP";
break;
default:
os << "unknown enumerator";
break;
Expand Down Expand Up @@ -4150,6 +4166,30 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info

os << ")";
} break;
case UR_DEVICE_INFO_CUBEMAP_SUPPORT_EXP: {
const ur_bool_t *tptr = (const ur_bool_t *)ptr;
if (sizeof(ur_bool_t) > size) {
os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")";
return UR_RESULT_ERROR_INVALID_SIZE;
}
os << (const void *)(tptr) << " (";

os << *tptr;

os << ")";
} break;
case UR_DEVICE_INFO_CUBEMAP_SEAMLESS_FILTERING_SUPPORT_EXP: {
const ur_bool_t *tptr = (const ur_bool_t *)ptr;
if (sizeof(ur_bool_t) > size) {
os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")";
return UR_RESULT_ERROR_INVALID_SIZE;
}
os << (const void *)(tptr) << " (";

os << *tptr;

os << ")";
} break;
default:
os << "unknown enumerator";
return UR_RESULT_ERROR_INVALID_ENUMERATION;
Expand Down Expand Up @@ -5326,6 +5366,9 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_mem_type_t value) {
case UR_MEM_TYPE_IMAGE1D_BUFFER:
os << "UR_MEM_TYPE_IMAGE1D_BUFFER";
break;
case UR_MEM_TYPE_IMAGE_CUBEMAP_EXP:
os << "UR_MEM_TYPE_IMAGE_CUBEMAP_EXP";
break;
default:
os << "unknown enumerator";
break;
Expand Down Expand Up @@ -9137,6 +9180,24 @@ inline ur_result_t printFlag<ur_exp_image_copy_flag_t>(std::ostream &os, uint32_
}
} // namespace ur::details
///////////////////////////////////////////////////////////////////////////////
/// @brief Print operator for the ur_exp_sampler_cubemap_filter_mode_t type
/// @returns
/// std::ostream &
inline std::ostream &operator<<(std::ostream &os, enum ur_exp_sampler_cubemap_filter_mode_t value) {
switch (value) {
case UR_EXP_SAMPLER_CUBEMAP_FILTER_MODE_DISJOINTED:
os << "UR_EXP_SAMPLER_CUBEMAP_FILTER_MODE_DISJOINTED";
break;
case UR_EXP_SAMPLER_CUBEMAP_FILTER_MODE_SEAMLESS:
os << "UR_EXP_SAMPLER_CUBEMAP_FILTER_MODE_SEAMLESS";
break;
default:
os << "unknown enumerator";
break;
}
return os;
}
///////////////////////////////////////////////////////////////////////////////
/// @brief Print operator for the ur_exp_file_descriptor_t type
/// @returns
/// std::ostream &
Expand Down Expand Up @@ -9259,6 +9320,31 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_sampler_ad
return os;
}
///////////////////////////////////////////////////////////////////////////////
/// @brief Print operator for the ur_exp_sampler_cubemap_properties_t type
/// @returns
/// std::ostream &
inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_sampler_cubemap_properties_t params) {
os << "(struct ur_exp_sampler_cubemap_properties_t){";

os << ".stype = ";

os << (params.stype);

os << ", ";
os << ".pNext = ";

ur::details::printStruct(os,
(params.pNext));

os << ", ";
os << ".cubemapFilterMode = ";

os << (params.cubemapFilterMode);

os << "}";
return os;
}
///////////////////////////////////////////////////////////////////////////////
/// @brief Print operator for the ur_exp_interop_mem_desc_t type
/// @returns
/// std::ostream &
Expand Down
15 changes: 15 additions & 0 deletions scripts/core/EXP-BINDLESS-IMAGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Runtime:
* Sampled images
* Unsampled images
* Mipmaps
* Cubemaps
* USM backed images

* Interoperability support
Expand All @@ -69,6 +70,7 @@ Enums
${X}_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR
${X}_STRUCTURE_TYPE_EXP_WIN32_HANDLE
${X}_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES
${X}_STRUCTURE_TYPE_EXP_SAMPLER_CUBEMAP_PROPERTIES

* ${x}_device_info_t
* ${X}_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP
Expand All @@ -87,6 +89,8 @@ Enums
* ${X}_DEVICE_INFO_INTEROP_MEMORY_EXPORT_SUPPORT_EXP
* ${X}_DEVICE_INFO_INTEROP_SEMAPHORE_IMPORT_SUPPORT_EXP
* ${X}_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP
* ${X}_DEVICE_INFO_CUBEMAP_SUPPORT_EXP
* ${X}_DEVICE_INFO_CUBEMAP_SEAMLESS_FILTERING_SUPPORT_EXP

* ${x}_command_t
* ${X}_COMMAND_INTEROP_SEMAPHORE_WAIT_EXP
Expand All @@ -97,6 +101,10 @@ Enums
* ${X}_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST
* ${X}_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE

* ${x}_exp_sampler_cubemap_filter_mode_t
* ${X}_EXP_SAMPLER_CUBEMAP_FILTER_MODE_SEAMLESS
* ${X}_EXP_SAMPLER_CUBEMAP_FILTER_MODE_DISJOINTED

* ${x}_function_t
* ${X}_FUNCTION_USM_PITCHED_ALLOC_EXP
* ${X}_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_HANDLE_DESTROY_EXP
Expand All @@ -117,6 +125,9 @@ Enums
* ${X}_FUNCTION_BINDLESS_IMAGES_WAIT_EXTERNAL_SEMAPHORE_EXP
* ${X}_FUNCTION_BINDLESS_IMAGES_SIGNAL_EXTERNAL_SEMAPHORE_EXP

* ${x}_mem_type_t
* ${X}_MEM_TYPE_IMAGE_CUBEMAP_EXP

Types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* ${x}_exp_sampler_mip_properties_t
Expand All @@ -129,6 +140,7 @@ Types
* ${x}_exp_file_descriptor_t
* ${x}_exp_win32_handle_t
* ${x}_exp_sampler_addr_modes_t
* ${x}_exp_sampler_cubemap_properties_t

Functions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -184,6 +196,9 @@ Changelog
+------------------------------------------------------------------------+
| 9.0 | Remove layered image properties struct. |
+------------------------------------------------------------------------+
| 10.0 | Added cubemap image type, sampling properties, and device |
| | queries. |
+----------+-------------------------------------------------------------+

Contributors
--------------------------------------------------------------------------------
Expand Down
41 changes: 41 additions & 0 deletions scripts/core/exp-bindless-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ etors:
- name: INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP
value: "0x200F"
desc: "[$x_bool_t] returns true if the device supports exporting internal event resources"
- name: CUBEMAP_SUPPORT_EXP
value: "0x2010"
desc: "[$x_bool_t] returns true if the device supports allocating and accessing cubemap resources"
- name: CUBEMAP_SEAMLESS_FILTERING_SUPPORT_EXP
value: "0x2011"
desc: "[$x_bool_t] returns true if the device supports sampling cubemapped images across face boundaries"
--- #--------------------------------------------------------------------------
type: enum
extend: true
Expand All @@ -110,6 +116,9 @@ etors:
- name: EXP_SAMPLER_ADDR_MODES
desc: $x_exp_sampler_addr_modes_t
value: "0x2005"
- name: EXP_SAMPLER_CUBEMAP_PROPERTIES
desc: $x_exp_sampler_cubemap_properties_t
value: "0x2006"
--- #--------------------------------------------------------------------------
type: enum
extend: true
Expand All @@ -135,6 +144,25 @@ etors:
- name: DEVICE_TO_DEVICE
desc: "Device to device"
--- #--------------------------------------------------------------------------
type: enum
extend: True
desc: "Memory types"
name: $x_mem_type_t
etors:
- name: IMAGE_CUBEMAP_EXP
value: "0x2000"
desc: "Experimental cubemap image object"
--- #--------------------------------------------------------------------------
type: enum
desc: "Sampler cubemap seamless filtering mode."
class: $xBindlessImages
name: $x_exp_sampler_cubemap_filter_mode_t
etors:
- name: DISJOINTED
desc: "Disable seamless filtering"
- name: SEAMLESS
desc: "Enable Seamless filtering"
--- #--------------------------------------------------------------------------
type: struct
desc: "File descriptor"
name: $x_exp_file_descriptor_t
Expand Down Expand Up @@ -189,6 +217,19 @@ members:
desc: "[in] Specify the address mode of the sampler per dimension"
--- #--------------------------------------------------------------------------
type: struct
desc: "Describes cubemap sampler properties"
details:
- Specify these properties in $xSamplerCreate via $x_sampler_desc_t as part
of a `pNext` chain.
class: $xBindlessImages
name: $x_exp_sampler_cubemap_properties_t
base: $x_base_properties_t
members:
- type: $x_exp_sampler_cubemap_filter_mode_t
name: cubemapFilterMode
desc: "[in] enables or disables seamless cubemap filtering between cubemap faces"
--- #--------------------------------------------------------------------------
type: struct
desc: "Describes an interop memory resource descriptor"
class: $xBindlessImages
name: $x_exp_interop_mem_desc_t
Expand Down
Loading

0 comments on commit 7a5c1ad

Please sign in to comment.