ROCm/Thrust

Segmentation fault while running thrust::lower bound in a HIP kernel

Opened this issue · 0 comments

Having a HIP Kernel with thrust::lower_bound causes a crash. The same call if used in the host code and not a HIP kernel works ok!

A simple test that causes a crash is:

#include <thrust/binary_search.h>
#include <thrust/execution_policy.h>
#include <thrust/functional.h>
#include "hip/hip_runtime.h"

__global__ void kern(
        int N,
        float* inp,
        float val)
{
        auto low_bound = thrust::lower_bound(thrust::device, inp, inp + N, val);

}

int main(void)
{      
        float * input_device;
        hipMalloc(&input_device, sizeof(float)*6);
        float value = 5;
        hipLaunchKernelGGL(HIP_KERNEL_NAME(kern), dim3(1), dim3(1), 0,0,6, input_device, value);
        hipFree(input_device);

        return 0;
}

I compiled the code using hipcc