Skip to content

Commit

Permalink
Add conformance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
EwanC committed Dec 20, 2023
1 parent ee4c23d commit fc55f7a
Show file tree
Hide file tree
Showing 24 changed files with 754 additions and 86 deletions.
51 changes: 32 additions & 19 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ typedef enum ur_structure_type_t {
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_DESC = 0x1001, ///< ::ur_exp_command_buffer_update_kernel_launch_desc_t
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_MEMOBJ_ARG_DESC = 0x1002, ///< ::ur_exp_command_buffer_update_memobj_arg_desc_t
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_POINTER_ARG_DESC = 0x1003, ///< ::ur_exp_command_buffer_update_pointer_arg_desc_t
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_EXEC_INFO_DESC = 0x1004, ///< ::ur_exp_command_buffer_update_exec_info_desc_t
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC = 0x1004, ///< ::ur_exp_command_buffer_update_value_arg_desc_t
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_EXEC_INFO_DESC = 0x1005, ///< ::ur_exp_command_buffer_update_exec_info_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
Expand Down Expand Up @@ -7798,6 +7799,19 @@ typedef struct ur_exp_command_buffer_update_pointer_arg_desc_t {

} ur_exp_command_buffer_update_pointer_arg_desc_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Descriptor type for updating a kernel command value argument.
typedef struct ur_exp_command_buffer_update_value_arg_desc_t {
ur_structure_type_t stype; ///< [in] type of this structure, must be
///< ::UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC
const void *pNext; ///< [in][optional] pointer to extension-specific structure
uint32_t argIndex; ///< [in] Argument index.
uint32_t argSize; ///< [in] Argument size.
const ur_kernel_arg_value_properties_t *pProperties; ///< [in][optinal] Pointer to memory object properties.
const void *pArgValue; ///< [in][optional] Argument value representing kernel arg type.

} ur_exp_command_buffer_update_value_arg_desc_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Descriptor type for updating kernel command execution info.
typedef struct ur_exp_command_buffer_update_exec_info_desc_t {
Expand All @@ -7819,20 +7833,25 @@ typedef struct ur_exp_command_buffer_update_kernel_launch_desc_t {
const void *pNext; ///< [in][optional] pointer to extension-specific structure
uint32_t numMemobjArgs; ///< [in] Length of pArgMemobjList.
uint32_t numPointerArgs; ///< [in] Length of pArgPointerList.
uint32_t numValueArgs; ///< [in] Length of pArgValueList.
uint32_t numExecInfos; ///< [in] Length of pExecInfoList.
uint32_t workDim; ///< [in] Number of work dimensions in the kernel ND-range, from 1-3.
const ur_exp_command_buffer_update_memobj_arg_desc_t *pArgMemobjList; ///< [in] An array describing the new kernel mem obj arguments for the
///< command.
const ur_exp_command_buffer_update_pointer_arg_desc_t *pArgPointerList; ///< [in] An array describing the new kernel pointer arguments for the
uint32_t workDim; ///< [in][optional] Number of work dimensions in the kernel ND-range, from
///< 1-3.
const ur_exp_command_buffer_update_memobj_arg_desc_t *pArgMemobjList; ///< [in][optional] An array describing the new kernel mem obj arguments
///< for the command.
const ur_exp_command_buffer_update_pointer_arg_desc_t *pArgPointerList; ///< [in][optional] An array describing the new kernel pointer arguments
///< for the command.
const ur_exp_command_buffer_update_value_arg_desc_t *pArgValueList; ///< [in][optional] An array describing the new kernel value arguments for
///< the command.
const ur_exp_command_buffer_update_exec_info_desc_t *pArgExecInfoList; ///< [in][optional] An array describing the execution info objects for the
///< command.
const ur_exp_command_buffer_update_exec_info_desc_t *pArgExecInfoList; ///< [in] An array describing the execution info objects for the command.
size_t *pGlobalWorkOffset; ///< [in] Array of workDim unsigned values that describe the offset used to
///< calculate the global ID.
size_t *pGlobalWorkSize; ///< [in] Array of workDim unsigned values that describe the number of
///< global work-items.
size_t *pLocalWorkSize; ///< [in] Array of workDim unsigned values that describe the number of
///< work-items that make up a work-group. If nullptr, the runtime
///< implementation will choose the work-group size.
size_t *pGlobalWorkOffset; ///< [in][optional] Array of workDim unsigned values that describe the
///< offset used to calculate the global ID.
size_t *pGlobalWorkSize; ///< [in][optional] Array of workDim unsigned values that describe the
///< number of global work-items.
size_t *pLocalWorkSize; ///< [in][optional] Array of workDim unsigned values that describe the
///< number of work-items that make up a work-group. If nullptr, the
///< runtime implementation will choose the work-group size.

} ur_exp_command_buffer_update_kernel_launch_desc_t;

Expand Down Expand Up @@ -8426,12 +8445,6 @@ urCommandBufferEnqueueExp(
/// + `NULL == hCommand`
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
/// + `NULL == pUpdateKernelLaunch`
/// + `NULL == pUpdateKernelLaunch->pArgMemobjList`
/// + `NULL == pUpdateKernelLaunch->pArgPointerList`
/// + `NULL == pUpdateKernelLaunch->pArgExecInfoList`
/// + `NULL == pUpdateKernelLaunch->pGlobalWorkOffset`
/// + `NULL == pUpdateKernelLaunch->pGlobalWorkSize`
/// + `NULL == pUpdateKernelLaunch->pLocalWorkSize`
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
/// + If update functionality is not supported by the device.
/// - ::UR_RESULT_ERROR_INVALID_OPERATION
Expand Down
60 changes: 60 additions & 0 deletions include/ur_print.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_command_buffer_desc_t params);
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_command_buffer_update_memobj_arg_desc_t params);
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_command_buffer_update_pointer_arg_desc_t params);
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_command_buffer_update_value_arg_desc_t params);
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_command_buffer_update_exec_info_desc_t params);
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_command_buffer_update_kernel_launch_desc_t params);
inline std::ostream &operator<<(std::ostream &os, ur_exp_peer_info_t value);
Expand Down Expand Up @@ -1017,6 +1018,9 @@ inline std::ostream &operator<<(std::ostream &os, ur_structure_type_t value) {
case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_POINTER_ARG_DESC:
os << "UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_POINTER_ARG_DESC";
break;
case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC:
os << "UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC";
break;
case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_EXEC_INFO_DESC:
os << "UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_EXEC_INFO_DESC";
break;
Expand Down Expand Up @@ -1250,6 +1254,11 @@ inline ur_result_t printStruct(std::ostream &os, const void *ptr) {
printPtr(os, pstruct);
} break;

case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC: {
const ur_exp_command_buffer_update_value_arg_desc_t *pstruct = (const ur_exp_command_buffer_update_value_arg_desc_t *)ptr;
printPtr(os, pstruct);
} break;

case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_EXEC_INFO_DESC: {
const ur_exp_command_buffer_update_exec_info_desc_t *pstruct = (const ur_exp_command_buffer_update_exec_info_desc_t *)ptr;
printPtr(os, pstruct);
Expand Down Expand Up @@ -9291,6 +9300,46 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_command_bu
return os;
}
///////////////////////////////////////////////////////////////////////////////
/// @brief Print operator for the ur_exp_command_buffer_update_value_arg_desc_t type
/// @returns
/// std::ostream &
inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_command_buffer_update_value_arg_desc_t params) {
os << "(struct ur_exp_command_buffer_update_value_arg_desc_t){";

os << ".stype = ";

os << (params.stype);

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

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

os << ", ";
os << ".argIndex = ";

os << (params.argIndex);

os << ", ";
os << ".argSize = ";

os << (params.argSize);

os << ", ";
os << ".pProperties = ";

os << (params.pProperties);

os << ", ";
os << ".pArgValue = ";

os << (params.pArgValue);

os << "}";
return os;
}
///////////////////////////////////////////////////////////////////////////////
/// @brief Print operator for the ur_exp_command_buffer_update_exec_info_desc_t type
/// @returns
/// std::ostream &
Expand Down Expand Up @@ -9357,6 +9406,11 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_command_bu

os << (params.numPointerArgs);

os << ", ";
os << ".numValueArgs = ";

os << (params.numValueArgs);

os << ", ";
os << ".numExecInfos = ";

Expand All @@ -9379,6 +9433,12 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_command_bu
ur::details::printPtr(os,
(params.pArgPointerList));

os << ", ";
os << ".pArgValueList = ";

ur::details::printPtr(os,
(params.pArgValueList));

os << ", ";
os << ".pArgExecInfoList = ";

Expand Down
11 changes: 7 additions & 4 deletions scripts/core/EXP-COMMAND-BUFFER.rst
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ support updating the configuration of kernel commands recorded to a
command-buffer. Support of this is reported by returning true in the
${X}_DEVICE_INFO_COMMAND_BUFFER_UPDATE_SUPPORT_EXP query.

Updating a kernel commands is done by passing the new kernel configuration
Updating kernel commands is done by passing the new kernel configuration
to ${x}CommandBufferUpdateKernelLaunchExp along with the command handle of
the kernel command to update. Configurations that can be changed are the
kernels ND-Range and parameters.
Expand All @@ -178,11 +178,12 @@ kernels ND-Range and parameters.
nullptr,
true
};
${x}_exp_command_buffer_command_handle_t handle;
${x}_exp_command_buffer_handle_t hCommandBuffer;
${x}CommandBufferCreateExp(hContext, hDevice, &desc, &handle);
// Append a kernel command which has two buffer parameters, an input
// and an output.
${x}_exp_command_buffer_command_handle_t handle;
${x}CommandBufferAppendKernelLaunchExp(hCommandBuffer, hKernel, workDim,
pGlobalWorkOffset, pGlobalWorkSize,
pLocalWorkSize, 0, nullptr,
Expand All @@ -193,7 +194,7 @@ kernels ND-Range and parameters.
// Define kernel argument at index 0 to be a new input buffer object
${x}_exp_command_buffer_update_memobj_arg_desc_t newInputArg {
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_MEMOBJ_ARG, // stype
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_MEMOBJ_ARG_DESC, // stype
nullptr, // pNext,
0, // argIndex,
nullptr, // pProperties
Expand All @@ -202,7 +203,7 @@ kernels ND-Range and parameters.
// Define kernel argument at index 1 to be a new output buffer object
${x}_exp_command_buffer_update_memobj_arg_desc_t newOutputArg {
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_MEMOBJ_ARG, // stype
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_MEMOBJ_ARG_DESC, // stype
nullptr, // pNext,
1, // argIndex,
nullptr, // pProperties
Expand All @@ -216,10 +217,12 @@ kernels ND-Range and parameters.
nullptr, // pNext
2, // numMemobjArgs
0, // numPointerArgs
0, // numValueArgs
0, // numExecInfos
0, // workDim;
new_args, // pArgMemobjList
nullptr, // pArgPointerList
nullptr, // pArgValueList
nullptr, // pArgExecInfoList
nullptr, // pGlobalWorkOffset
nullptr, // pGlobalWorkSize
Expand Down
44 changes: 36 additions & 8 deletions scripts/core/exp-command-buffer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,12 @@ etors:
- name: EXP_COMMAND_BUFFER_UPDATE_POINTER_ARG_DESC
desc: $x_exp_command_buffer_update_pointer_arg_desc_t
value: "0x1003"
- name: EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC
desc: $x_exp_command_buffer_update_value_arg_desc_t
value: "0x1004"
- name: EXP_COMMAND_BUFFER_UPDATE_EXEC_INFO_DESC
desc: $x_exp_command_buffer_update_exec_info_desc_t
value: "0x1004"
value: "0x1005"

--- #--------------------------------------------------------------------------
type: enum
Expand Down Expand Up @@ -120,6 +123,25 @@ members:
desc: "[in][optional] USM pointer to memory location holding the argument value."
--- #--------------------------------------------------------------------------
type: struct
desc: "Descriptor type for updating a kernel command value argument."
base: $x_base_desc_t
name: $x_exp_command_buffer_update_value_arg_desc_t
members:
- type: uint32_t
name: argIndex
desc: "[in] Argument index."
- type: uint32_t
name: argSize
desc: "[in] Argument size."
- type: "const ur_kernel_arg_value_properties_t *"
name: pProperties
desc: "[in][optinal] Pointer to memory object properties."
- type: "const void *"
name: pArgValue
desc: "[in][optional] Argument value representing kernel arg type."

--- #--------------------------------------------------------------------------
type: struct
desc: "Descriptor type for updating kernel command execution info."
base: $x_base_desc_t
name: $x_exp_command_buffer_update_exec_info_desc_t
Expand Down Expand Up @@ -149,30 +171,36 @@ members:
- type: uint32_t
name: numPointerArgs
desc: "[in] Length of pArgPointerList."
- type: uint32_t
name: numValueArgs
desc: "[in] Length of pArgValueList."
- type: uint32_t
name: numExecInfos
desc: "[in] Length of pExecInfoList."
- type: uint32_t
name: workDim
desc: "[in] Number of work dimensions in the kernel ND-range, from 1-3."
desc: "[in][optional] Number of work dimensions in the kernel ND-range, from 1-3."
- type: "const $x_exp_command_buffer_update_memobj_arg_desc_t*"
name: pArgMemobjList
desc: "[in] An array describing the new kernel mem obj arguments for the command."
desc: "[in][optional] An array describing the new kernel mem obj arguments for the command."
- type: "const $x_exp_command_buffer_update_pointer_arg_desc_t*"
name: pArgPointerList
desc: "[in] An array describing the new kernel pointer arguments for the command."
desc: "[in][optional] An array describing the new kernel pointer arguments for the command."
- type: "const $x_exp_command_buffer_update_value_arg_desc_t*"
name: pArgValueList
desc: "[in][optional] An array describing the new kernel value arguments for the command."
- type: "const $x_exp_command_buffer_update_exec_info_desc_t*"
name: pArgExecInfoList
desc: "[in] An array describing the execution info objects for the command."
desc: "[in][optional] An array describing the execution info objects for the command."
- type: "size_t*"
name: pGlobalWorkOffset
desc: "[in] Array of workDim unsigned values that describe the offset used to calculate the global ID."
desc: "[in][optional] Array of workDim unsigned values that describe the offset used to calculate the global ID."
- type: "size_t*"
name: pGlobalWorkSize
desc: "[in] Array of workDim unsigned values that describe the number of global work-items."
desc: "[in][optional] Array of workDim unsigned values that describe the number of global work-items."
- type: "size_t*"
name: pLocalWorkSize
desc: "[in] Array of workDim unsigned values that describe the number of work-items that make up a work-group. If nullptr, the runtime implementation will choose the work-group size."
desc: "[in][optional] Array of workDim unsigned values that describe the number of work-items that make up a work-group. If nullptr, the runtime implementation will choose the work-group size."
--- #--------------------------------------------------------------------------
type: typedef
desc: "A value that identifies a command inside of a command-buffer, used for defining dependencies between commands in the same command-buffer."
Expand Down
Loading

0 comments on commit fc55f7a

Please sign in to comment.