removed FileCheck dependency & significantly improved test coverage

[ROCm/clr commit: 666a887a1e]
这个提交包含在:
dfukalov
2016-03-26 16:01:49 +03:00
父节点 a02be5a960
当前提交 2d44c66b9c
修改 4 个文件,包含 11 行新增14 行删除
+2 -3
查看文件
@@ -13,7 +13,7 @@ git clone https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP-hipify.git ll
echo "add_subdirectory(hipify)" >> llvm/tools/clang/tools/extra/CMakeLists.txt
mkdir llvm_build && cd llvm_build
cmake -DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU" ../llvm
cmake -DLLVM_TARGETS_TO_BUILD="X86;NVPTX" ../llvm
make
```
@@ -25,7 +25,7 @@ git clone http://llvm.org/git/llvm.git llvm
git clone http://llvm.org/git/clang.git llvm/tools/clang
mkdir llvm_build && cd llvm_build
cmake -DCMAKE_INSTALL_PREFIX="LLVM_INSTALL_PATH" -DLLVM_INSTALL_UTILS=ON -DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU" ../llvm
cmake -DCMAKE_INSTALL_PREFIX="LLVM_INSTALL_PATH" -DLLVM_TARGETS_TO_BUILD="X86;NVPTX" ../llvm
make && make install
git clone https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP-hipify.git path_to_hipify_src
@@ -37,7 +37,6 @@ make
# How to run tests (for *standalone* tool only)
- install Python and add python-setuptools
- install lit python script
- make sure that FileCheck util is installed to **LLVM_INSTALL_PATH/bin/FileCheck**
- run tests from path_to_hipify_src/build
```
sudo apt-get install python python-setuptools
+1 -1
查看文件
@@ -16,7 +16,7 @@ configure_file(
add_lit_testsuite(check-hipify "Running HIPify regression tests"
${CMAKE_CURRENT_SOURCE_DIR}
PARAMS site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
DEPENDS hipify FileCheck lit
DEPENDS hipify lit
)
add_custom_target(check)
+8 -3
查看文件
@@ -1,10 +1,9 @@
// RUN: hipify "%s" -o=%t --
// RUN: FileCheck %s -input-file=%t --match-full-lines
#include <iostream>
__global__ void axpy(float a, float* x, float* y) {
// CHECK: y[hipThreadIdx_x] = a * x[hipThreadIdx_x];
// RUN: sh -c "test `grep -c -F 'y[hipThreadIdx_x] = a * x[hipThreadIdx_x];' %t` -eq 2"
y[threadIdx.x] = a * x[threadIdx.x];
}
@@ -18,16 +17,21 @@ int main(int argc, char* argv[]) {
// Copy input data to device.
float* device_x;
float* device_y;
// RUN: sh -c "test `grep -c -F 'hipMalloc(&device_x, kDataLen * sizeof(float));' %t` -eq 2"
cudaMalloc(&device_x, kDataLen * sizeof(float));
// RUN: sh -c "test `grep -c -F 'hipMalloc(&device_y, kDataLen * sizeof(float));' %t` -eq 2"
cudaMalloc(&device_y, kDataLen * sizeof(float));
// RUN: sh -c "test `grep -c -F 'hipMemcpy(device_x, host_x, kDataLen * sizeof(float), hipMemcpyHostToDevice);' %t` -eq 2"
cudaMemcpy(device_x, host_x, kDataLen * sizeof(float), cudaMemcpyHostToDevice);
// Launch the kernel.
// CHECK: hipLaunchKernel(HIP_KERNEL_NAME(axpy), dim3(1), dim3(kDataLen), 0, 0, a, device_x, device_y);
// RUN: sh -c "test `grep -c -F 'hipLaunchKernel(HIP_KERNEL_NAME(axpy), dim3(1), dim3(kDataLen), 0, 0, a, device_x, device_y);' %t` -eq 2"
axpy<<<1, kDataLen>>>(a, device_x, device_y);
// Copy output data to host.
// RUN: sh -c "test `grep -c -F 'hipDeviceSynchronize();' %t` -eq 2"
cudaDeviceSynchronize();
// RUN: sh -c "test `grep -c -F 'hipMemcpy(host_y, device_y, kDataLen * sizeof(float), hipMemcpyDeviceToHost);' %t` -eq 2"
cudaMemcpy(host_y, device_y, kDataLen * sizeof(float), cudaMemcpyDeviceToHost);
// Print the results.
@@ -35,6 +39,7 @@ int main(int argc, char* argv[]) {
std::cout << "y[" << i << "] = " << host_y[i] << "\n";
}
// RUN: sh -c "test `grep -c -F 'hipDeviceReset();' %t` -eq 2"
cudaDeviceReset();
return 0;
}
-7
查看文件
@@ -44,12 +44,5 @@ if obj_root is not None:
path = os.path.pathsep.join((llvm_tools_dir, config.environment['PATH']))
config.environment['PATH'] = path
tool_name = "FileCheck"
tool_path = lit.util.which(tool_name, llvm_tools_dir)
if not tool_path:
# Warn, but still provide a substitution.
lit_config.note('Did not find ' + tool_name + ' in ' + llvm_tools_dir)
tool_path = llvm_tools_dir + '/' + tool_name
config.substitutions.append((tool_name, tool_path))
config.substitutions.append(("hipify", obj_root+"/hipify"))