Skip to content

Commit 0c71fc5

Browse files
committed
Add conformance tests
1 parent ee4c23d commit 0c71fc5

32 files changed

+1525
-99
lines changed

include/ur_api.h

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ typedef enum ur_structure_type_t {
264264
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_DESC = 0x1001, ///< ::ur_exp_command_buffer_update_kernel_launch_desc_t
265265
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_MEMOBJ_ARG_DESC = 0x1002, ///< ::ur_exp_command_buffer_update_memobj_arg_desc_t
266266
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_POINTER_ARG_DESC = 0x1003, ///< ::ur_exp_command_buffer_update_pointer_arg_desc_t
267-
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_EXEC_INFO_DESC = 0x1004, ///< ::ur_exp_command_buffer_update_exec_info_desc_t
267+
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC = 0x1004, ///< ::ur_exp_command_buffer_update_value_arg_desc_t
268+
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_EXEC_INFO_DESC = 0x1005, ///< ::ur_exp_command_buffer_update_exec_info_desc_t
268269
UR_STRUCTURE_TYPE_EXP_SAMPLER_MIP_PROPERTIES = 0x2000, ///< ::ur_exp_sampler_mip_properties_t
269270
UR_STRUCTURE_TYPE_EXP_INTEROP_MEM_DESC = 0x2001, ///< ::ur_exp_interop_mem_desc_t
270271
UR_STRUCTURE_TYPE_EXP_INTEROP_SEMAPHORE_DESC = 0x2002, ///< ::ur_exp_interop_semaphore_desc_t
@@ -7798,6 +7799,19 @@ typedef struct ur_exp_command_buffer_update_pointer_arg_desc_t {
77987799

77997800
} ur_exp_command_buffer_update_pointer_arg_desc_t;
78007801

7802+
///////////////////////////////////////////////////////////////////////////////
7803+
/// @brief Descriptor type for updating a kernel command value argument.
7804+
typedef struct ur_exp_command_buffer_update_value_arg_desc_t {
7805+
ur_structure_type_t stype; ///< [in] type of this structure, must be
7806+
///< ::UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC
7807+
const void *pNext; ///< [in][optional] pointer to extension-specific structure
7808+
uint32_t argIndex; ///< [in] Argument index.
7809+
uint32_t argSize; ///< [in] Argument size.
7810+
const ur_kernel_arg_value_properties_t *pProperties; ///< [in][optinal] Pointer to memory object properties.
7811+
const void *pArgValue; ///< [in][optional] Argument value representing kernel arg type.
7812+
7813+
} ur_exp_command_buffer_update_value_arg_desc_t;
7814+
78017815
///////////////////////////////////////////////////////////////////////////////
78027816
/// @brief Descriptor type for updating kernel command execution info.
78037817
typedef struct ur_exp_command_buffer_update_exec_info_desc_t {
@@ -7819,20 +7833,24 @@ typedef struct ur_exp_command_buffer_update_kernel_launch_desc_t {
78197833
const void *pNext; ///< [in][optional] pointer to extension-specific structure
78207834
uint32_t numMemobjArgs; ///< [in] Length of pArgMemobjList.
78217835
uint32_t numPointerArgs; ///< [in] Length of pArgPointerList.
7836+
uint32_t numValueArgs; ///< [in] Length of pArgValueList.
78227837
uint32_t numExecInfos; ///< [in] Length of pExecInfoList.
78237838
uint32_t workDim; ///< [in] Number of work dimensions in the kernel ND-range, from 1-3.
7824-
const ur_exp_command_buffer_update_memobj_arg_desc_t *pArgMemobjList; ///< [in] An array describing the new kernel mem obj arguments for the
7825-
///< command.
7826-
const ur_exp_command_buffer_update_pointer_arg_desc_t *pArgPointerList; ///< [in] An array describing the new kernel pointer arguments for the
7839+
const ur_exp_command_buffer_update_memobj_arg_desc_t *pArgMemobjList; ///< [in][optional][range(0, numMemobjArgs)] An array describing the new
7840+
///< kernel mem obj arguments for the command.
7841+
const ur_exp_command_buffer_update_pointer_arg_desc_t *pArgPointerList; ///< [in][optional][range(0, numPointerArgs)] An array describing the new
7842+
///< kernel pointer arguments for the command.
7843+
const ur_exp_command_buffer_update_value_arg_desc_t *pArgValueList; ///< [in][optional][range(0, numValueArgs)]An array describing the new
7844+
///< kernel value arguments for the command.
7845+
const ur_exp_command_buffer_update_exec_info_desc_t *pArgExecInfoList; ///< [in][optional] An array describing the execution info objects for the
78277846
///< command.
7828-
const ur_exp_command_buffer_update_exec_info_desc_t *pArgExecInfoList; ///< [in] An array describing the execution info objects for the command.
7829-
size_t *pGlobalWorkOffset; ///< [in] Array of workDim unsigned values that describe the offset used to
7830-
///< calculate the global ID.
7831-
size_t *pGlobalWorkSize; ///< [in] Array of workDim unsigned values that describe the number of
7832-
///< global work-items.
7833-
size_t *pLocalWorkSize; ///< [in] Array of workDim unsigned values that describe the number of
7834-
///< work-items that make up a work-group. If nullptr, the runtime
7835-
///< implementation will choose the work-group size.
7847+
size_t *pGlobalWorkOffset; ///< [in][optional][range(0, workDim)] Array of workDim unsigned values
7848+
///< that describe the offset used to calculate the global ID.
7849+
size_t *pGlobalWorkSize; ///< [in][optional][range(0, workDim)] Array of workDim unsigned values
7850+
///< that describe the number of global work-items.
7851+
size_t *pLocalWorkSize; ///< [in][optional][range(0, workDim)] Array of workDim unsigned values
7852+
///< that describe the number of work-items that make up a work-group. If
7853+
///< nullptr, the runtime implementation will choose the work-group size.
78367854

78377855
} ur_exp_command_buffer_update_kernel_launch_desc_t;
78387856

@@ -8426,12 +8444,6 @@ urCommandBufferEnqueueExp(
84268444
/// + `NULL == hCommand`
84278445
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
84288446
/// + `NULL == pUpdateKernelLaunch`
8429-
/// + `NULL == pUpdateKernelLaunch->pArgMemobjList`
8430-
/// + `NULL == pUpdateKernelLaunch->pArgPointerList`
8431-
/// + `NULL == pUpdateKernelLaunch->pArgExecInfoList`
8432-
/// + `NULL == pUpdateKernelLaunch->pGlobalWorkOffset`
8433-
/// + `NULL == pUpdateKernelLaunch->pGlobalWorkSize`
8434-
/// + `NULL == pUpdateKernelLaunch->pLocalWorkSize`
84358447
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
84368448
/// + If update functionality is not supported by the device.
84378449
/// - ::UR_RESULT_ERROR_INVALID_OPERATION

include/ur_print.hpp

Lines changed: 105 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct
323323
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_command_buffer_desc_t params);
324324
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_command_buffer_update_memobj_arg_desc_t params);
325325
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_command_buffer_update_pointer_arg_desc_t params);
326+
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_command_buffer_update_value_arg_desc_t params);
326327
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_command_buffer_update_exec_info_desc_t params);
327328
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_command_buffer_update_kernel_launch_desc_t params);
328329
inline std::ostream &operator<<(std::ostream &os, ur_exp_peer_info_t value);
@@ -1017,6 +1018,9 @@ inline std::ostream &operator<<(std::ostream &os, ur_structure_type_t value) {
10171018
case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_POINTER_ARG_DESC:
10181019
os << "UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_POINTER_ARG_DESC";
10191020
break;
1021+
case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC:
1022+
os << "UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC";
1023+
break;
10201024
case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_EXEC_INFO_DESC:
10211025
os << "UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_EXEC_INFO_DESC";
10221026
break;
@@ -1250,6 +1254,11 @@ inline ur_result_t printStruct(std::ostream &os, const void *ptr) {
12501254
printPtr(os, pstruct);
12511255
} break;
12521256

1257+
case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC: {
1258+
const ur_exp_command_buffer_update_value_arg_desc_t *pstruct = (const ur_exp_command_buffer_update_value_arg_desc_t *)ptr;
1259+
printPtr(os, pstruct);
1260+
} break;
1261+
12531262
case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_EXEC_INFO_DESC: {
12541263
const ur_exp_command_buffer_update_exec_info_desc_t *pstruct = (const ur_exp_command_buffer_update_exec_info_desc_t *)ptr;
12551264
printPtr(os, pstruct);
@@ -9291,6 +9300,46 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_command_bu
92919300
return os;
92929301
}
92939302
///////////////////////////////////////////////////////////////////////////////
9303+
/// @brief Print operator for the ur_exp_command_buffer_update_value_arg_desc_t type
9304+
/// @returns
9305+
/// std::ostream &
9306+
inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_command_buffer_update_value_arg_desc_t params) {
9307+
os << "(struct ur_exp_command_buffer_update_value_arg_desc_t){";
9308+
9309+
os << ".stype = ";
9310+
9311+
os << (params.stype);
9312+
9313+
os << ", ";
9314+
os << ".pNext = ";
9315+
9316+
ur::details::printStruct(os,
9317+
(params.pNext));
9318+
9319+
os << ", ";
9320+
os << ".argIndex = ";
9321+
9322+
os << (params.argIndex);
9323+
9324+
os << ", ";
9325+
os << ".argSize = ";
9326+
9327+
os << (params.argSize);
9328+
9329+
os << ", ";
9330+
os << ".pProperties = ";
9331+
9332+
os << (params.pProperties);
9333+
9334+
os << ", ";
9335+
os << ".pArgValue = ";
9336+
9337+
os << (params.pArgValue);
9338+
9339+
os << "}";
9340+
return os;
9341+
}
9342+
///////////////////////////////////////////////////////////////////////////////
92949343
/// @brief Print operator for the ur_exp_command_buffer_update_exec_info_desc_t type
92959344
/// @returns
92969345
/// std::ostream &
@@ -9357,6 +9406,11 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_command_bu
93579406

93589407
os << (params.numPointerArgs);
93599408

9409+
os << ", ";
9410+
os << ".numValueArgs = ";
9411+
9412+
os << (params.numValueArgs);
9413+
93609414
os << ", ";
93619415
os << ".numExecInfos = ";
93629416

@@ -9368,16 +9422,37 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_command_bu
93689422
os << (params.workDim);
93699423

93709424
os << ", ";
9371-
os << ".pArgMemobjList = ";
9425+
os << ".pArgMemobjList = {";
9426+
for (size_t i = 0; (params.pArgMemobjList) != NULL && i < params.numMemobjArgs; ++i) {
9427+
if (i != 0) {
9428+
os << ", ";
9429+
}
93729430

9373-
ur::details::printPtr(os,
9374-
(params.pArgMemobjList));
9431+
os << ((params.pArgMemobjList))[i];
9432+
}
9433+
os << "}";
93759434

93769435
os << ", ";
9377-
os << ".pArgPointerList = ";
9436+
os << ".pArgPointerList = {";
9437+
for (size_t i = 0; (params.pArgPointerList) != NULL && i < params.numPointerArgs; ++i) {
9438+
if (i != 0) {
9439+
os << ", ";
9440+
}
93789441

9379-
ur::details::printPtr(os,
9380-
(params.pArgPointerList));
9442+
os << ((params.pArgPointerList))[i];
9443+
}
9444+
os << "}";
9445+
9446+
os << ", ";
9447+
os << ".pArgValueList = {";
9448+
for (size_t i = 0; (params.pArgValueList) != NULL && i < params.numValueArgs; ++i) {
9449+
if (i != 0) {
9450+
os << ", ";
9451+
}
9452+
9453+
os << ((params.pArgValueList))[i];
9454+
}
9455+
os << "}";
93819456

93829457
os << ", ";
93839458
os << ".pArgExecInfoList = ";
@@ -9386,22 +9461,37 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_command_bu
93869461
(params.pArgExecInfoList));
93879462

93889463
os << ", ";
9389-
os << ".pGlobalWorkOffset = ";
9464+
os << ".pGlobalWorkOffset = {";
9465+
for (size_t i = 0; (params.pGlobalWorkOffset) != NULL && i < params.workDim; ++i) {
9466+
if (i != 0) {
9467+
os << ", ";
9468+
}
93909469

9391-
ur::details::printPtr(os,
9392-
(params.pGlobalWorkOffset));
9470+
os << ((params.pGlobalWorkOffset))[i];
9471+
}
9472+
os << "}";
93939473

93949474
os << ", ";
9395-
os << ".pGlobalWorkSize = ";
9475+
os << ".pGlobalWorkSize = {";
9476+
for (size_t i = 0; (params.pGlobalWorkSize) != NULL && i < params.workDim; ++i) {
9477+
if (i != 0) {
9478+
os << ", ";
9479+
}
93969480

9397-
ur::details::printPtr(os,
9398-
(params.pGlobalWorkSize));
9481+
os << ((params.pGlobalWorkSize))[i];
9482+
}
9483+
os << "}";
93999484

94009485
os << ", ";
9401-
os << ".pLocalWorkSize = ";
9486+
os << ".pLocalWorkSize = {";
9487+
for (size_t i = 0; (params.pLocalWorkSize) != NULL && i < params.workDim; ++i) {
9488+
if (i != 0) {
9489+
os << ", ";
9490+
}
94029491

9403-
ur::details::printPtr(os,
9404-
(params.pLocalWorkSize));
9492+
os << ((params.pLocalWorkSize))[i];
9493+
}
9494+
os << "}";
94059495

94069496
os << "}";
94079497
return os;

scripts/core/EXP-COMMAND-BUFFER.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ support updating the configuration of kernel commands recorded to a
165165
command-buffer. Support of this is reported by returning true in the
166166
${X}_DEVICE_INFO_COMMAND_BUFFER_UPDATE_SUPPORT_EXP query.
167167

168-
Updating a kernel commands is done by passing the new kernel configuration
168+
Updating kernel commands is done by passing the new kernel configuration
169169
to ${x}CommandBufferUpdateKernelLaunchExp along with the command handle of
170170
the kernel command to update. Configurations that can be changed are the
171171
kernels ND-Range and parameters.
@@ -178,11 +178,12 @@ kernels ND-Range and parameters.
178178
nullptr,
179179
true
180180
};
181-
${x}_exp_command_buffer_command_handle_t handle;
181+
${x}_exp_command_buffer_handle_t hCommandBuffer;
182182
${x}CommandBufferCreateExp(hContext, hDevice, &desc, &handle);
183183
184184
// Append a kernel command which has two buffer parameters, an input
185185
// and an output.
186+
${x}_exp_command_buffer_command_handle_t handle;
186187
${x}CommandBufferAppendKernelLaunchExp(hCommandBuffer, hKernel, workDim,
187188
pGlobalWorkOffset, pGlobalWorkSize,
188189
pLocalWorkSize, 0, nullptr,
@@ -193,7 +194,7 @@ kernels ND-Range and parameters.
193194
194195
// Define kernel argument at index 0 to be a new input buffer object
195196
${x}_exp_command_buffer_update_memobj_arg_desc_t newInputArg {
196-
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_MEMOBJ_ARG, // stype
197+
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_MEMOBJ_ARG_DESC, // stype
197198
nullptr, // pNext,
198199
0, // argIndex,
199200
nullptr, // pProperties
@@ -202,7 +203,7 @@ kernels ND-Range and parameters.
202203
203204
// Define kernel argument at index 1 to be a new output buffer object
204205
${x}_exp_command_buffer_update_memobj_arg_desc_t newOutputArg {
205-
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_MEMOBJ_ARG, // stype
206+
UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_MEMOBJ_ARG_DESC, // stype
206207
nullptr, // pNext,
207208
1, // argIndex,
208209
nullptr, // pProperties
@@ -216,10 +217,12 @@ kernels ND-Range and parameters.
216217
nullptr, // pNext
217218
2, // numMemobjArgs
218219
0, // numPointerArgs
220+
0, // numValueArgs
219221
0, // numExecInfos
220222
0, // workDim;
221223
new_args, // pArgMemobjList
222224
nullptr, // pArgPointerList
225+
nullptr, // pArgValueList
223226
nullptr, // pArgExecInfoList
224227
nullptr, // pGlobalWorkOffset
225228
nullptr, // pGlobalWorkSize
@@ -331,3 +334,4 @@ Contributors
331334
332335
333336
* Maxime France-Pillois `[email protected] <[email protected]>`_
337+

0 commit comments

Comments
 (0)