From 1451d8fc893ab72c4dc7fd23d8aaed0afa5ada87 Mon Sep 17 00:00:00 2001 From: Chris Kitching Date: Sat, 11 Nov 2017 11:00:40 +0000 Subject: [PATCH] Add a test that exposes #260 [ROCm/hip commit: 9165df3848e611b141a1505a12e15db3bb799beb] --- projects/hip/tests/hipify-clang/allocators.cu | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/hip/tests/hipify-clang/allocators.cu diff --git a/projects/hip/tests/hipify-clang/allocators.cu b/projects/hip/tests/hipify-clang/allocators.cu new file mode 100644 index 0000000000..3f130be227 --- /dev/null +++ b/projects/hip/tests/hipify-clang/allocators.cu @@ -0,0 +1,18 @@ +// RUN: %run_test hipify "%s" "%t" %cuda_args + +#pragma once + +#include + + +/** + * Allocate GPU memory for `count` elements of type `T`. + */ +template +static T* gpuMalloc(size_t count) { + T* ret = nullptr; + // CHECK: hipMalloc(&ret, count * sizeof(T)); + cudaMalloc(&ret, count * sizeof(T)); + return ret; +} +