Skip to content

Commit

Permalink
Fix Merge
Browse files Browse the repository at this point in the history
* Use convertToOpenCLType helper
  • Loading branch information
isaacault committed Feb 21, 2024
1 parent ddcb510 commit efd0fc5
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions sycl/include/sycl/detail/image_ocl_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,27 +85,23 @@ static RetType __invoke__ImageArrayRead(ImageT Img, CoordT Coords,

// Convert from sycl types to builtin types to get correct function mangling.
using TempRetT = sycl::detail::ConvertToOpenCLType_t<RetType>;
using TempArgT = sycl::detail::ConvertToOpenCLType_t<CoordT>;
auto TmpCoords = sycl::detail::convertToOpenCLType(Coords);

TempArgT Arg = sycl::detail::convertDataToType<CoordT, TempArgT>(Coords);
TempRetT Ret =
__spirv_ImageArrayRead<TempRetT, ImageT, TempArgT>(Img, Arg, ArrayLayer);
return sycl::detail::convertDataToType<TempRetT, RetType>(Ret);
return sycl::detail::convertFromOpenCLTypeFor<RetType>(
__spirv_ImageArrayRead<TempRetT, ImageT, decltype(TmpCoords)>(
Img, TmpCoords, ArrayLayer));
}

template <typename ImageT, typename CoordT, typename ValT>
static void __invoke__ImageArrayWrite(ImageT Img, CoordT Coords, int ArrayLayer,
ValT Val) {

// Convert from sycl types to builtin types to get correct function mangling.
using TmpValT = sycl::detail::ConvertToOpenCLType_t<ValT>;
using TmpCoordT = sycl::detail::ConvertToOpenCLType_t<CoordT>;

TmpCoordT TmpCoord =
sycl::detail::convertDataToType<CoordT, TmpCoordT>(Coords);
TmpValT TmpVal = sycl::detail::convertDataToType<ValT, TmpValT>(Val);
__spirv_ImageArrayWrite<ImageT, TmpCoordT, TmpValT>(Img, TmpCoord, ArrayLayer,
TmpVal);
auto TmpCoords = sycl::detail::convertToOpenCLType(Coords);
auto TmpVal = sycl::detail::convertToOpenCLType(Val);

__spirv_ImageArrayWrite<ImageT, decltype(TmpCoords), decltype(TmpVal)>(
Img, TmpCoords, ArrayLayer, TmpVal);
}

template <typename RetType, typename SmpImageT, typename CoordT>
Expand Down

0 comments on commit efd0fc5

Please sign in to comment.