Skip to content

Commit

Permalink
Merge pull request #852 from isaacault/iault/layered_image_prop_struct
Browse files Browse the repository at this point in the history
[Bindless][Exp] Create layered image properties struct
  • Loading branch information
kbenzie authored Sep 12, 2023
2 parents 172bc24 + 017c998 commit 764ecf2
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 40 deletions.
16 changes: 16 additions & 0 deletions include/ur.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ class ur_structure_type_v(IntEnum):
EXP_INTEROP_SEMAPHORE_DESC = 0x2002 ## ::ur_exp_interop_semaphore_desc_t
EXP_FILE_DESCRIPTOR = 0x2003 ## ::ur_exp_file_descriptor_t
EXP_WIN32_HANDLE = 0x2004 ## ::ur_exp_win32_handle_t
EXP_LAYERED_IMAGE_PROPERTIES = 0x2005 ## ::ur_exp_layered_image_properties_t

class ur_structure_type_t(c_int):
def __str__(self):
Expand Down Expand Up @@ -2231,6 +2232,21 @@ class ur_exp_interop_semaphore_desc_t(Structure):
("pNext", c_void_p) ## [in][optional] pointer to extension-specific structure
]

###############################################################################
## @brief Describes layered image properties
##
## @details
## - Specify these properties in ::urBindlessImagesUnsampledImageCreateExp
## or ::urBindlessImagesSampledImageCreateExp via ::ur_image_desc_t as
## part of a `pNext` chain.
class ur_exp_layered_image_properties_t(Structure):
_fields_ = [
("stype", ur_structure_type_t), ## [in] type of this structure, must be
## ::UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES
("pNext", c_void_p), ## [in,out][optional] pointer to extension-specific structure
("numLayers", c_ulong) ## [in] number of layers the image should have
]

###############################################################################
## @brief The extension string which defines support for command-buffers which
## is returned when querying device extensions.
Expand Down
96 changes: 56 additions & 40 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,46 +216,47 @@ typedef enum ur_function_t {
///////////////////////////////////////////////////////////////////////////////
/// @brief Defines structure types
typedef enum ur_structure_type_t {
UR_STRUCTURE_TYPE_CONTEXT_PROPERTIES = 0, ///< ::ur_context_properties_t
UR_STRUCTURE_TYPE_IMAGE_DESC = 1, ///< ::ur_image_desc_t
UR_STRUCTURE_TYPE_BUFFER_PROPERTIES = 2, ///< ::ur_buffer_properties_t
UR_STRUCTURE_TYPE_BUFFER_REGION = 3, ///< ::ur_buffer_region_t
UR_STRUCTURE_TYPE_BUFFER_CHANNEL_PROPERTIES = 4, ///< ::ur_buffer_channel_properties_t
UR_STRUCTURE_TYPE_BUFFER_ALLOC_LOCATION_PROPERTIES = 5, ///< ::ur_buffer_alloc_location_properties_t
UR_STRUCTURE_TYPE_PROGRAM_PROPERTIES = 6, ///< ::ur_program_properties_t
UR_STRUCTURE_TYPE_USM_DESC = 7, ///< ::ur_usm_desc_t
UR_STRUCTURE_TYPE_USM_HOST_DESC = 8, ///< ::ur_usm_host_desc_t
UR_STRUCTURE_TYPE_USM_DEVICE_DESC = 9, ///< ::ur_usm_device_desc_t
UR_STRUCTURE_TYPE_USM_POOL_DESC = 10, ///< ::ur_usm_pool_desc_t
UR_STRUCTURE_TYPE_USM_POOL_LIMITS_DESC = 11, ///< ::ur_usm_pool_limits_desc_t
UR_STRUCTURE_TYPE_DEVICE_BINARY = 12, ///< ::ur_device_binary_t
UR_STRUCTURE_TYPE_SAMPLER_DESC = 13, ///< ::ur_sampler_desc_t
UR_STRUCTURE_TYPE_QUEUE_PROPERTIES = 14, ///< ::ur_queue_properties_t
UR_STRUCTURE_TYPE_QUEUE_INDEX_PROPERTIES = 15, ///< ::ur_queue_index_properties_t
UR_STRUCTURE_TYPE_CONTEXT_NATIVE_PROPERTIES = 16, ///< ::ur_context_native_properties_t
UR_STRUCTURE_TYPE_KERNEL_NATIVE_PROPERTIES = 17, ///< ::ur_kernel_native_properties_t
UR_STRUCTURE_TYPE_QUEUE_NATIVE_PROPERTIES = 18, ///< ::ur_queue_native_properties_t
UR_STRUCTURE_TYPE_MEM_NATIVE_PROPERTIES = 19, ///< ::ur_mem_native_properties_t
UR_STRUCTURE_TYPE_EVENT_NATIVE_PROPERTIES = 20, ///< ::ur_event_native_properties_t
UR_STRUCTURE_TYPE_PLATFORM_NATIVE_PROPERTIES = 21, ///< ::ur_platform_native_properties_t
UR_STRUCTURE_TYPE_DEVICE_NATIVE_PROPERTIES = 22, ///< ::ur_device_native_properties_t
UR_STRUCTURE_TYPE_PROGRAM_NATIVE_PROPERTIES = 23, ///< ::ur_program_native_properties_t
UR_STRUCTURE_TYPE_SAMPLER_NATIVE_PROPERTIES = 24, ///< ::ur_sampler_native_properties_t
UR_STRUCTURE_TYPE_QUEUE_NATIVE_DESC = 25, ///< ::ur_queue_native_desc_t
UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES = 26, ///< ::ur_device_partition_properties_t
UR_STRUCTURE_TYPE_KERNEL_ARG_MEM_OBJ_PROPERTIES = 27, ///< ::ur_kernel_arg_mem_obj_properties_t
UR_STRUCTURE_TYPE_PHYSICAL_MEM_PROPERTIES = 28, ///< ::ur_physical_mem_properties_t
UR_STRUCTURE_TYPE_KERNEL_ARG_POINTER_PROPERTIES = 29, ///< ::ur_kernel_arg_pointer_properties_t
UR_STRUCTURE_TYPE_KERNEL_ARG_SAMPLER_PROPERTIES = 30, ///< ::ur_kernel_arg_sampler_properties_t
UR_STRUCTURE_TYPE_KERNEL_EXEC_INFO_PROPERTIES = 31, ///< ::ur_kernel_exec_info_properties_t
UR_STRUCTURE_TYPE_KERNEL_ARG_VALUE_PROPERTIES = 32, ///< ::ur_kernel_arg_value_properties_t
UR_STRUCTURE_TYPE_KERNEL_ARG_LOCAL_PROPERTIES = 33, ///< ::ur_kernel_arg_local_properties_t
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC = 0x1000, ///< ::ur_exp_command_buffer_desc_t
UR_STRUCTURE_TYPE_EXP_SAMPLER_MIP_PROPERTIES = 0x2000, ///< ::ur_exp_sampler_mip_properties_t
UR_STRUCTURE_TYPE_EXP_INTEROP_MEM_DESC = 0x2001, ///< ::ur_exp_interop_mem_desc_t
UR_STRUCTURE_TYPE_EXP_INTEROP_SEMAPHORE_DESC = 0x2002, ///< ::ur_exp_interop_semaphore_desc_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_CONTEXT_PROPERTIES = 0, ///< ::ur_context_properties_t
UR_STRUCTURE_TYPE_IMAGE_DESC = 1, ///< ::ur_image_desc_t
UR_STRUCTURE_TYPE_BUFFER_PROPERTIES = 2, ///< ::ur_buffer_properties_t
UR_STRUCTURE_TYPE_BUFFER_REGION = 3, ///< ::ur_buffer_region_t
UR_STRUCTURE_TYPE_BUFFER_CHANNEL_PROPERTIES = 4, ///< ::ur_buffer_channel_properties_t
UR_STRUCTURE_TYPE_BUFFER_ALLOC_LOCATION_PROPERTIES = 5, ///< ::ur_buffer_alloc_location_properties_t
UR_STRUCTURE_TYPE_PROGRAM_PROPERTIES = 6, ///< ::ur_program_properties_t
UR_STRUCTURE_TYPE_USM_DESC = 7, ///< ::ur_usm_desc_t
UR_STRUCTURE_TYPE_USM_HOST_DESC = 8, ///< ::ur_usm_host_desc_t
UR_STRUCTURE_TYPE_USM_DEVICE_DESC = 9, ///< ::ur_usm_device_desc_t
UR_STRUCTURE_TYPE_USM_POOL_DESC = 10, ///< ::ur_usm_pool_desc_t
UR_STRUCTURE_TYPE_USM_POOL_LIMITS_DESC = 11, ///< ::ur_usm_pool_limits_desc_t
UR_STRUCTURE_TYPE_DEVICE_BINARY = 12, ///< ::ur_device_binary_t
UR_STRUCTURE_TYPE_SAMPLER_DESC = 13, ///< ::ur_sampler_desc_t
UR_STRUCTURE_TYPE_QUEUE_PROPERTIES = 14, ///< ::ur_queue_properties_t
UR_STRUCTURE_TYPE_QUEUE_INDEX_PROPERTIES = 15, ///< ::ur_queue_index_properties_t
UR_STRUCTURE_TYPE_CONTEXT_NATIVE_PROPERTIES = 16, ///< ::ur_context_native_properties_t
UR_STRUCTURE_TYPE_KERNEL_NATIVE_PROPERTIES = 17, ///< ::ur_kernel_native_properties_t
UR_STRUCTURE_TYPE_QUEUE_NATIVE_PROPERTIES = 18, ///< ::ur_queue_native_properties_t
UR_STRUCTURE_TYPE_MEM_NATIVE_PROPERTIES = 19, ///< ::ur_mem_native_properties_t
UR_STRUCTURE_TYPE_EVENT_NATIVE_PROPERTIES = 20, ///< ::ur_event_native_properties_t
UR_STRUCTURE_TYPE_PLATFORM_NATIVE_PROPERTIES = 21, ///< ::ur_platform_native_properties_t
UR_STRUCTURE_TYPE_DEVICE_NATIVE_PROPERTIES = 22, ///< ::ur_device_native_properties_t
UR_STRUCTURE_TYPE_PROGRAM_NATIVE_PROPERTIES = 23, ///< ::ur_program_native_properties_t
UR_STRUCTURE_TYPE_SAMPLER_NATIVE_PROPERTIES = 24, ///< ::ur_sampler_native_properties_t
UR_STRUCTURE_TYPE_QUEUE_NATIVE_DESC = 25, ///< ::ur_queue_native_desc_t
UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES = 26, ///< ::ur_device_partition_properties_t
UR_STRUCTURE_TYPE_KERNEL_ARG_MEM_OBJ_PROPERTIES = 27, ///< ::ur_kernel_arg_mem_obj_properties_t
UR_STRUCTURE_TYPE_PHYSICAL_MEM_PROPERTIES = 28, ///< ::ur_physical_mem_properties_t
UR_STRUCTURE_TYPE_KERNEL_ARG_POINTER_PROPERTIES = 29, ///< ::ur_kernel_arg_pointer_properties_t
UR_STRUCTURE_TYPE_KERNEL_ARG_SAMPLER_PROPERTIES = 30, ///< ::ur_kernel_arg_sampler_properties_t
UR_STRUCTURE_TYPE_KERNEL_EXEC_INFO_PROPERTIES = 31, ///< ::ur_kernel_exec_info_properties_t
UR_STRUCTURE_TYPE_KERNEL_ARG_VALUE_PROPERTIES = 32, ///< ::ur_kernel_arg_value_properties_t
UR_STRUCTURE_TYPE_KERNEL_ARG_LOCAL_PROPERTIES = 33, ///< ::ur_kernel_arg_local_properties_t
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC = 0x1000, ///< ::ur_exp_command_buffer_desc_t
UR_STRUCTURE_TYPE_EXP_SAMPLER_MIP_PROPERTIES = 0x2000, ///< ::ur_exp_sampler_mip_properties_t
UR_STRUCTURE_TYPE_EXP_INTEROP_MEM_DESC = 0x2001, ///< ::ur_exp_interop_mem_desc_t
UR_STRUCTURE_TYPE_EXP_INTEROP_SEMAPHORE_DESC = 0x2002, ///< ::ur_exp_interop_semaphore_desc_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_LAYERED_IMAGE_PROPERTIES = 0x2005, ///< ::ur_exp_layered_image_properties_t
/// @cond
UR_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff
/// @endcond
Expand Down Expand Up @@ -7026,6 +7027,21 @@ typedef struct ur_exp_interop_semaphore_desc_t {

} ur_exp_interop_semaphore_desc_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Describes layered image properties
///
/// @details
/// - Specify these properties in ::urBindlessImagesUnsampledImageCreateExp
/// or ::urBindlessImagesSampledImageCreateExp via ::ur_image_desc_t as
/// part of a `pNext` chain.
typedef struct ur_exp_layered_image_properties_t {
ur_structure_type_t stype; ///< [in] type of this structure, must be
///< ::UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES
void *pNext; ///< [in,out][optional] pointer to extension-specific structure
uint32_t numLayers; ///< [in] number of layers the image should have

} ur_exp_layered_image_properties_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief USM allocate pitched memory
///
Expand Down
4 changes: 4 additions & 0 deletions scripts/core/EXP-BINDLESS-IMAGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Enums
${X}_STRUCTURE_TYPE_EXP_INTEROP_SEMAPHORE_DESC
${X}_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR
${X}_STRUCTURE_TYPE_EXP_WIN32_HANDLE
${X}_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES

* ${x}_device_info_t
* ${X}_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP
Expand Down Expand Up @@ -127,6 +128,7 @@ Types
* ${x}_exp_interop_semaphore_desc_t
* ${x}_exp_file_descriptor_t
* ${x}_exp_win32_handle_t
* ${x}_exp_layered_image_properties_t

Functions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -176,6 +178,8 @@ Changelog
+----------+-------------------------------------------------------------+
| 6.0 | Fix semaphore import function parameter name. |
+----------+-------------------------------------------------------------+
| 7.0 | Add layered image properties struct. |
+----------+-------------------------------------------------------------+

Contributors
--------------------------------------------------------------------------------
Expand Down
17 changes: 17 additions & 0 deletions scripts/core/exp-bindless-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ etors:
- name: EXP_WIN32_HANDLE
desc: $x_exp_win32_handle_t
value: "0x2004"
- name: EXP_LAYERED_IMAGE_PROPERTIES
desc: $x_exp_layered_image_properties_t
value: "0x2005"
--- #--------------------------------------------------------------------------
type: enum
extend: true
Expand Down Expand Up @@ -186,6 +189,20 @@ name: $x_exp_interop_semaphore_desc_t
base: $x_base_desc_t
members: []
--- #--------------------------------------------------------------------------
type: struct
desc: "Describes layered image properties"
details:
- Specify these properties in $xBindlessImagesUnsampledImageCreateExp or
$xBindlessImagesSampledImageCreateExp via $x_image_desc_t as part of a
`pNext` chain.
class: $xBindlessImages
name: $x_exp_layered_image_properties_t
base: $x_base_properties_t
members:
- type: uint32_t
name: numLayers
desc: "[in] number of layers the image should have"
--- #--------------------------------------------------------------------------
type: function
desc: "USM allocate pitched memory"
class: $xUSM
Expand Down
35 changes: 35 additions & 0 deletions source/common/ur_params.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,9 @@ inline std::ostream &
operator<<(std::ostream &os,
const struct ur_exp_interop_semaphore_desc_t params);
inline std::ostream &
operator<<(std::ostream &os,
const struct ur_exp_layered_image_properties_t params);
inline std::ostream &
operator<<(std::ostream &os, const struct ur_exp_command_buffer_desc_t params);
inline std::ostream &operator<<(std::ostream &os,
enum ur_exp_peer_info_t value);
Expand Down Expand Up @@ -1318,6 +1321,10 @@ inline std::ostream &operator<<(std::ostream &os,
case UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE:
os << "UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE";
break;

case UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES:
os << "UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES";
break;
default:
os << "unknown enumerator";
break;
Expand Down Expand Up @@ -1566,6 +1573,12 @@ inline void serializeStruct(std::ostream &os, const void *ptr) {
(const ur_exp_win32_handle_t *)ptr;
ur_params::serializePtr(os, pstruct);
} break;

case UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES: {
const ur_exp_layered_image_properties_t *pstruct =
(const ur_exp_layered_image_properties_t *)ptr;
ur_params::serializePtr(os, pstruct);
} break;
default:
os << "unknown enumerator";
break;
Expand Down Expand Up @@ -9892,6 +9905,28 @@ operator<<(std::ostream &os,
return os;
}
inline std::ostream &
operator<<(std::ostream &os,
const struct ur_exp_layered_image_properties_t params) {
os << "(struct ur_exp_layered_image_properties_t){";

os << ".stype = ";

os << (params.stype);

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

ur_params::serializeStruct(os, (params.pNext));

os << ", ";
os << ".numLayers = ";

os << (params.numLayers);

os << "}";
return os;
}
inline std::ostream &
operator<<(std::ostream &os, const struct ur_exp_command_buffer_desc_t params) {
os << "(struct ur_exp_command_buffer_desc_t){";

Expand Down

0 comments on commit 764ecf2

Please sign in to comment.