From 9165df3848e611b141a1505a12e15db3bb799beb 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 --- tests/hipify-clang/allocators.cu | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/hipify-clang/allocators.cu diff --git a/tests/hipify-clang/allocators.cu b/tests/hipify-clang/allocators.cu new file mode 100644 index 0000000000..3f130be227 --- /dev/null +++ b/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; +} +