Describe the bug
The CUDA compiler 13.3 emits warning #1835-D when CUDF_HOST_DEVICE annotates a namespace-scope constexpr variable because the macro expands to the function-only __host__ __device__ attributes.
PR #24237 removes the invalid annotation from all known cases:
cpp/include/cudf/join/join.hpp: JoinNoMatch
cpp/src/groupby/hash/compute_shared_memory_aggs.cu: ALIGNMENT
cpp/src/groupby/hash/helpers.cuh: GROUPBY_CG_SIZE
cpp/src/groupby/hash/helpers.cuh: GROUPBY_BUCKET_SIZE
cpp/src/groupby/hash/helpers.cuh: GROUPBY_BLOCK_SIZE
cpp/src/groupby/hash/helpers.cuh: GROUPBY_CARDINALITY_THRESHOLD
cpp/src/groupby/hash/helpers.cuh: GROUPBY_SHM_MAX_ELEMENTS
cpp/src/groupby/hash/helpers.cuh: valid_extent
cpp/src/join/key_remapping.cu: KEY_REMAP_BLOCK_SIZE
An audit of CUDF_HOST_DEVICE uses found no additional namespace-scope constexpr variables with the annotation.
Steps/Code to reproduce bug
#define CUDF_HOST_DEVICE __host__ __device__
CUDF_HOST_DEVICE constexpr int value = 42;
int main() { return value == 42 ? 0 : 1; }
Compile with the CUDA compiler 13.3:
nvcc -std=c++20 --display-error-number -c reproducer.cu
The CUDA compiler emits:
warning #1835-D: attribute "__host__" does not apply here
Promoting diagnostic 1835 to an error makes the compilation fail:
nvcc -std=c++20 --diag-error=1835 -c reproducer.cu
Expected behavior
Namespace-scope constexpr variables are not annotated with function-only attributes, and the CUDA compiler does not emit diagnostic 1835. The variables remain usable in host and device constant expressions without the annotation.
Environment overview
- CUDA compiler 13.3.73
- Standalone compiler reproducer; no cuDF installation is required
Describe the bug
The CUDA compiler 13.3 emits warning
#1835-DwhenCUDF_HOST_DEVICEannotates a namespace-scopeconstexprvariable because the macro expands to the function-only__host__ __device__attributes.PR #24237 removes the invalid annotation from all known cases:
cpp/include/cudf/join/join.hpp:JoinNoMatchcpp/src/groupby/hash/compute_shared_memory_aggs.cu:ALIGNMENTcpp/src/groupby/hash/helpers.cuh:GROUPBY_CG_SIZEcpp/src/groupby/hash/helpers.cuh:GROUPBY_BUCKET_SIZEcpp/src/groupby/hash/helpers.cuh:GROUPBY_BLOCK_SIZEcpp/src/groupby/hash/helpers.cuh:GROUPBY_CARDINALITY_THRESHOLDcpp/src/groupby/hash/helpers.cuh:GROUPBY_SHM_MAX_ELEMENTScpp/src/groupby/hash/helpers.cuh:valid_extentcpp/src/join/key_remapping.cu:KEY_REMAP_BLOCK_SIZEAn audit of
CUDF_HOST_DEVICEuses found no additional namespace-scopeconstexprvariables with the annotation.Steps/Code to reproduce bug
Compile with the CUDA compiler 13.3:
The CUDA compiler emits:
Promoting diagnostic 1835 to an error makes the compilation fail:
Expected behavior
Namespace-scope
constexprvariables are not annotated with function-only attributes, and the CUDA compiler does not emit diagnostic 1835. The variables remain usable in host and device constant expressions without the annotation.Environment overview