Skip to content

Commit

Permalink
[UR] Include overloads for complete types
Browse files Browse the repository at this point in the history
  • Loading branch information
Petr Vesely committed Aug 8, 2023
1 parent cfa3744 commit 01f2f92
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 1 deletion.
13 changes: 13 additions & 0 deletions scripts/templates/params.hpp.mako
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,19 @@ template <typename T> inline void serializeTagged(std::ostream &os, const void *
%endfor
} // namespace ${x}_params

## TODO - should be removed as part of #789
#ifdef UR_INCLUDE_HANDLE_IMPLEMENTATION_OVERLOADS
%for spec in specs:
%for obj in spec['objects']:
%if re.match(r"handle", obj['type']):
inline std::ostream &operator<<(std::ostream &os, const struct ${th.make_type_name(n, tags, obj)}_ &){
return os;
}
%endif
%endfor
%endfor
#endif

%for spec in specs:
%for obj in spec['objects']:
## ENUM #######################################################################
Expand Down
76 changes: 76 additions & 0 deletions source/common/ur_params.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,82 @@ inline void serializeTagged(std::ostream &os, const void *ptr,

} // namespace ur_params

#ifdef UR_INCLUDE_HANDLE_IMPLEMENTATION_OVERLOADS
inline std::ostream &operator<<(std::ostream &os,
const struct ur_adapter_handle_t_ &) {
return os;
}
inline std::ostream &operator<<(std::ostream &os,
const struct ur_platform_handle_t_ &) {
return os;
}
inline std::ostream &operator<<(std::ostream &os,
const struct ur_device_handle_t_ &) {
return os;
}
inline std::ostream &operator<<(std::ostream &os,
const struct ur_context_handle_t_ &) {
return os;
}
inline std::ostream &operator<<(std::ostream &os,
const struct ur_event_handle_t_ &) {
return os;
}
inline std::ostream &operator<<(std::ostream &os,
const struct ur_program_handle_t_ &) {
return os;
}
inline std::ostream &operator<<(std::ostream &os,
const struct ur_kernel_handle_t_ &) {
return os;
}
inline std::ostream &operator<<(std::ostream &os,
const struct ur_queue_handle_t_ &) {
return os;
}
inline std::ostream &operator<<(std::ostream &os,
const struct ur_native_handle_t_ &) {
return os;
}
inline std::ostream &operator<<(std::ostream &os,
const struct ur_sampler_handle_t_ &) {
return os;
}
inline std::ostream &operator<<(std::ostream &os,
const struct ur_mem_handle_t_ &) {
return os;
}
inline std::ostream &operator<<(std::ostream &os,
const struct ur_physical_mem_handle_t_ &) {
return os;
}
inline std::ostream &operator<<(std::ostream &os,
const struct ur_usm_pool_handle_t_ &) {
return os;
}
inline std::ostream &operator<<(std::ostream &os,
const struct ur_exp_image_handle_t_ &) {
return os;
}
inline std::ostream &operator<<(std::ostream &os,
const struct ur_exp_image_mem_handle_t_ &) {
return os;
}
inline std::ostream &operator<<(std::ostream &os,
const struct ur_exp_interop_mem_handle_t_ &) {
return os;
}
inline std::ostream &
operator<<(std::ostream &os,
const struct ur_exp_interop_semaphore_handle_t_ &) {
return os;
}
inline std::ostream &
operator<<(std::ostream &os, const struct ur_exp_command_buffer_handle_t_ &) {
return os;
}
#endif

inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value);
inline std::ostream &operator<<(std::ostream &os,
enum ur_structure_type_t value);
Expand Down
4 changes: 3 additions & 1 deletion test/conformance/adapters/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

add_conformance_test_with_devices_environment(adapter-cuda
cuda_fixtures.h
cuda_context_tests.cpp
context_tests.cpp
cuda_urContextGetNativeHandle.cpp
cuda_urDeviceGetNativeHandle.cpp
cuda_urDeviceCreateWithNativeHandle.cpp
Expand All @@ -16,6 +16,8 @@ add_conformance_test_with_devices_environment(adapter-cuda
)
target_link_libraries(test-adapter-cuda PRIVATE cudadrv ur_adapter_cuda)
target_include_directories(test-adapter-cuda PRIVATE ${CUDA_DIR} "${CUDA_DIR}/../../../" )
# TODO - remove as part of #789
target_compile_definitions(test-adapter-cuda PRIVATE UR_INCLUDE_HANDLE_IMPLEMENTATION_OVERLOADS)

set_tests_properties(adapter-cuda PROPERTIES
LABELS "conformance:cuda"
Expand Down

0 comments on commit 01f2f92

Please sign in to comment.