microsoft / microsoft/vscode-cpptools

Clang-tidy integration not working with CUDA files and Failing to run at all if args are provided

Open
#10,375 17 comments 0 reactions 1 assignee View on GitHub

@michelleangela is already working on this.

Since Jan 13, 2023.

bug Feature: Code Analysis Feature: CUDA Language Service verified
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and Version: MacOS 13.1
  • VS Code Version: 1.74.3
  • C/C++ Extension Version: 1.13.9
  • If using SSH remote, specify OS of remote machine: Ubuntu 20.04.3 LTS
Bug Summary and Steps to Reproduce

Bug Summary:

Code Analysis via clang-tidy produces erroneous errors when checking .cu files and fails to run at all if passed any args. clang-tidy works fine when run manually.

Steps to reproduce:

  1. Generate these files
// testFile.h

namespace mhd
{
namespace utils
{

}  // namespace utils
}  // namespace mhd
// testFile.cu
#include "testFile.h"
  1. Clang-tidy will point out that the namespaces should be concatenated and will also spit out a ton of clang-diagnostic errors (below)
  2. If any args are passed to clang-tidy then it will fail to run at all and even removing them doesn't get it to restart without restarting VSC

Expected behavior:
clang-tidy should not produce these erroneous errors and should work with extra args supplied.

Configuration and Logs
c_cpp_properties.json (using the c-3po config)

{
    "configurations": [
        {
            "name": "Frontier",
            "includePath": [
                "${workspaceFolder}/**",
                // "${OLCF_GOOGLETEST_ROOT}/**",
                "${OLCF_HDF5_ROOT}/**",
                "${CRAY_MPICH_BASEDIR}/**"
            ],
            "defines": [
                "PRECISION=2",
                "CUDA_ERROR_CHECK",
                "MPI_CHOLLA",
                "CUDA",
                "HLLD",
                // "PARTICLES",
                "OUTPUT",
                "HDF5",
                "HYDRO_GPU",
                "CUDA",
                "MPI_CHOLLA",
                "BLOCK",
                "PRECISION=2",
                "PPMP",
                "HLLD",
                "MHD",
                "DENSITY_FLOOR",
                "TEMPERATURE_FLOOR",
                "CPU_TIME",
                "PARALLEL_OMP",
                "GIT_HASH=\"githash\"",
                "MACRO_FLAGS=\"-DMACRO -DFLAGS\"",
                "O_HIP"
            ],
            "compilerPath": "/opt/cray/pe/craype/2.7.16/bin/CC",
            "intelliSenseMode": "linux-clang-x64",
            "cppStandard": "c++17",
            "cStandard": "c17"
        },
        {
            "name": "H2P-Power9-Node",
            "includePath": [
                "${workspaceFolder}/**",
                "/ihome/crc/install/power9/googletest/1.11.0/**",
                "/ihome/crc/install/power9/hdf5/1.12.0/build-gcc-10.1.0/**",
                "/ihome/crc/install/power9/openmpi/4.0.5/build-gcc-10.1.0/**",
                "/ihome/crc/install/power9/cuda/11.1.0/include/**"
            ],
            "defines": [
                "PRECISION=2",
                "CUDA_ERROR_CHECK",
                "MPI_CHOLLA",
                "CUDA",
                "HLLD",
                // "PARTICLES",
                "OUTPUT",
                "HDF5",
                "HYDRO_GPU",
                "CUDA",
                "MPI_CHOLLA",
                "BLOCK",
                "PRECISION=2",
                "PPMP",
                "HLLD",
                "MHD",
                "DENSITY_FLOOR",
                "TEMPERATURE_FLOOR",
                "CPU_TIME",
                "PARALLEL_OMP",
                "GIT_HASH=\"githash\"",
                "MACRO_FLAGS=\"-DMACRO -DFLAGS\""
            ],
            "compilerPath": "${GCC_ROOT}/bin/g++",
            "intelliSenseMode": "linux-gcc-x64",
            "cppStandard": "c++17",
            "cStandard": "c17"
        },
        {
            "name": "c-3po",
            "includePath": [
                "${workspaceFolder}/**",
                "/usr/local/include/**",
                "/usr/lib/x86_64-linux-gnu/openmpi/include/",
                "/usr/local/cuda-11.4/include",
                "/usr/lib/x86_64-linux-gnu/hdf5/serial/include/"
            ],
            "defines": [
                "PRECISION=2",
                "CUDA_ERROR_CHECK",
                "MPI_CHOLLA",
                "CUDA",
                "HLLD",
                // "PARTICLES",
                "OUTPUT",
                "HDF5",
                "HYDRO_GPU",
                "CUDA",
                "MPI_CHOLLA",
                "BLOCK",
                "PPMP",
                "HLLD",
                "MHD",
                "DENSITY_FLOOR",
                "TEMPERATURE_FLOOR",
                "CPU_TIME",
                "PARALLEL_OMP",
                "N_OMP_THREADS=10",
                "VL",
                "GIT_HASH=\"githash\"",
                "MACRO_FLAGS=\"-DMACRO -DFLAGS\""
            ],
            "compilerPath": "/usr/bin/g++",
            "intelliSenseMode": "linux-gcc-x64",
            "cppStandard": "c++17",
            "cStandard": "c17",
            "configurationProvider": "ms-vscode.makefile-tools"
        },
        {
            "name": "Janeway",
            "includePath": [
                "${workspaceFolder}/**",
                "/Users/Bob/Desktop/PhD-Research/googletest/build/install_root/**"
            ],
            "defines": [
                "PRECISION=2",
                "CUDA_ERROR_CHECK",
                "MPI_CHOLLA",
                "CUDA",
                "HLLD",
                // "PARTICLES",
                "OUTPUT",
                "HDF5",
                "HYDRO_GPU",
                "CUDA",
                "MPI_CHOLLA",
                "BLOCK",
                "PRECISION=2",
                "PPMP",
                "HLLD",
                "MHD",
                "DENSITY_FLOOR",
                "TEMPERATURE_FLOOR",
                "CPU_TIME",
                "PARALLEL_OMP",
                "GIT_HASH=\"githash\"",
                "MACRO_FLAGS=\"-DMACRO -DFLAGS\""
            ],
            "compilerPath": "/usr/bin/g++",
            "intelliSenseMode": "linux-gcc-x64",
            "cppStandard": "c++17",
            "cStandard": "c17"
        }
    ],
    "version": 4
}

Log diagnostics

-------- Diagnostics - 1/11/2023, 5:33:32 PM
Version: 1.13.9
Current Configuration:
{
    "name": "c-3po",
    "includePath": [
        "${workspaceFolder}/**",
        "/usr/local/include/**",
        "/usr/lib/x86_64-linux-gnu/openmpi/include/",
        "/usr/local/cuda-11.4/include",
        "/usr/lib/x86_64-linux-gnu/hdf5/serial/include/"
    ],
    "defines": [
        "PRECISION=2",
        "CUDA_ERROR_CHECK",
        "MPI_CHOLLA",
        "CUDA",
        "HLLD",
        "OUTPUT",
        "HDF5",
        "HYDRO_GPU",
        "CUDA",
        "MPI_CHOLLA",
        "BLOCK",
        "PPMP",
        "HLLD",
        "MHD",
        "DENSITY_FLOOR",
        "TEMPERATURE_FLOOR",
        "CPU_TIME",
        "PARALLEL_OMP",
        "N_OMP_THREADS=10",
        "VL",
        "GIT_HASH=\"githash\"",
        "MACRO_FLAGS=\"-DMACRO -DFLAGS\""
    ],
    "compilerPath": "/usr/bin/g++",
    "intelliSenseMode": "linux-gcc-x64",
    "cppStandard": "c++17",
    "cStandard": "c17",
    "configurationProvider": "ms-vscode.makefile-tools",
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "mergeConfigurations": false,
    "browse": {
        "path": [
            "${workspaceFolder}/**",
            "/usr/local/include/**",
            "/usr/lib/x86_64-linux-gnu/openmpi/include/",
            "/usr/local/cuda-11.4/include",
            "/usr/lib/x86_64-linux-gnu/hdf5/serial/include/"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Translation Unit Mappings:
[ /home/rcaddy/Code/cholla/testFile.cu ]:
    /home/rcaddy/Code/cholla/testFile.cu
Translation Unit Configurations:
[ /home/rcaddy/Code/cholla/testFile.cu ]:
    Process ID: 1591764
    Memory Usage: 201 MB
    Compiler Path: /usr/bin/x86_64-linux-gnu-gcc-10
    Includes:
        /usr/lib/x86_64-linux-gnu/openmpi/include
        /usr/local/cuda-11.4/targets/x86_64-linux/include
        /usr/include/hdf5/serial
        /usr/include/c++/10
        /usr/include/x86_64-linux-gnu/c++/10
        /usr/include/c++/10/backward
        /usr/lib/gcc/x86_64-linux-gnu/10/include
        /usr/local/include
        /usr/include/x86_64-linux-gnu
        /usr/include
    Defines:
        __CUDA_ARCH__=520
        CUDA_DOUBLE_MATH_FUNCTIONS
        __CUDACC__
        __NVCC__
        __CUDACC_VER_MAJOR__=11
        __CUDACC_VER_MINOR__=4
        __CUDACC_VER_BUILD__=120
        __CUDA_API_VER_MAJOR__=11
        __CUDA_API_VER_MINOR__=4
        PRECISION=2
        CUDA_ERROR_CHECK
        MPI_CHOLLA
        CUDA
        HLLD
        OUTPUT
        HDF5
        HYDRO_GPU
        CUDA
        MPI_CHOLLA
        BLOCK
        PPMP
        HLLD
        MHD
        DENSITY_FLOOR
        TEMPERATURE_FLOOR
        CPU_TIME
        PARALLEL_OMP
        N_OMP_THREADS=10
        VL
        GIT_HASH="githash"
        MACRO_FLAGS="-DMACRO -DFLAGS"
    Forced Includes:
        /usr/local/cuda-11.4/bin/../targets/x86_64-linux/include/cuda_runtime.h
    Standard Version: c++17
    IntelliSense Mode: linux-gcc-x64
    Other Flags:
        --g++
        --gnu_version=100300
        --cuda
Total Memory Usage: 201 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 29722
Other Extensions

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.