Skip to content

Commit

Permalink
[L0 v2] implement support for images
Browse files Browse the repository at this point in the history
Use dynamic_cast to convert ur_mem_handle_t to
buffer or image. This is not ideal, but buffer and image
are pretty much separate entites that just happen to
share the same handle type. There is no shared impl
between buffer and image, expcept for a few lines in
urMemGetInfo.

Alternative to dynamic_cast and inheritance would be
to just use std::variant, but this is problematic since
ur_mem_buffer_t has subclasses and relies on polymorphic
behavior. Variant would have to hold pointers to buffer/image
adding one more indirection.
  • Loading branch information
igchor committed Jan 24, 2025
1 parent d6604c1 commit b4bbaf0
Show file tree
Hide file tree
Showing 30 changed files with 1,066 additions and 805 deletions.
4 changes: 4 additions & 0 deletions source/adapters/level_zero/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ if(UR_BUILD_ADAPTER_L0)
${CMAKE_CURRENT_SOURCE_DIR}/program.hpp
${CMAKE_CURRENT_SOURCE_DIR}/queue.hpp
${CMAKE_CURRENT_SOURCE_DIR}/sampler.hpp
${CMAKE_CURRENT_SOURCE_DIR}/helpers/image_helpers.hpp
${CMAKE_CURRENT_SOURCE_DIR}/helpers/kernel_helpers.hpp
${CMAKE_CURRENT_SOURCE_DIR}/helpers/memory_helpers.hpp
${CMAKE_CURRENT_SOURCE_DIR}/ur_level_zero.cpp
Expand All @@ -47,6 +48,7 @@ if(UR_BUILD_ADAPTER_L0)
${CMAKE_CURRENT_SOURCE_DIR}/sampler.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tensor_map.cpp
${CMAKE_CURRENT_SOURCE_DIR}/image.cpp
${CMAKE_CURRENT_SOURCE_DIR}/helpers/image_helpers.cpp
${CMAKE_CURRENT_SOURCE_DIR}/helpers/kernel_helpers.cpp
${CMAKE_CURRENT_SOURCE_DIR}/helpers/memory_helpers.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../ur/ur.cpp
Expand Down Expand Up @@ -129,6 +131,7 @@ if(UR_BUILD_ADAPTER_L0_V2)
${CMAKE_CURRENT_SOURCE_DIR}/platform.hpp
${CMAKE_CURRENT_SOURCE_DIR}/physical_mem.hpp
${CMAKE_CURRENT_SOURCE_DIR}/program.hpp
${CMAKE_CURRENT_SOURCE_DIR}/helpers/image_helpers.hpp
${CMAKE_CURRENT_SOURCE_DIR}/helpers/kernel_helpers.hpp
${CMAKE_CURRENT_SOURCE_DIR}/helpers/memory_helpers.hpp
${CMAKE_CURRENT_SOURCE_DIR}/adapter.cpp
Expand All @@ -138,6 +141,7 @@ if(UR_BUILD_ADAPTER_L0_V2)
${CMAKE_CURRENT_SOURCE_DIR}/platform.cpp
${CMAKE_CURRENT_SOURCE_DIR}/physical_mem.cpp
${CMAKE_CURRENT_SOURCE_DIR}/program.cpp
${CMAKE_CURRENT_SOURCE_DIR}/helpers/image_helpers.cpp
${CMAKE_CURRENT_SOURCE_DIR}/helpers/kernel_helpers.cpp
${CMAKE_CURRENT_SOURCE_DIR}/helpers/memory_helpers.cpp
${CMAKE_CURRENT_SOURCE_DIR}/usm_p2p.cpp
Expand Down
Loading

0 comments on commit b4bbaf0

Please sign in to comment.