Skip to content

HIP language support #7995

Open
Open

Description

Please support HIP as a C++ dialect based off of the existing CUDA support.

HIP is AMD's single-source GPGPU API, which is heavily influenced by CUDA, to extents that the two are nearly source compatible. Although not strictly related, but CMake 3.21 recently landed HIP language support, so the .cpp extension need not be overloaded anymore for HIP source code. HIP shares the same keywords and semantics as CUDA, without the <<<>>> operator and instead uses a macro for kernel launch, hipLaunchKernelGGL().

ps.: HIP also has a pure host-side implementation using C++17 with a touch of OpenMP under the name HIP-CPU. It is an invaluable tool to run device code on machines without compatible GPUs and to debug the code using ordinary CPU debugger. (Throwing structured exceptions in GPU code is fun.) In such cases, the builds would set source file language to CXX instead of HIP. It would be great if cpptools would function properly in both cases and pick up source file language based on CMake config. (IntelliSense workes flawlessly with Main.cpp and HIP-CPU. The editor however seems to pick up source language based on file extension. Now Main.hip is all white if not configured in settings.json, but even then include paths will not be picked up.)

Activity

  1. added this to the Triage milestone on Sep 7, 2021
  2. modified the milestones: Triage, Backlog on Sep 8, 2021
  3. github-actions commented on Sep 8, 2021

    @github-actions

    This feature request has received enough votes to be added to our backlog.

  4. lonnie-souder-ii commented on Feb 19, 2026

    @lonnie-souder-ii

    This appears to still be an issue. IntelliSense is missing important ROCm includes because the compiler queries are using -x c++ instead of the proper -x hip for a HIP file.
    Ex:

    Compiler query command line: /opt/rocm-7.0.2/lib/llvm/bin/clang++ -g -O --offload-arch=gfx90a -std=c17 -m64 -Wp,-v -fno-blocks -E -dM -x c /dev/null
    

    I'm attaching my project config, compile_commands.json, and a C/C++ debug log showing the issue in full
    cpptools-issue-7995.tar.gz

  5. sean-mcmanus commented on Feb 20, 2026

    @sean-mcmanus
    Contributor

    Lonnie L. Souder II (@lonnie-souder-ii) As a workaround, someone could potentially create a fake compiler that just reads the inputs, replaces "-x c" or "-x c++" with "-x hip", sends the modified input to the real compiler, and then outputs the result from the compiler. But it seems like there might be more work involved to fix the HIP language scenario? The amount of work involved with adding CUDA support was non-trivial.

  6. lonnie-souder-ii commented on Feb 20, 2026

    @lonnie-souder-ii

    Sean McManus (@sean-mcmanus) Is there a public PR/commit hash you could point me to where the CUDA support work was done?

  7. sean-mcmanus commented on Feb 20, 2026

    @sean-mcmanus
    Contributor

    Lonnie L. Souder II (@lonnie-souder-ii) I think most of the work was internal to the closed source cpptools side. If you search the open source TypeScript for cuda you can find some of those changes, the original PR being #7255 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions