Skip to content

Commit

Permalink
Workaround for constexpr bug inside lambda in CUDA 11.8 (#671)
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffburdick authored Sep 10, 2024
1 parent 7b77354 commit 68ce299
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions include/matx/transforms/conv.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,24 @@ inline void matxFFTConv1DInternal(OutputType &o, const InType &i,

std::fill(std::begin(slice_start), std::end(slice_start), 0);
std::fill(std::begin(slice_end), std::end(slice_end), matxEnd);


#if (CUDART_VERSION <= 11080)
matx::tensor_t<complex_from_scalar_t<typename InType::scalar_type>, InType::Rank()> s1;
matx::tensor_t<complex_from_scalar_t<typename InType::scalar_type>, InType::Rank()> s2;
matx::tensor_t<complex_from_scalar_t<typename InType::scalar_type>, InType::Rank()> sifft;

if constexpr (is_cuda_executor_v<Executor>) {
make_tensor(s1, in_shape_padded, MATX_ASYNC_DEVICE_MEMORY, exec.getStream());
make_tensor(s2, in_shape_padded, MATX_ASYNC_DEVICE_MEMORY, exec.getStream());
make_tensor(sifft, in_shape_padded, MATX_ASYNC_DEVICE_MEMORY, exec.getStream());
}
else {
make_tensor(s1, in_shape_padded, MATX_HOST_MALLOC_MEMORY);
make_tensor(s2, in_shape_padded, MATX_HOST_MALLOC_MEMORY);
make_tensor(sifft, in_shape_padded, MATX_HOST_MALLOC_MEMORY);
}
#else
auto allocate_tensor = [&](auto shape) {
if constexpr (is_cuda_executor_v<Executor>) {
return make_tensor<complex_from_scalar_t<typename InType::value_type>>(shape, MATX_ASYNC_DEVICE_MEMORY, exec.getStream());
Expand All @@ -73,6 +90,7 @@ inline void matxFFTConv1DInternal(OutputType &o, const InType &i,
auto s1 = allocate_tensor(in_shape_padded);
auto s2 = allocate_tensor(in_shape_padded);
auto sifft = allocate_tensor(in_shape_padded);
#endif

if constexpr (! is_complex_v<typename InType::value_type>) {
slice_end[InType::Rank() - 1] = padded_size/2 + 1;
Expand Down

0 comments on commit 68ce299

Please sign in to comment.