Skip to content

Commit

Permalink
[L0 v2] implement urMemGetInfo
Browse files Browse the repository at this point in the history
and make failures for urMemImage optional.

There is no image support on PVC, and those tests
won't be run.
  • Loading branch information
igchor committed Oct 7, 2024
1 parent 0678778 commit f369220
Show file tree
Hide file tree
Showing 5 changed files with 299 additions and 306 deletions.
7 changes: 0 additions & 7 deletions source/adapters/level_zero/v2/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,6 @@ ur_result_t urMemImageCreateWithNativeHandle(
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
}

ur_result_t urMemGetInfo(ur_mem_handle_t hMemory, ur_mem_info_t propName,
size_t propSize, void *pPropValue,
size_t *pPropSizeRet) {
logger::error("{} function not implemented!", __FUNCTION__);
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
}

ur_result_t urMemImageGetInfo(ur_mem_handle_t hMemory, ur_image_info_t propName,
size_t propSize, void *pPropValue,
size_t *pPropSizeRet) {
Expand Down
22 changes: 22 additions & 0 deletions source/adapters/level_zero/v2/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,28 @@ ur_result_t urMemBufferCreateWithNativeHandle(
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
}

ur_result_t urMemGetInfo(ur_mem_handle_t hMemory, ur_mem_info_t propName,
size_t propSize, void *pPropValue,
size_t *pPropSizeRet) {
std::shared_lock<ur_shared_mutex> Lock(hMemory->Mutex);
UrReturnHelper returnValue(propSize, pPropValue, pPropSizeRet);

switch (propName) {
case UR_MEM_INFO_CONTEXT: {
return returnValue(hMemory->getContext());
}
case UR_MEM_INFO_SIZE: {
// Get size of the allocation
return returnValue(size_t{hMemory->getSize()});
}
default: {
return UR_RESULT_ERROR_INVALID_ENUMERATION;
}
}

return UR_RESULT_SUCCESS;
}

ur_result_t urMemRetain(ur_mem_handle_t hMem) {
hMem->RefCount.increment();
return UR_RESULT_SUCCESS;
Expand Down
1 change: 1 addition & 0 deletions source/adapters/level_zero/v2/memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ struct ur_mem_handle_t_ : _ur_object {
virtual void *getPtr(ur_device_handle_t) = 0;

inline size_t getSize() { return size; }
inline ur_context_handle_t getContext() { return hContext; }

protected:
const ur_context_handle_t hContext;
Expand Down
19 changes: 0 additions & 19 deletions test/conformance/enqueue/enqueue_adapter_level_zero_v2.match
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ urEnqueueMemBufferCopyRectTestWithParam.Success/Intel_R__oneAPI_Unified_Runtime_
urEnqueueMemBufferCopyRectTestWithParam.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___copy_3d_with_offsets
urEnqueueMemBufferCopyRectTestWithParam.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___copy_2d_3d
urEnqueueMemBufferCopyRectTestWithParam.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___copy_3d_2d
urEnqueueMemBufferCopyRectTest.InvalidSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
urEnqueueMemBufferMapTestWithParam.SuccessRead/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___1024_UR_MEM_FLAG_READ_WRITE
urEnqueueMemBufferMapTestWithParam.SuccessRead/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___2500_UR_MEM_FLAG_READ_WRITE
urEnqueueMemBufferMapTestWithParam.SuccessRead/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___4096_UR_MEM_FLAG_READ_WRITE
Expand Down Expand Up @@ -115,22 +114,6 @@ urEnqueueMemBufferMapTestWithParam.SuccessMultiMaps/Intel_R__oneAPI_Unified_Runt
urEnqueueMemBufferMapTestWithParam.SuccessMultiMaps/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___2500_UR_MEM_FLAG_ALLOC_HOST_POINTER
urEnqueueMemBufferMapTestWithParam.SuccessMultiMaps/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___4096_UR_MEM_FLAG_ALLOC_HOST_POINTER
urEnqueueMemBufferMapTestWithParam.SuccessMultiMaps/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___6000_UR_MEM_FLAG_ALLOC_HOST_POINTER
urEnqueueMemBufferMapTestWithParam.InvalidSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___1024_UR_MEM_FLAG_READ_WRITE
urEnqueueMemBufferMapTestWithParam.InvalidSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___2500_UR_MEM_FLAG_READ_WRITE
urEnqueueMemBufferMapTestWithParam.InvalidSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___4096_UR_MEM_FLAG_READ_WRITE
urEnqueueMemBufferMapTestWithParam.InvalidSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___6000_UR_MEM_FLAG_READ_WRITE
urEnqueueMemBufferMapTestWithParam.InvalidSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___1024_UR_MEM_FLAG_WRITE_ONLY
urEnqueueMemBufferMapTestWithParam.InvalidSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___2500_UR_MEM_FLAG_WRITE_ONLY
urEnqueueMemBufferMapTestWithParam.InvalidSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___4096_UR_MEM_FLAG_WRITE_ONLY
urEnqueueMemBufferMapTestWithParam.InvalidSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___6000_UR_MEM_FLAG_WRITE_ONLY
urEnqueueMemBufferMapTestWithParam.InvalidSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___1024_UR_MEM_FLAG_READ_ONLY
urEnqueueMemBufferMapTestWithParam.InvalidSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___2500_UR_MEM_FLAG_READ_ONLY
urEnqueueMemBufferMapTestWithParam.InvalidSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___4096_UR_MEM_FLAG_READ_ONLY
urEnqueueMemBufferMapTestWithParam.InvalidSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___6000_UR_MEM_FLAG_READ_ONLY
urEnqueueMemBufferMapTestWithParam.InvalidSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___1024_UR_MEM_FLAG_ALLOC_HOST_POINTER
urEnqueueMemBufferMapTestWithParam.InvalidSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___2500_UR_MEM_FLAG_ALLOC_HOST_POINTER
urEnqueueMemBufferMapTestWithParam.InvalidSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___4096_UR_MEM_FLAG_ALLOC_HOST_POINTER
urEnqueueMemBufferMapTestWithParam.InvalidSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___6000_UR_MEM_FLAG_ALLOC_HOST_POINTER
urEnqueueMemBufferMapTestWithWriteFlagParam.SuccessWrite/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MAP_FLAG_WRITE
urEnqueueMemBufferMapTestWithWriteFlagParam.SuccessWrite/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MAP_FLAG_WRITE_INVALIDATE_REGION
urEnqueueMemBufferReadRectTestWithParam.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___write_whole_buffer_2D
Expand All @@ -142,7 +125,6 @@ urEnqueueMemBufferReadRectTestWithParam.Success/Intel_R__oneAPI_Unified_Runtime_
urEnqueueMemBufferReadRectTestWithParam.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___write_3d_with_offsets
urEnqueueMemBufferReadRectTestWithParam.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___write_2d_3d
urEnqueueMemBufferReadRectTestWithParam.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___write_3d_2d
urEnqueueMemBufferReadRectTest.InvalidSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
urEnqueueMemBufferWriteRectTestWithParam.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___write_whole_buffer_2D
urEnqueueMemBufferWriteRectTestWithParam.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___write_non_zero_offsets_2D
urEnqueueMemBufferWriteRectTestWithParam.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___write_different_buffer_sizes_2D
Expand All @@ -152,7 +134,6 @@ urEnqueueMemBufferWriteRectTestWithParam.Success/Intel_R__oneAPI_Unified_Runtime
urEnqueueMemBufferWriteRectTestWithParam.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___write_3d_with_offsets
urEnqueueMemBufferWriteRectTestWithParam.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___write_2d_3d
urEnqueueMemBufferWriteRectTestWithParam.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___write_3d_2d
urEnqueueMemBufferWriteRectTest.InvalidSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_
urEnqueueMemImageCopyTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___1D
urEnqueueMemImageCopyTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___2D
urEnqueueMemImageCopyTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___3D
Expand Down
Loading

0 comments on commit f369220

Please sign in to comment.