From 41d7a059747fed8ec044e20ad397afd726d8cd0f 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/clr commit: 0afc6b2e9584955852b5db0e0b74ad2d6ac16b6f] --- .../hipamd/tests/hipify-clang/allocators.cu | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/clr/hipamd/tests/hipify-clang/allocators.cu diff --git a/projects/clr/hipamd/tests/hipify-clang/allocators.cu b/projects/clr/hipamd/tests/hipify-clang/allocators.cu new file mode 100644 index 0000000000..3f130be227 --- /dev/null +++ b/projects/clr/hipamd/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; +} +