NVIDIA / NVIDIA/cccl

[BUG]: `reduce_by_key` fails with zip_iterator to const pointers

Open
#1,527 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.5k
Forks
487
Avg merge
2d 7h
Merged PRs (30d)
296

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 code fails to compile with CUDA 12.4 (tracked by upstream issue https://github.com/ginkgo-project/ginkgo/issues/1564)

```cpp
#include
#include
#include
#include

void sum_duplicates(int size) {
const int *rows{};
const int *cols{};
const float *in_vals{};
int *out_rows{};
int *out_cols{};
float *out_vals{};
auto in_locs = thrust::make_zip_iterator(thrust::make_tuple(rows, cols));
auto out_locs =
thrust::make_zip_iterator(thrust::make_tuple(out_rows, out_cols));
thrust::reduce_by_key(thrust::device, in_locs, in_locs + size, in_vals,
out_locs, out_vals);
}
```

Noteworthy: The issue goes away when the pointers are `int*` instead of `const int*`

### How to Reproduce

* call `nvcc file.cu`

### Expected behavior

The code compiles (as it did with CUDA <= 12.3)

### Reproduction link

_No response_

### Operating System

Ubuntu 22.04

### nvidia-smi output

_No response_

### NVCC version

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Tue_Feb_27_16:19:38_PST_2024
Cuda compilation tools, release 12.4, V12.4.99
Build cuda_12.4.r12.4/compiler.33961263_0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.