|
23 | 23 |
|
24 | 24 | #if _CCCL_HAS_CTK() && !_CCCL_COMPILER(NVRTC) |
25 | 25 |
|
| 26 | +# include <cuda/std/__bit/bit_cast.h> |
26 | 27 | # include <cuda/std/__cstddef/types.h> |
27 | 28 | # include <cuda/std/__exception/cuda_error.h> |
28 | 29 | # include <cuda/std/__host_stdlib/stdexcept> |
@@ -348,20 +349,23 @@ _CCCL_HOST_API void __memsetAsync(void* __dst, _Tp __value, ::cuda::std::size_t |
348 | 349 | if constexpr (sizeof(_Tp) == 1) |
349 | 350 | { |
350 | 351 | static auto __driver_fn = _CCCLRT_GET_DRIVER_FUNCTION(cuMemsetD8Async); |
| 352 | + auto __bits = ::cuda::std::bit_cast<unsigned char>(__value); |
351 | 353 | ::cuda::__driver::__call_driver_fn( |
352 | | - __driver_fn, "Failed to perform a memset", reinterpret_cast<::CUdeviceptr>(__dst), __value, __count, __stream); |
| 354 | + __driver_fn, "Failed to perform a memset", reinterpret_cast<::CUdeviceptr>(__dst), __bits, __count, __stream); |
353 | 355 | } |
354 | 356 | else if constexpr (sizeof(_Tp) == 2) |
355 | 357 | { |
356 | 358 | static auto __driver_fn = _CCCLRT_GET_DRIVER_FUNCTION(cuMemsetD16Async); |
| 359 | + auto __bits = ::cuda::std::bit_cast<unsigned short>(__value); |
357 | 360 | ::cuda::__driver::__call_driver_fn( |
358 | | - __driver_fn, "Failed to perform a memset", reinterpret_cast<::CUdeviceptr>(__dst), __value, __count, __stream); |
| 361 | + __driver_fn, "Failed to perform a memset", reinterpret_cast<::CUdeviceptr>(__dst), __bits, __count, __stream); |
359 | 362 | } |
360 | 363 | else if constexpr (sizeof(_Tp) == 4) |
361 | 364 | { |
362 | 365 | static auto __driver_fn = _CCCLRT_GET_DRIVER_FUNCTION(cuMemsetD32Async); |
| 366 | + auto __bits = ::cuda::std::bit_cast<unsigned int>(__value); |
363 | 367 | ::cuda::__driver::__call_driver_fn( |
364 | | - __driver_fn, "Failed to perform a memset", reinterpret_cast<::CUdeviceptr>(__dst), __value, __count, __stream); |
| 368 | + __driver_fn, "Failed to perform a memset", reinterpret_cast<::CUdeviceptr>(__dst), __bits, __count, __stream); |
365 | 369 | } |
366 | 370 | else |
367 | 371 | { |
|
0 commit comments