Repository navigation
Description
Is this a duplicate?
- I confirmed there appear to be no duplicate issues for this bug and that I agree to the Code of Conduct
Type of Bug
Compile-time Error
Component
libcu++
Describe the bug
Trying to replace thrust::make_discard_iterator() with cuda::make_discard_iterator() in libcudf found 2 places where the replacement results in a compile error. Partial output:
/opt/compiler-explorer/cuda/13.1.1/bin/../targets/x86_64-linux/include/cccl/cuda/std/__tuple_dir/sfinae_helpers.h(221): error: incomplete type "thrust::THRUST_300104_SM_750_NS::detail::it_value_t<cuda::__4::discard_iterator>" (aka "void") is not allowed
_Tp __dummy;
^
detected during:
instantiation of class "cuda::std::__4::_TestSynthesizeAssignment<_Tp> [with _Tp=cuda::__4::discard_iterator::value_type]" at line 41 of /opt/compiler-explorer/cuda/13.1.1/bin/../targets/x86_64-linux/include/cccl/cuda/std/__type_traits/is_assignable.h
instantiation of class "cuda::std::__4::is_assignable<_T1, _T2> [with _T1=cuda::std::__4::_TestSynthesizeAssignment<cuda::__4::discard_iterator::value_type> &, _T2=const cuda::std::__4::_TestSynthesizeAssignment<cuda::__4::discard_iterator::value_type> &]" at line 33 of /opt/compiler-explorer/cuda/13.1.1/bin/../targets/x86_64-linux/include/cccl/cuda/std/__type_traits/is_copy_assignable.h
instantiation of class "cuda::std::__4::is_copy_assignable<_Tp> [with _Tp=cuda::std::__4::_TestSynthesizeAssignment<cuda::__4::discard_iterator::value_type>]" at line 37 of /opt/compiler-explorer/cuda/13.1.1/bin/../targets/x86_64-linux/include/cccl/cuda/std/__type_traits/is_copy_assignable.h
instantiation of "const __nv_bool cuda::std::__4::is_copy_assignable_v [with _Tp=cuda::std::__4::_TestSynthesizeAssignment<cuda::__4::discard_iterator::value_type>]" at line 226
instantiation of "const __nv_bool cuda::std::__4::__must_synthesize_assignment_v [with _Tp=cuda::__4::discard_iterator::value_type]" at line 218 of /opt/compiler-explorer/cuda/13.1.1/bin/../targets/x86_64-linux/include/cccl/cuda/std/detail/libcxx/include/tuple
[ 7 instantiation contexts not shown ]
instantiation of class "cub::CUB_300104_SM_750::DispatchScan<InputIteratorT, OutputIteratorT, ScanOpT, InitValueT, OffsetT, AccumT, EnforceInclusive, PolicyHub, KernelSource, KernelLauncherFactory> [with InputIteratorT=thrust::THRUST_300104_SM_750_NS::zip_iterator<cuda::std::__4::tuple<thrust::THRUST_300104_SM_750_NS::counting_iterator<int, thrust::THRUST_300104_SM_750_NS::use_default, thrust::THRUST_300104_SM_750_NS::use_default, thrust::THRUST_300104_SM_750_NS::use_default, thrust::THRUST_300104_SM_750_NS::compile_time_value<1>>, thrust::THRUST_300104_SM_750_NS::detail::normal_iterator<thrust::THRUST_300104_SM_750_NS::device_ptr<__nv_bool>>>>, OutputIteratorT=thrust::THRUST_300104_SM_750_NS::zip_iterator<cuda::std::__4::tuple<thrust::THRUST_300104_SM_750_NS::detail::normal_iterator<thrust::THRUST_300104_SM_750_NS::device_ptr<int>>, cuda::__4::discard_iterator>>, ScanOpT=functor, InitValueT=cub::CUB_300104_SM_750::NullType, OffsetT=uint32_t, AccumT=idx_valid_pair_t, EnforceInclusive=cub::CUB_300104_SM_750::ForceInclusive::No, PolicyHub=cub::CUB_300104_SM_750::detail::scan::policy_hub<idx_valid_pair_t, cuda::std::__4::tuple<int, cuda::__4::discard_iterator::value_type>, idx_valid_pair_t, uint32_t, functor>, KernelSource=cub::CUB_300104_SM_750::detail::scan::DeviceScanKernelSource<cub::CUB_300104_SM_750::detail::scan::policy_hub<idx_valid_pair_t, cuda::std::__4::tuple<int, cuda::__4::discard_iterator::value_type>, idx_valid_pair_t, uint32_t, functor>::Policy1000, thrust::THRUST_300104_SM_750_NS::zip_iterator<cuda::std::__4::tuple<thrust::THRUST_300104_SM_750_NS::counting_iterator<int, thrust::THRUST_300104_SM_750_NS::use_default, thrust::THRUST_300104_SM_750_NS::use_default, thrust::THRUST_300104_SM_750_NS::use_default, thrust::THRUST_300104_SM_750_NS::compile_time_value<1>>, thrust::THRUST_300104_SM_750_NS::detail::normal_iterator<thrust::THRUST_300104_SM_750_NS::device_ptr<__nv_bool>>>>, thrust::THRUST_300104_SM_750_NS::zip_iterator<cuda::std::__4::tuple<thrust::THRUST_300104_SM_750_NS::detail::normal_iterator<thrust::THRUST_300104_SM_750_NS::device_ptr<int>>, cuda::__4::discard_iterator>>, functor, cub::CUB_300104_SM_750::NullType, uint32_t, idx_valid_pair_t, cub::CUB_300104_SM_750::ForceInclusive::No>, KernelLauncherFactory=cub::CUB_300104_SM_750::detail::TripleChevronFactory]" at line 82 of /opt/compiler-explorer/cuda/13.1.1/bin/../targets/x86_64-linux/include/cccl/thrust/system/cuda/detail/scan.h
instantiation of "OutputIt thrust::THRUST_300104_SM_750_NS::cuda_cub::detail::inclusive_scan_n_impl(thrust::THRUST_300104_SM_750_NS::cuda_cub::execution_policy<Derived> &, InputIt, Size, OutputIt, ScanOp) [with Derived=thrust::THRUST_300104_SM_750_NS::cuda_cub::par_t, InputIt=thrust::THRUST_300104_SM_750_NS::zip_iterator<cuda::std::__4::tuple<thrust::THRUST_300104_SM_750_NS::counting_iterator<int, thrust::THRUST_300104_SM_750_NS::use_default, thrust::THRUST_300104_SM_750_NS::use_default, thrust::THRUST_300104_SM_750_NS::use_default, thrust::THRUST_300104_SM_750_NS::compile_time_value<1>>, thrust::THRUST_300104_SM_750_NS::detail::normal_iterator<thrust::THRUST_300104_SM_750_NS::device_ptr<__nv_bool>>>>, Size=intmax_t, OutputIt=thrust::THRUST_300104_SM_750_NS::zip_iterator<cuda::std::__4::tuple<thrust::THRUST_300104_SM_750_NS::detail::normal_iterator<thrust::THRUST_300104_SM_750_NS::device_ptr<int>>, cuda::__4::discard_iterator>>, ScanOp=functor]" at line 255 of /opt/compiler-explorer/cuda/13.1.1/bin/../targets/x86_64-linux/include/cccl/thrust/system/cuda/detail/scan.h
instantiation of "OutputIt thrust::THRUST_300104_SM_750_NS::cuda_cub::inclusive_scan_n(thrust::THRUST_300104_SM_750_NS::cuda_cub::execution_policy<Derived> &, InputIt, Size, OutputIt, ScanOp) [with Derived=thrust::THRUST_300104_SM_750_NS::cuda_cub::par_t, InputIt=thrust::THRUST_300104_SM_750_NS::zip_iterator<cuda::std::__4::tuple<thrust::THRUST_300104_SM_750_NS::counting_iterator<int, thrust::THRUST_300104_SM_750_NS::use_default, thrust::THRUST_300104_SM_750_NS::use_default, thrust::THRUST_300104_SM_750_NS::use_default, thrust::THRUST_300104_SM_750_NS::compile_time_value<1>>, thrust::THRUST_300104_SM_750_NS::detail::normal_iterator<thrust::THRUST_300104_SM_750_NS::device_ptr<__nv_bool>>>>, Size=intmax_t, OutputIt=thrust::THRUST_300104_SM_750_NS::zip_iterator<cuda::std::__4::tuple<thrust::THRUST_300104_SM_750_NS::detail::normal_iterator<thrust::THRUST_300104_SM_750_NS::device_ptr<int>>, cuda::__4::discard_iterator>>, ScanOp=functor]" at line 267 of /opt/compiler-explorer/cuda/13.1.1/bin/../targets/x86_64-linux/include/cccl/thrust/system/cuda/detail/scan.h
instantiation of "OutputIt thrust::THRUST_300104_SM_750_NS::cuda_cub::inclusive_scan(thrust::THRUST_300104_SM_750_NS::cuda_cub::execution_policy<Derived> &, InputIt, InputIt, OutputIt, ScanOp) [with Derived=thrust::THRUST_300104_SM_750_NS::cuda_cub::par_t, InputIt=thrust::THRUST_300104_SM_750_NS::zip_iterator<cuda::std::__4::tuple<thrust::THRUST_300104_SM_750_NS::counting_iterator<int, thrust::THRUST_300104_SM_750_NS::use_default, thrust::THRUST_300104_SM_750_NS::use_default, thrust::THRUST_300104_SM_750_NS::use_default, thrust::THRUST_300104_SM_750_NS::compile_time_value<1>>, thrust::THRUST_300104_SM_750_NS::detail::normal_iterator<thrust::THRUST_300104_SM_750_NS::device_ptr<__nv_bool>>>>, OutputIt=thrust::THRUST_300104_SM_750_NS::zip_iterator<cuda::std::__4::tuple<thrust::THRUST_300104_SM_750_NS::detail::normal_iterator<thrust::THRUST_300104_SM_750_NS::device_ptr<int>>, cuda::__4::discard_iterator>>, ScanOp=functor]" at line 62 of /opt/compiler-explorer/cuda/13.1.1/bin/../targets/x86_64-linux/include/cccl/thrust/detail/scan.inl
instantiation of "OutputIterator thrust::THRUST_300104_SM_750_NS::inclusive_scan(const thrust::THRUST_300104_SM_750_NS::detail::execution_policy_base<DerivedPolicy> &, InputIterator, InputIterator, OutputIterator, AssociativeOperator) [with DerivedPolicy=thrust::THRUST_300104_SM_750_NS::cuda_cub::par_t, InputIterator=thrust::THRUST_300104_SM_750_NS::zip_iterator<cuda::std::__4::tuple<thrust::THRUST_300104_SM_750_NS::counting_iterator<int, thrust::THRUST_300104_SM_750_NS::use_default, thrust::THRUST_300104_SM_750_NS::use_default, thrust::THRUST_300104_SM_750_NS::use_default, thrust::THRUST_300104_SM_750_NS::compile_time_value<1>>, thrust::THRUST_300104_SM_750_NS::detail::normal_iterator<thrust::THRUST_300104_SM_750_NS::device_ptr<__nv_bool>>>>, OutputIterator=thrust::THRUST_300104_SM_750_NS::zip_iterator<cuda::std::__4::tuple<thrust::THRUST_300104_SM_750_NS::detail::normal_iterator<thrust::THRUST_300104_SM_750_NS::device_ptr<int>>, cuda::__4::discard_iterator>>, AssociativeOperator=functor]" at line 38 of <source>
The first is in thrust::inclusive_scan using the following logic:
https://github.com/rapidsai/cudf/blob/12c0ca23f0487e3eaf051cbcaf0a28067b61c459/cpp/src/replace/nulls.cu#L278-L286
The 2nd is similar using thrust::inclusive_scan_by_key()
https://github.com/rapidsai/cudf/blob/12c0ca23f0487e3eaf051cbcaf0a28067b61c459/cpp/src/groupby/sort/group_replace_nulls.cu#L38-L62
How to Reproduce
A standalone reproducer is available in this link: https://godbolt.org/z/qcs6obhGf
The line 14 #if 0 can be replaced with #if 1 to see the compile succeed with thrust::make_discard_iterator()
Expected behavior
Expected the replacement to work of course. Let use know if this is a permanent limitation and we can try to create a workaround.
Reproduction link
https://godbolt.org/z/qcs6obhGf
Operating System
No response
nvidia-smi output
No response
NVCC version
No response
Activity
miscco commentedon Feb 24, 2026
Urgh this is bad, need to give it a look
Change thrust::make_discard_iterator to cuda::make_discard_iterator (#…
Make `cuda::zip_iterator` work with proxy iterators
Make `cuda::zip_iterator` work with proxy iterators
Make `cuda::zip_iterator` work with proxy iterators (#7787)
Make `cuda::zip_iterator` work with proxy iterators (NVIDIA#7787)
[Backport 3.3] #7787 and #7738 (#7800)
davidwendt commentedon Apr 13, 2026
I'm still seeing this error with 3.4
Or maybe it is a new error?
I reproduced by copying the godbolt linked code to a standalone .cu file and used the following to compile it
davidwendt commentedon Apr 14, 2026
I don't have permission to reopen this issue. Should I copy this to create a new one?
miscco commentedon Apr 14, 2026
@davidwendt reopened, will investigate later this week
miscco commentedon May 6, 2026
I believe this should also be fixed by #8845
miscco commentedon May 6, 2026
I believe this has been fixed with #8845