[BUG]: `thrust::partition` failed to compile on CUDA 12.2
- Dominant language
- C++
- Stars
- 2.5k
- Forks
- 486
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 295
Description
### Is this a duplicate?
- [X] I confirmed there appear to be no [duplicate issues](https://github.com/NVIDIA/cccl/issues) for this bug and that I agree to the [Code of Conduct](CODE_OF_CONDUCT.md)
### Type of Bug
Compile-time Error
### Component
Thrust
### Describe the bug
The following example
```cuda
#include
#include
#include
#include
__global__ void foo(int arr[], int n) {
thrust::partition(thrust::device, arr, arr + n,
[](int x) { return x % 2 == 1; });
}
int main(int argc, char *argv[]) {
thrust::device_vector vec;
for (int i = 0; i < 10; ++i) {
vec.push_back(i);
}
foo<<<1, 1>>>(vec.data().get(), vec.size());
cudaDeviceSynchronize();
return 0;
}
```
failed to compile and nvcc reported an odd error.
```
In file included from tmpxft_00228c92_00000000-6_a.cudafe1.stub.c:1:
/tmp/tmpxft_00228c92_00000000-6_a.cudafe1.stub.c:10:195: error: template argument 5 is invalid
10 | b::__partition::PartitionAgent ::ScanTil
eState _ZN6thrust8cuda_cub11__partition14PartitionAgentIPiPNS1_15no_stencil_tag_ES3_PNS1_18single_output_tag_EZ3fooS3_iEUliE_lPlE13ScanTileStateE;
| ^
/tmp/tmpxft_00228c92_00000000-6_a.cudafe1.stub.c:10:213: error: expected initializer before ‘_ZN6thrust8cuda_cub11__partition14PartitionAgentIPiPNS1_15no_stencil_tag_ES3_PNS1_18single_output
_tag_EZ3fooS3_iEUliE_lPlE13ScanTileStateE’
10 | rtitionAgent ::ScanTileState _ZN6thrust8
cuda_cub11__partition14PartitionAgentIPiPNS1_15no_stencil_tag_ES3_PNS1_18single_output_tag_EZ3fooS3_iEUliE_lPlE13ScanTileStateE;
| ^~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
where the 5th template argument is `::`.
### How to Reproduce
See above.
### Expected behavior
It compiles.
### Reproduction link
_No response_
### Operating System
Ubuntu 20.04
### nvidia-smi output
```
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.54.03 Driver Version: 535.54.03 CUDA Version: 12.2 |
|-----------------------------------------+----------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 NVIDIA A100-SXM4-80GB On | 00000000:07:00.0 Off | 0 |
| N/A 49C P0 158W / 400W | 16273MiB / 81920MiB | 100% Default |
| | | Disabled |
```
### NVCC version
```
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Tue_Jun_13_19:16:58_PDT_2023
Cuda compilation tools, release 12.2, V12.2.91
Build cuda_12.2.r12.2/compiler.32965470_0
```
Contributor guide
Assessment
This issue has not been assessed yet.