Merge remote-tracking branch 'origin/master' into feature_use_module_based_dispatch_instead_of_pfe

# Conflicts:
#	src/hip_module.cpp
此提交包含在:
Alex Voicu
2017-11-28 17:29:11 +00:00
當前提交 dc67ca3feb
共有 28 個檔案被更改,包括 5344 行新增1054 行删除
+18
查看文件
@@ -0,0 +1,18 @@
// RUN: %run_test hipify "%s" "%t" %cuda_args
#pragma once
#include <cuda_runtime.h>
/**
* Allocate GPU memory for `count` elements of type `T`.
*/
template<typename T>
static T* gpuMalloc(size_t count) {
T* ret = nullptr;
// CHECK: hipMalloc(&ret, count * sizeof(T));
cudaMalloc(&ret, count * sizeof(T));
return ret;
}
+7
查看文件
@@ -2,6 +2,8 @@
#include <iostream>
// CHECK: #include <hip/hip_runtime.h>
#include <cuda.h>
#define TOKEN_PASTE(X, Y) X ## Y
#define ARG_LIST_AS_MACRO a, device_x, device_y
@@ -33,8 +35,13 @@ int main(int argc, char* argv[]) {
// CHECK: hipMalloc(&device_x, kDataLen * sizeof(float));
cudaMalloc(&device_x, kDataLen * sizeof(float));
#ifdef HERRING
// CHECK: hipMalloc(&device_y, kDataLen * sizeof(float));
cudaMalloc(&device_y, kDataLen * sizeof(float));
#else
// CHECK: hipMalloc(&device_y, kDataLen * sizeof(double));
cudaMalloc(&device_y, kDataLen * sizeof(double));
#endif
// CHECK: hipMemcpy(device_x, host_x, kDataLen * sizeof(float), hipMemcpyHostToDevice);
cudaMemcpy(device_x, host_x, kDataLen * sizeof(float), cudaMemcpyHostToDevice);
+2
查看文件
@@ -99,6 +99,7 @@ int main(int argc, char **argv)
// use command-line specified CUDA device, otherwise use device with highest Gflops/s
cuda_device = findCudaDevice(argc, (const char **)argv);
// CHECK: hipDeviceProp_t deviceProp;
cudaDeviceProp deviceProp;
// CHECK: checkCudaErrors(hipGetDevice(&cuda_device));
checkCudaErrors(cudaGetDevice(&cuda_device));
@@ -135,6 +136,7 @@ int main(int argc, char **argv)
checkCudaErrors(cudaStreamCreate(&(streams[i])));
}
// CHECK: hipEvent_t start_event, stop_event;
// create CUDA event handles
cudaEvent_t start_event, stop_event;
+3 -1
查看文件
@@ -14,7 +14,9 @@ texture<float, 2, hipReadModeElementType> tex;
bool testResult = true;
__global__ void tex2DKernel(float* outputData,
#ifdef __HIP_PLATFORM_HCC__
hipTextureObject_t textureObject,
#endif
int width,
int height)
{
@@ -78,7 +80,7 @@ void runTest(int argc, char **argv)
#ifdef __HIP_PLATFORM_HCC__
hipLaunchKernelGGL(tex2DKernel, dim3(dimGrid), dim3(dimBlock), 0, 0, dData, tex.textureObject, width, height);
#else
hipLaunchKernelGGL(tex2DKernel, dim3(dimGrid), dim3(dimBlock), 0, 0, dData, 0, width, height);
hipLaunchKernelGGL(tex2DKernel, dim3(dimGrid), dim3(dimBlock), 0, 0, dData, width, height);
#endif
hipDeviceSynchronize();