Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: /usr/local/include/cuda/std/__type_traits/integral_constant.h(26): error: "integral_constant" has already been declared in the current scope #4154

Open
1 task done
linuxlonelyeagle opened this issue Mar 15, 2025 · 1 comment
Labels
bug Something isn't working right.

Comments

@linuxlonelyeagle
Copy link

Is this a duplicate?

Type of Bug

Compile-time Error

Component

libcu++

Describe the bug

I found it cann't include "cuda/ptx", so I install cccl from github.I found following issue.I hope someone can help me.Thanks all.

my code

#include "cuda_runtime.h"
#include "cuda/barrier"
#include <cuda/std/atomic>
#include <cuda/ptx>

using barrier = cuda::barrier<cuda::thread_scope_block>;
using ptx = cuda::ptx;

int main() {
  return 0;
}

when i compile it.

~/test # nvcc tma.cu  -arch=sm_80                                                              2 ↵ root@dbc0cf650200
nv/usr/local/include/cuda/std/__type_traits/integral_constant.h(26): error: "integral_constant" has already been declared in the current scope
  struct _CCCL_TYPE_VISIBILITY_DEFAULT integral_constant
                                       ^

/usr/local/include/cuda/std/__type_traits/integral_constant.h(26): error: incomplete type is not allowed
  struct _CCCL_TYPE_VISIBILITY_DEFAULT integral_constant
                                       ^

/usr/local/include/cuda/std/__type_traits/integral_constant.h(28): error: expected an expression
    static constexpr const _Tp value = __v;
    ^

/usr/local/include/cuda/std/__type_traits/integral_constant.h(28): error: expected a "}"
    static constexpr const _Tp value = __v;
                                          ^

/usr/local/include/cuda/std/__type_traits/integral_constant.h(29): error: identifier "_Tp" is undefined
    typedef _Tp value_type;
            ^

/usr/local/include/cuda/std/__type_traits/integral_constant.h(30): error: argument list for variable template "cuda::std::__4::integral_constant" is missing
    typedef integral_constant type;
            ^

/usr/local/include/cuda/std/__type_traits/integral_constant.h(31): error: conversion function must be a nonstatic member function
    __attribute__ ((__visibility__("hidden"))) __attribute__ ((__always_inline__)) constexpr operator value_type() const noexcept
                                                                                             ^

/usr/local/include/cuda/std/__type_traits/integral_constant.h(31): error: a type qualifier is not allowed on a nonmember function
    __attribute__ ((__visibility__("hidden"))) __attribute__ ((__always_inline__)) constexpr operator value_type() const noexcept
                                                                                                                   ^

/usr/local/include/cuda/std/__type_traits/integral_constant.h(33): error: identifier "value" is undefined
      return value;
             ^

/usr/local/include/cuda/std/__type_traits/integral_constant.h(35): error: "operator()" must be a member function
    __attribute__ ((__visibility__("hidden"))) __attribute__ ((__always_inline__)) constexpr value_type operator()() const noexcept
                                                                                                        ^

/usr/local/include/cuda/std/__type_traits/integral_constant.h(35): error: a type qualifier is not allowed on a nonmember function
    __attribute__ ((__visibility__("hidden"))) __attribute__ ((__always_inline__)) constexpr value_type operator()() const noexcept
                                                                                                                     ^

/usr/local/include/cuda/std/__type_traits/integral_constant.h(37): error: identifier "value" is undefined
      return value;
             ^

/usr/local/include/cuda/std/__type_traits/integral_constant.h(42): error: "cuda::std::integral_constant" is ambiguous
  constexpr const _Tp integral_constant<_Tp, __v>::value;
                      ^

/usr/local/include/cuda/std/__type_traits/integral_constant.h(42): error: "constexpr" is not valid here
  constexpr const _Tp integral_constant<_Tp, __v>::value;
  ^

/usr/local/include/cuda/std/__type_traits/integral_constant.h(44): error: "cuda::std::integral_constant" is ambiguous
  typedef integral_constant<bool, true> true_type;
          ^

/usr/local/include/cuda/std/__type_traits/integral_constant.h(45): error: "cuda::std::integral_constant" is ambiguous
  typedef integral_constant<bool, false> false_type;
          ^

/usr/local/include/cuda/std/__type_traits/integral_constant.h(48): error: expected an "="
  using _BoolConstant __attribute__ ((deprecated)) _CCCL_NODEBUG_ALIAS = integral_constant<bool, _Val>;
                                                   ^

/usr/local/include/cuda/std/__type_traits/integral_constant.h(48): error: identifier "_CCCL_NODEBUG_ALIAS" is undefined
  using _BoolConstant __attribute__ ((deprecated)) _CCCL_NODEBUG_ALIAS = integral_constant<bool, _Val>;
                                                   ^

/usr/local/include/cuda/std/__type_traits/integral_constant.h(48): error: expected a ";"
  using _BoolConstant __attribute__ ((deprecated)) _CCCL_NODEBUG_ALIAS = integral_constant<bool, _Val>;
                                                                       ^

/usr/local/include/cuda/std/__type_traits/integral_constant.h(51): error: "integral_constant" is ambiguous
  using bool_constant = integral_constant<bool, __b>;
                        ^

/usr/local/include/cuda/std/__type_traits/integral_constant.h(56): error: expected a declaration
  } } }
      ^

/usr/local/include/cuda/__ptx/ptx_dot_variants.h(133): error: identifier "dot_sem" is undefined
  template <dot_sem __sem>
            ^

/usr/local/include/cuda/__ptx/ptx_dot_variants.h(134): error: "sem_t" has already been declared in the current scope
  using sem_t = 
        ^

/usr/local/include/cuda/__ptx/ptx_dot_variants.h(134): error: identifier "dot_sem" is undefined
                                 ::integral_constant<dot_sem, __sem>;
                                                     ^

/usr/local/include/cuda/__ptx/ptx_dot_variants.h(134): error: variable "cuda::std::__4::integral_constant [with _Tp=<error-type>, __v=<error>]" is not a type name
                       cuda::std::__4
                       ^

/usr/local/include/cuda/__ptx/ptx_dot_variants.h(135): error: name followed by "::" must be a class or namespace name
  using sem_acq_rel_t = sem_t<dot_sem::acq_rel>;
                              ^

/usr/local/include/cuda/__ptx/ptx_dot_variants.h(136): error: name followed by "::" must be a class or namespace name
  using sem_acquire_t = sem_t<dot_sem::acquire>;
                              ^

/usr/local/include/cuda/__ptx/ptx_dot_variants.h(137): error: name followed by "::" must be a class or namespace name
  using sem_relaxed_t = sem_t<dot_sem::relaxed>;
                              ^

/usr/local/include/cuda/__ptx/ptx_dot_variants.h(138): error: name followed by "::" must be a class or namespace name
  using sem_release_t = sem_t<dot_sem::release>;
                              ^

/usr/local/include/cuda/__ptx/ptx_dot_variants.h(139): error: name followed by "::" must be a class or namespace name
  using sem_sc_t = sem_t<dot_sem::sc>;
                         ^

/usr/local/include/cuda/__ptx/ptx_dot_variants.h(140): error: name followed by "::" must be a class or namespace name
  using sem_weak_t = sem_t<dot_sem::weak>;
                           ^

/usr/local/include/cuda/__ptx/ptx_dot_variants.h(150): error: variable "cuda::std::__4::integral_constant [with _Tp=dot_space, __v=__spc]" is not a type name
                         cuda::std::__4
                         ^

/usr/local/include/cuda/__ptx/ptx_dot_variants.h(160): error: variable "cuda::std::__4::integral_constant [with _Tp=dot_scope, __v=__scope]" is not a type name
                         cuda::std::__4
                         ^

/usr/local/include/cuda/__ptx/ptx_dot_variants.h(172): error: variable "cuda::std::__4::integral_constant [with _Tp=dot_op, __v=__op]" is not a type name
                     cuda::std::__4
                     ^

/usr/local/include/cuda/__ptx/ptx_dot_variants.h(196): error: variable "cuda::std::__4::integral_constant [with _Tp=dot_cta_group, __v=__cta_group]" is not a type name
                       cuda::std::__4
                       ^

/usr/local/include/cuda/__ptx/ptx_dot_variants.h(204): error: variable "cuda::std::__4::integral_constant [with _Tp=dot_kind, __v=__kind]" is not a type name
                         cuda::std::__4
                         ^

/usr/local/include/cuda/__ptx/ptx_dot_variants.h(222): error: variable "cuda::std::__4::integral_constant [with _Tp=int, __v=n]" is not a type name
               cuda::std::__4
               ^

/usr/local/include/cuda/std/__type_traits/enable_if.h(23): error: expected a ";"
  namespace cuda { namespace std { inline namespace __4 {
  ^

tma.cu(6): warning #12-D: parsing restarts here after previous syntax error
  using barrier = cuda::barrier<cuda::thread_scope_block>;
                                                         ^

Remark: The warnings can be suppressed with "-diag-suppress <warning-number>"

tma.cu(7): error: namespace "cuda" has no member "ptx"
  using ptx = cuda::ptx;

How to Reproduce

The above is enough.

Expected behavior

compile complete.

Reproduction link

No response

Operating System

No response

nvidia-smi output

Sat Mar 15 14:13:32 2025
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.54.15 Driver Version: 550.54.15 CUDA Version: 12.4 |
|-----------------------------------------+------------------------+----------------------+
| 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 H100 PCIe On | 00000000:A1:00.0 Off | 0 |
| N/A 28C P0 77W / 350W | 485MiB / 81559MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
+-----------------------------------------------------------------------------------------+

NVCC version

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Mon_Apr__3_17:16:06_PDT_2023
Cuda compilation tools, release 12.1, V12.1.105
Build cuda_12.1.r12.1/compiler.32688072_0

@linuxlonelyeagle linuxlonelyeagle added the bug Something isn't working right. label Mar 15, 2025
@github-project-automation github-project-automation bot moved this to Todo in CCCL Mar 15, 2025
@miscco
Copy link
Contributor

miscco commented Mar 15, 2025

This is a bug in your setup:

#include "cuda/barrier"
#include <cuda/std/atomic>
#include <cuda/ptx>

I assume that you are trying to get CCCL from github, but you are once including from system path via <cuda/...> and once from local path via "cuda/barrier".

That most likely pulls in two different versions of CCCL, the one from the CTK installed and the one from github.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working right.
Projects
Status: Todo
Development

No branches or pull requests

2 participants