HIP

1 program Added 2026-03-05T10:00:00Z Agent: claude-codeModel: claude-sonnet-4-6WebSearch: disabled Evidence Report issue View issues
Aliases: Heterogeneous-Computing Interface for Portability, HIP C++
Provenance: commit b8c2ccb35c · authored 2026-03-05T01:00:21+01:00 · agent claude-code · model claude-sonnet-4-6

Sources mentioning this language

2 sources · pl_id: pl/hip
LLM (this repo) · 1Linguist

Extensions claimed by this language

1 claim. Each row is one upstream assertion with its strength. SWH column shows file occurrences with that extension across the entire archive.
ExtensionSourceStrengthSWH
.hiplinguistprimary53.2K files

Related languages

HetCASL (0.19)HSAIL (0.15)PLANC (0.13)FLIP (0.13)SWIG (0.12)

LLM-contributed programs

Vector Addition

Provenance: commit b8c2ccb35c · authored 2026-03-05T01:00:21+01:00 · agent claude-code · model claude-sonnet-4-6 · WebSearch disabled
code.cpp · license: MIT · added: 2026-03-05T10:00:00Z
#include <hip/hip_runtime.h>
#include <stdio.h>

#define THREADS_PER_BLOCK 256
#define N 1048576

__global__ void vectorAdd(const float *a, const float *b, float *c, int n) {
    int idx = blockIdx.x * blockDim.x + threadIdx.x;
    if (idx < n) {
        c[idx] = a[idx] + b[idx];
    }
}

int main() {
    float *h_a, *h_b, *h_c;
    float *d_a, *d_b, *d_c;
    size_t size = N * sizeof(float);

    h_a = (float *)malloc(size);
    h_b = (float *)malloc(size);
    h_c = (float *)malloc(size);

    for (int i = 0; i < N; i++) {
        h_a[i] = (float)i;
        h_b[i] = (float)(N - i);
    }

    hipMalloc((void **)&d_a, size);
    hipMalloc((void **)&d_b, size);
    hipMalloc((void **)&d_c, size);

    hipMemcpy(d_a, h_a, size, hipMemcpyHostToDevice);
    hipMemcpy(d_b, h_b, size, hipMemcpyHostToDevice);

    int blocks = (N + THREADS_PER_BLOCK - 1) / THREADS_PER_BLOCK;
    hipLaunchKernelGGL(vectorAdd, dim3(blocks), dim3(THREADS_PER_BLOCK), 0, 0,
                       d_a, d_b, d_c, N);

    hipMemcpy(h_c, d_c, size, hipMemcpyDeviceToHost);

    printf("h_c[0] = %f\n", h_c[0]);
    printf("h_c[%d] = %f\n", N - 1, h_c[N - 1]);

    hipFree(d_a);
    hipFree(d_b);
    hipFree(d_c);
    free(h_a);
    free(h_b);
    free(h_c);

    return 0;
}

Real programs from Software Heritage

No SWH evidence indexed yet for this language. (Either the SWH mining hasn't reached this language's extensions, or no matching files exist in the archive.)

Contribute — propose a file extension

Tell us where to find evidence about HIP (mapped to pl/hip). A reference URL is required; at least one of extension or program code must be provided too. A maintainer reviews each submission via a draft PR before anything lands.
Optional: attach a program from that URL
If the reference URL points at a single source file you'd like to add as an example program, paste it below. The workflow will write it under languages/HIP/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← Hindawi Programming System HipHop →