Merge remote-tracking branch 'origin/master' into feature_use_module_based_dispatch_instead_of_pfe
# Conflicts: # src/hip_module.cpp
此提交包含在:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
新增問題並參考
封鎖使用者