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

hipMallocPitch requires cast to void** #2477

Open
jakub-homola opened this issue Feb 8, 2022 · 3 comments
Open

hipMallocPitch requires cast to void** #2477

jakub-homola opened this issue Feb 8, 2022 · 3 comments
Assignees

Comments

@jakub-homola
Copy link

Hello,
this is a minor issue, but it is quite inconvenient -- one needs to cast the first parameter of hipMallocPitch to void** in HIP. In CUDA (cudaMallocPitch), the cast is not needed.

The CUDA program

#include <cstdio>


int main()
{
    int width = 42, height = 69;
    size_t pitch;
    float * data;

    cudaMallocPitch(&data, &pitch, width * sizeof(float), height);
    cudaFree(data);

    return 0;
}

is compiled with nvcc source.cu -o program.cuda.x without any issues.

However, the equivalent HIP program

#include <cstdio>
#include "hip/hip_runtime.h"

int main()
{
    int width = 42, height = 69;
    size_t pitch;
    float * data;

    hipMallocPitch(&data, &pitch, width * sizeof(float), height);
    hipFree(data);

    return 0;
}

fails on compilation (hipcc source.hip.cpp -o program.hip.x) on the hipMallocPitch function:

source.hip.cpp(10): error: argument of type "float **" is incompatible with parameter of type "void **"

Not a huge problem, since casting the first parameter to void** solves it, but in CUDA we do not need to perform the cast, so I think that neither should we in HIP.

I am using nvcc V11.4.152, HIP version 4.4.21401-bedc5f61

@ppanchad-amd
Copy link

@jakub-homola Apologies for the lack of response. Can you please test with latest ROCm 6.0.2 (HIP 6.0.32831)? If resolved, please close ticket. Thanks!

@jakub-homola
Copy link
Author

I don't have access to any machine with the newest version of HIP. Using 5.2.3, the issue is still there.

Installing the newest version myself would be too complicated for me right now.

Could you please test it? It's really just copy-pasting the code above and trying to compile it.

@ppanchad-amd
Copy link

@jakub-homola We have confirmed it still occurs with ROCm 6.1.1. Internal ticket has been created to fix issue. Thanks!

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

No branches or pull requests

3 participants