Skip to content

Commit

Permalink
[SYCLomatic] Update bindless image helper function to adopt compiler …
Browse files Browse the repository at this point in the history
…update on API.(#2074)


Signed-off-by: Tang, Jiajun [email protected]
  • Loading branch information
tangjj11 authored Jun 24, 2024
1 parent 3826ff2 commit 9c7be20
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions clang/runtime/dpct-rt/include/dpct/bindless_images.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ class image_mem_wrapper {
unsigned int num_levels = 1)
: _channel(channel),
_desc(sycl::ext::oneapi::experimental::image_descriptor(
#if (__SYCL_COMPILER_VERSION && __SYCL_COMPILER_VERSION < 20240527)
range, _channel.get_channel_order(), _channel.get_channel_type(),
type, num_levels)) {
type, num_levels
#endif
)) {
auto q = get_default_queue();
_handle = alloc_image_mem(_desc, q);
if (type == sycl::ext::oneapi::experimental::image_type::mipmap) {
Expand Down Expand Up @@ -130,7 +133,8 @@ inline image_mem_wrapper *&get_img_mem_map(

static inline size_t
get_ele_size(const sycl::ext::oneapi::experimental::image_descriptor &decs) {
size_t channel_num, channel_size;
size_t channel_num = 4, channel_size;
#if (__SYCL_COMPILER_VERSION && __SYCL_COMPILER_VERSION < 20240527)
switch (decs.channel_order) {
case sycl::image_channel_order::r:
channel_num = 1;
Expand All @@ -148,6 +152,7 @@ get_ele_size(const sycl::ext::oneapi::experimental::image_descriptor &decs) {
throw std::runtime_error("Unsupported channel_order in get_ele_size!");
break;
}
#endif
switch (decs.channel_type) {
case sycl::image_channel_type::signed_int8:
case sycl::image_channel_type::unsigned_int8:
Expand Down Expand Up @@ -346,8 +351,11 @@ create_bindless_image(image_data data, sampling_info info,
q.wait_and_throw();
#else
auto desc = sycl::ext::oneapi::experimental::image_descriptor(
#if (__SYCL_COMPILER_VERSION && __SYCL_COMPILER_VERSION < 20240527)
{data.get_x(), data.get_y()}, data.get_channel().get_channel_order(),
data.get_channel_type());
data.get_channel_type()
#endif
);
auto img = sycl::ext::oneapi::experimental::create_image(
data.get_data_ptr(), data.get_pitch(), samp, desc, q);
detail::get_img_mem_map(img) = nullptr;
Expand Down Expand Up @@ -472,8 +480,10 @@ template <class T, int dimensions> class bindless_image_wrapper {
q.wait_and_throw();
#else
auto desc = sycl::ext::oneapi::experimental::image_descriptor(
{width, height}, channel.get_channel_order(),
channel.get_channel_type());
#if (__SYCL_COMPILER_VERSION && __SYCL_COMPILER_VERSION < 20240527)
{width, height}, channel.get_channel_order(), channel.get_channel_type()
#endif
);
_img = sycl::ext::oneapi::experimental::create_image(data, pitch, samp,
desc, q);
detail::get_img_mem_map(_img) = nullptr;
Expand Down

0 comments on commit 9c7be20

Please sign in to comment.