From 36f569cba6a184a73e7a8e3e34bfb9b2d518f25d Mon Sep 17 00:00:00 2001 From: Evgeny Mankov Date: Wed, 6 Mar 2019 19:26:05 +0300 Subject: [PATCH] [HIPIFY][tests] Update lit testing infrastructure + Set -D__LP64__ in case of 64-bit hipify-clang binary [partial workaround for clang's bug https://bugs.llvm.org/show_bug.cgi?id=38811] C:/GIT/LLVM/trunk/llvm-64-release-vs2017/dist/lib/clang/9.0.0\include\__clang_cuda_device_functions.h(1609,45): error GEF7559A7: no matching function for call to 'roundf' __DEVICE__ long lroundf(float __a) { return roundf(__a); } #if defined(__LP64__) __DEVICE__ long lround(double __a) { return llround(__a); } __DEVICE__ long lroundf(float __a) { return llroundf(__a); } // ok: llroundf should be used when 64-bit #else __DEVICE__ long lround(double __a) { return round(__a); } __DEVICE__ long lroundf(float __a) { return roundf(__a); } // error #endif + Print more system info while testing in the following form: ======================================== CUDA 9.0 - will be used for testing LLVM 9.0.0svn - will be used for testing AMD64 - Platform architecture Windows 10 - Platform OS 64 - hipify-clang binary bitness 32 - python 3.7.2 binary bitness ======================================== [ROCm/clr commit: f138f89bc8ec608076c895de632b4d2884b1fbe6] --- projects/clr/hipamd/tests/hipify-clang/lit.cfg | 12 +++++++++++- .../clr/hipamd/tests/hipify-clang/lit.site.cfg.in | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/projects/clr/hipamd/tests/hipify-clang/lit.cfg b/projects/clr/hipamd/tests/hipify-clang/lit.cfg index 00a3eeb873..594d5fcf69 100644 --- a/projects/clr/hipamd/tests/hipify-clang/lit.cfg +++ b/projects/clr/hipamd/tests/hipify-clang/lit.cfg @@ -3,6 +3,7 @@ import os import platform import re import subprocess +import struct import lit.formats import lit.util @@ -11,7 +12,14 @@ import lit.util site_cfg = lit_config.params.get('site_config', None) lit_config.load_config(config, site_cfg) -print("CUDA " + config.cuda_version + " will be used for testing.") +print(str("========================================")) +print("CUDA " + config.cuda_version + " - will be used for testing") +print("LLVM " + config.llvm_version + " - will be used for testing") +print(platform.machine() + " - Platform architecture") +print(platform.system() + " " + platform.release() + " - Platform OS") +print(str(config.pointer_size * 8) + " - hipify-clang binary bitness") +print(str(struct.calcsize("P") * 8) + " - python " + str(platform.python_version()) + " binary bitness") +print(str("========================================")) config.excludes = ['cmdparser.hpp'] config.excludes.append('spatial_batch_norm_op.h') @@ -77,6 +85,8 @@ else: run_test_ext = ".sh" clang_arguments += " -isystem'%s'/samples/common/inc" clang_arguments += " -I'%s'/include" +if config.pointer_size == 8: + clang_arguments += " -D__LP64__" hipify_arguments = "--cuda-path='%s'" diff --git a/projects/clr/hipamd/tests/hipify-clang/lit.site.cfg.in b/projects/clr/hipamd/tests/hipify-clang/lit.site.cfg.in index f93c206be4..71cc3e08d3 100644 --- a/projects/clr/hipamd/tests/hipify-clang/lit.site.cfg.in +++ b/projects/clr/hipamd/tests/hipify-clang/lit.site.cfg.in @@ -1,6 +1,8 @@ import sys import os +config.pointer_size = @CMAKE_SIZEOF_VOID_P@ +config.llvm_version = "@LLVM_PACKAGE_VERSION@" config.llvm_tools_dir = "@LLVM_TOOLS_BINARY_DIR@" config.obj_root = "@CMAKE_CURRENT_BINARY_DIR@" config.cuda_root = "@CUDA_TOOLKIT_ROOT_DIR@" @@ -32,4 +34,3 @@ except KeyError: e = sys.exc_info()[1] key, = e.args lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key)) -