diff --git a/projects/clr/hipamd/README.md b/projects/clr/hipamd/README.md index 743a1a63b2..0b37244def 100644 --- a/projects/clr/hipamd/README.md +++ b/projects/clr/hipamd/README.md @@ -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 diff --git a/projects/clr/hipamd/test/CMakeLists.txt b/projects/clr/hipamd/test/CMakeLists.txt index 5a0250381d..ba472ad2ee 100644 --- a/projects/clr/hipamd/test/CMakeLists.txt +++ b/projects/clr/hipamd/test/CMakeLists.txt @@ -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) diff --git a/projects/clr/hipamd/test/axpy.cu b/projects/clr/hipamd/test/axpy.cu index 92f61267a4..8472e60209 100644 --- a/projects/clr/hipamd/test/axpy.cu +++ b/projects/clr/hipamd/test/axpy.cu @@ -1,10 +1,9 @@ // RUN: hipify "%s" -o=%t -- -// RUN: FileCheck %s -input-file=%t --match-full-lines #include __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; } diff --git a/projects/clr/hipamd/test/lit.cfg b/projects/clr/hipamd/test/lit.cfg index d9606b48fc..5c070ae053 100644 --- a/projects/clr/hipamd/test/lit.cfg +++ b/projects/clr/hipamd/test/lit.cfg @@ -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"))