Skip to content

Commit

Permalink
Change error to INVALID_OPERATION
Browse files Browse the repository at this point in the history
  • Loading branch information
hdelan committed Nov 14, 2024
1 parent f685bb3 commit 09b3a7c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 9 deletions.
3 changes: 1 addition & 2 deletions source/adapters/cuda/command_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,7 @@ urCommandBufferReleaseExp(ur_exp_command_buffer_handle_t hCommandBuffer) {

UR_APIEXPORT ur_result_t UR_APICALL
urCommandBufferFinalizeExp(ur_exp_command_buffer_handle_t hCommandBuffer) {
UR_ASSERT(!hCommandBuffer->IsFinalized,
UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP);
UR_ASSERT(!hCommandBuffer->IsFinalized, UR_RESULT_ERROR_INVALID_OPERATION);
try {
const unsigned long long flags = 0;
#if CUDA_VERSION >= 12000
Expand Down
3 changes: 1 addition & 2 deletions source/adapters/hip/command_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,7 @@ urCommandBufferReleaseExp(ur_exp_command_buffer_handle_t hCommandBuffer) {

UR_APIEXPORT ur_result_t UR_APICALL
urCommandBufferFinalizeExp(ur_exp_command_buffer_handle_t hCommandBuffer) {
UR_ASSERT(!hCommandBuffer->IsFinalized,
UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP);
UR_ASSERT(!hCommandBuffer->IsFinalized, UR_RESULT_ERROR_INVALID_OPERATION);
try {
const unsigned long long flags = 0;
UR_CHECK_ERROR(hipGraphInstantiateWithFlags(
Expand Down
3 changes: 1 addition & 2 deletions source/adapters/level_zero/command_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,7 @@ urCommandBufferReleaseExp(ur_exp_command_buffer_handle_t CommandBuffer) {
ur_result_t
urCommandBufferFinalizeExp(ur_exp_command_buffer_handle_t CommandBuffer) {
UR_ASSERT(CommandBuffer, UR_RESULT_ERROR_INVALID_NULL_POINTER);
UR_ASSERT(!CommandBuffer->IsFinalized,
UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP);
UR_ASSERT(!CommandBuffer->IsFinalized, UR_RESULT_ERROR_INVALID_OPERATION);
// It is not allowed to append to command list from multiple threads.
std::scoped_lock<ur_shared_mutex> Guard(CommandBuffer->Mutex);

Expand Down
3 changes: 1 addition & 2 deletions source/adapters/opencl/command_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ urCommandBufferReleaseExp(ur_exp_command_buffer_handle_t hCommandBuffer) {

UR_APIEXPORT ur_result_t UR_APICALL
urCommandBufferFinalizeExp(ur_exp_command_buffer_handle_t hCommandBuffer) {
UR_ASSERT(!hCommandBuffer->IsFinalized,
UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP);
UR_ASSERT(!hCommandBuffer->IsFinalized, UR_RESULT_ERROR_INVALID_OPERATION);
cl_context CLContext = cl_adapter::cast<cl_context>(hCommandBuffer->hContext);
cl_ext::clFinalizeCommandBufferKHR_fn clFinalizeCommandBufferKHR = nullptr;
UR_RETURN_ON_FAILURE(
Expand Down
2 changes: 1 addition & 1 deletion test/conformance/exp_command_buffer/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,6 @@ TEST_P(urCommandBufferAppendKernelLaunchExpTest, FinalizeTwice) {

ASSERT_SUCCESS(urCommandBufferFinalizeExp(cmd_buf_handle));
EXPECT_EQ_RESULT(urCommandBufferFinalizeExp(cmd_buf_handle),
UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP);
UR_RESULT_ERROR_INVALID_OPERATION);

}

0 comments on commit 09b3a7c

Please sign in to comment.