Skip to content

Commit

Permalink
Add testing for new supported behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiomestre committed Sep 10, 2024
1 parent 4a64633 commit 9ff534c
Show file tree
Hide file tree
Showing 12 changed files with 180 additions and 135 deletions.
10 changes: 5 additions & 5 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -8286,10 +8286,8 @@ typedef struct ur_exp_command_buffer_update_kernel_launch_desc_t {
///< values that describe the number of global work-items.
size_t *pNewLocalWorkSize; ///< [in][optional][range(0, newWorkDim)] Array of newWorkDim unsigned
///< values that describe the number of work-items that make up a
///< work-group. If newWorkDim is non-zero and pNewLocalWorkSize is
///< nullptr, then runtime implementation will choose the work-group size.
///< If newWorkDim is zero and pNewLocalWorkSize is nullptr, then the local
///< work size is unchanged.
///< work-group. If pNewLocalWorkSize is nullptr, then the local work size
///< is unchanged.

} ur_exp_command_buffer_update_kernel_launch_desc_t;

Expand Down Expand Up @@ -8427,7 +8425,9 @@ urCommandBufferAppendKernelLaunchExp(
uint32_t workDim, ///< [in] Dimension of the kernel execution.
const size_t *pGlobalWorkOffset, ///< [in] Offset to use when executing kernel.
const size_t *pGlobalWorkSize, ///< [in] Global work size to use when executing kernel.
const size_t *pLocalWorkSize, ///< [in][optional] Local work size to use when executing kernel.
const size_t *pLocalWorkSize, ///< [in][optional] Local work size to use when executing kernel. If this
///< parameter is nullptr, then a local work size will be generated by the
///< implementation.
uint32_t numKernelAlternatives, ///< [in] The number of kernel alternatives provided in
///< phKernelAlternatives.
ur_kernel_handle_t *phKernelAlternatives, ///< [in][optional][range(0, numKernelAlternatives)] List of kernels
Expand Down
4 changes: 2 additions & 2 deletions scripts/core/exp-command-buffer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ members:
desc: "[in][optional][range(0, newWorkDim)] Array of newWorkDim unsigned values that describe the number of global work-items."
- type: "size_t*"
name: pNewLocalWorkSize
desc: "[in][optional][range(0, newWorkDim)] Array of newWorkDim unsigned values that describe the number of work-items that make up a work-group. If newWorkDim is non-zero and pNewLocalWorkSize is nullptr, then runtime implementation will choose the work-group size. If newWorkDim is zero and pNewLocalWorkSize is nullptr, then the local work size is unchanged."
desc: "[in][optional][range(0, newWorkDim)] Array of newWorkDim unsigned values that describe the number of work-items that make up a work-group. If pNewLocalWorkSize is nullptr, then the local work size is unchanged."
--- #--------------------------------------------------------------------------
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 Expand Up @@ -333,7 +333,7 @@ params:
desc: "[in] Global work size to use when executing kernel."
- type: "const size_t*"
name: pLocalWorkSize
desc: "[in][optional] Local work size to use when executing kernel."
desc: "[in][optional] Local work size to use when executing kernel. If this parameter is nullptr, then a local work size will be generated by the implementation."
- type: uint32_t
name: "numKernelAlternatives"
desc: "[in] The number of kernel alternatives provided in phKernelAlternatives."
Expand Down
4 changes: 3 additions & 1 deletion source/adapters/mock/ur_mockddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8349,7 +8349,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp(
const size_t *
pGlobalWorkSize, ///< [in] Global work size to use when executing kernel.
const size_t *
pLocalWorkSize, ///< [in][optional] Local work size to use when executing kernel.
pLocalWorkSize, ///< [in][optional] Local work size to use when executing kernel. If this
///< parameter is nullptr, then a local work size will be generated by the
///< implementation.
uint32_t
numKernelAlternatives, ///< [in] The number of kernel alternatives provided in
///< phKernelAlternatives.
Expand Down
4 changes: 3 additions & 1 deletion source/loader/layers/tracing/ur_trcddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6493,7 +6493,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp(
const size_t *
pGlobalWorkSize, ///< [in] Global work size to use when executing kernel.
const size_t *
pLocalWorkSize, ///< [in][optional] Local work size to use when executing kernel.
pLocalWorkSize, ///< [in][optional] Local work size to use when executing kernel. If this
///< parameter is nullptr, then a local work size will be generated by the
///< implementation.
uint32_t
numKernelAlternatives, ///< [in] The number of kernel alternatives provided in
///< phKernelAlternatives.
Expand Down
4 changes: 3 additions & 1 deletion source/loader/layers/validation/ur_valddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8054,7 +8054,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp(
const size_t *
pGlobalWorkSize, ///< [in] Global work size to use when executing kernel.
const size_t *
pLocalWorkSize, ///< [in][optional] Local work size to use when executing kernel.
pLocalWorkSize, ///< [in][optional] Local work size to use when executing kernel. If this
///< parameter is nullptr, then a local work size will be generated by the
///< implementation.
uint32_t
numKernelAlternatives, ///< [in] The number of kernel alternatives provided in
///< phKernelAlternatives.
Expand Down
4 changes: 3 additions & 1 deletion source/loader/ur_ldrddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7105,7 +7105,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp(
const size_t *
pGlobalWorkSize, ///< [in] Global work size to use when executing kernel.
const size_t *
pLocalWorkSize, ///< [in][optional] Local work size to use when executing kernel.
pLocalWorkSize, ///< [in][optional] Local work size to use when executing kernel. If this
///< parameter is nullptr, then a local work size will be generated by the
///< implementation.
uint32_t
numKernelAlternatives, ///< [in] The number of kernel alternatives provided in
///< phKernelAlternatives.
Expand Down
4 changes: 3 additions & 1 deletion source/loader/ur_libapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7544,7 +7544,9 @@ ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp(
const size_t *
pGlobalWorkSize, ///< [in] Global work size to use when executing kernel.
const size_t *
pLocalWorkSize, ///< [in][optional] Local work size to use when executing kernel.
pLocalWorkSize, ///< [in][optional] Local work size to use when executing kernel. If this
///< parameter is nullptr, then a local work size will be generated by the
///< implementation.
uint32_t
numKernelAlternatives, ///< [in] The number of kernel alternatives provided in
///< phKernelAlternatives.
Expand Down
4 changes: 3 additions & 1 deletion source/ur_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6400,7 +6400,9 @@ ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp(
const size_t *
pGlobalWorkSize, ///< [in] Global work size to use when executing kernel.
const size_t *
pLocalWorkSize, ///< [in][optional] Local work size to use when executing kernel.
pLocalWorkSize, ///< [in][optional] Local work size to use when executing kernel. If this
///< parameter is nullptr, then a local work size will be generated by the
///< implementation.
uint32_t
numKernelAlternatives, ///< [in] The number of kernel alternatives provided in
///< phKernelAlternatives.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
urCommandBufferKernelHandleUpdateTest.Success/AMD_HIP_BACKEND___{{.*}}_
urCommandBufferKernelHandleUpdateTest.UpdateAgain/AMD_HIP_BACKEND___{{.*}}_
urCommandBufferKernelHandleUpdateTest.KernelAlternativeNotRegistered/AMD_HIP_BACKEND___{{.*}}_
urCommandBufferKernelHandleUpdateTest.RegisterInvalidKernelAlternative/AMD_HIP_BACKEND___{{.*}}_
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
{{OPT}}InvalidUpdateTest.NotFinalizedCommandBuffer/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
{{OPT}}InvalidUpdateTest.NotUpdatableCommandBuffer/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
{{OPT}}InvalidUpdateTest.GlobalLocalSizeMistach/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
{{OPT}}InvalidUpdateTest.ImplToUserDefinedLocalSize/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
{{OPT}}InvalidUpdateTest.UserToImplDefinedLocalSize/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
{{OPT}}InvalidUpdateTest.InvalidDimensions/SYCL_NATIVE_CPU___SYCL_Native_CPU__X_
{{OPT}}USMFillCommandTest.UpdateParameters/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
{{OPT}}USMFillCommandTest.UpdateBeforeEnqueue/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
Expand All @@ -23,7 +21,8 @@
{{OPT}}NDRangeUpdateTest.Update3D/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
{{OPT}}NDRangeUpdateTest.Update2D/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
{{OPT}}NDRangeUpdateTest.Update1D/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
{{OPT}}NDRangeUpdateTest.Invalid/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
{{OPT}}NDRangeUpdateTest.ImplToUserDefinedLocalSize/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
{{OPT}}NDRangeUpdateTest.UserToImplDefinedLocalSize/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
{{OPT}}USMSaxpyKernelTest.UpdateParameters/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
{{OPT}}USMMultiSaxpyKernelTest.UpdateParameters/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
{{OPT}}USMMultiSaxpyKernelTest.UpdateWithoutBlocking/SYCL_NATIVE_CPU___SYCL_Native_CPU__{{.*}}
72 changes: 0 additions & 72 deletions test/conformance/exp_command_buffer/update/invalid_update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,77 +197,6 @@ TEST_P(InvalidUpdateTest, GlobalLocalSizeMistach) {
ASSERT_EQ(UR_RESULT_ERROR_INVALID_OPERATION, result);
}

//// Test setting `pNewLocalWorkSize` to a non-NULL value when the command was
//// created with a NULL local work size gives the correct error.
//TEST_P(InvalidUpdateTest, ImplToUserDefinedLocalSize) {
// // Append kernel command to command-buffer using NULL local work size
// ur_exp_command_buffer_command_handle_t second_command_handle = nullptr;
// ASSERT_SUCCESS(urCommandBufferAppendKernelLaunchExp(
// updatable_cmd_buf_handle, kernel, n_dimensions, &global_offset,
// &global_size, nullptr, 0, nullptr, 0, nullptr, nullptr,
// &second_command_handle));
// ASSERT_NE(second_command_handle, nullptr);
//
// EXPECT_SUCCESS(urCommandBufferFinalizeExp(updatable_cmd_buf_handle));
// finalized = true;
//
// size_t new_global_size = 64;
// size_t new_local_size = 16;
// ur_exp_command_buffer_update_kernel_launch_desc_t update_desc = {
// UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_DESC, // stype
// nullptr, // pNext
// kernel, // hNewKernel
// 0, // numNewMemObjArgs
// 0, // numNewPointerArgs
// 0, // numNewValueArgs
// n_dimensions, // newWorkDim
// nullptr, // pNewMemObjArgList
// nullptr, // pNewPointerArgList
// nullptr, // pNewValueArgList
// nullptr, // pNewGlobalWorkOffset
// &new_global_size, // pNewGlobalWorkSize
// &new_local_size, // pNewLocalWorkSize
// };
//
// // Update command local size to non-NULL when created with NULL value
// ur_result_t result = urCommandBufferUpdateKernelLaunchExp(
// second_command_handle, &update_desc);
// EXPECT_EQ(UR_RESULT_ERROR_INVALID_OPERATION, result);
//
// if (second_command_handle) {
// EXPECT_SUCCESS(urCommandBufferReleaseCommandExp(second_command_handle));
// }
//}

//// Test setting `pNewLocalWorkSize` to a NULL value when the command was
//// created with a non-NULL local work size gives the correct error.
//TEST_P(InvalidUpdateTest, UserToImplDefinedLocalSize) {
// ASSERT_SUCCESS(urCommandBufferFinalizeExp(updatable_cmd_buf_handle));
// finalized = true;
//
// size_t new_global_size = 64;
// ur_exp_command_buffer_update_kernel_launch_desc_t update_desc = {
// UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_DESC, // stype
// nullptr, // pNext
// kernel, // hNewKernel
// 0, // numNewMemObjArgs
// 0, // numNewPointerArgs
// 0, // numNewValueArgs
// n_dimensions, // newWorkDim
// nullptr, // pNewMemObjArgList
// nullptr, // pNewPointerArgList
// nullptr, // pNewValueArgList
// nullptr, // pNewGlobalWorkOffset
// &new_global_size, // pNewGlobalWorkSize
// nullptr, // pNewLocalWorkSize
// };
//
// // Update command local size to NULL when created with non-NULL value
// ur_result_t result =
// urCommandBufferUpdateKernelLaunchExp(command_handle, &update_desc);
// ASSERT_EQ(UR_RESULT_ERROR_INVALID_OPERATION, result);
//}

// If the kernel handle is not being updated, then it's invalid to change
// the number of dimensions.
TEST_P(InvalidUpdateTest, InvalidDimensions) {
Expand All @@ -291,7 +220,6 @@ TEST_P(InvalidUpdateTest, InvalidDimensions) {
nullptr, // pNewLocalWorkSize
};

// Update command local size to NULL when created with non-NULL value
ur_result_t result =
urCommandBufferUpdateKernelLaunchExp(command_handle, &update_desc);
ASSERT_EQ(UR_RESULT_ERROR_INVALID_OPERATION, result);
Expand Down
Loading

0 comments on commit 9ff534c

Please sign in to comment.