From e4c94b33d2de9f756429a68eee8407b7fe9f3452 Mon Sep 17 00:00:00 2001 From: yangbinfa Date: Sat, 30 Nov 2024 16:32:32 +0800 Subject: [PATCH 1/5] [Build][OpenMP] Enable OpenMP compilation Enable the compilation of both static and dynamic libraries for libomp, disable the use of shm_open on OHOS, and modify the lit scripts and lit.cfg within OpenMP to support running OpenMP test suites on remote devices. Issue: https://gitee.com/openharmony/third_party_llvm-project/issues/IB4NCH?from=project-issue Signed-off-by: yangbinfa --- llvm-build/build.py | 21 ++++++++++++----- llvm/utils/lit/lit/TestRunner.py | 20 ++++++++++++++-- llvm/utils/lit/lit/TestingConfig.py | 4 ++++ openmp/runtime/src/kmp_config.h.cmake | 4 ++-- openmp/runtime/test/affinity/format/nested.c | 2 +- openmp/runtime/test/affinity/format/nested2.c | 2 +- .../test/affinity/format/nested_mixed.c | 2 +- .../test/affinity/format/nested_serial.c | 2 +- openmp/runtime/test/lit.cfg | 23 +++++++++++++++++-- openmp/tools/multiplex/tests/lit.cfg | 20 +++++++++++++++- 10 files changed, 83 insertions(+), 17 deletions(-) diff --git a/llvm-build/build.py b/llvm-build/build.py index 5b01a6600bc5..4459e122e246 100755 --- a/llvm-build/build.py +++ b/llvm-build/build.py @@ -643,6 +643,8 @@ class BuildUtils(object): defines['COMPILER_RT_BUILD_XRAY'] = 'OFF' defines['LIBUNWIND_USE_FRAME_HEADER_CACHE'] = 'ON' + defines['OPENMP_ENABLE_LIBOMPTARGET'] = 'OFF' + defines['LIBOMP_INSTALL_ALIASES'] = 'False' return defines def get_python_dir(self): @@ -1570,6 +1572,7 @@ class LlvmLibs(BuildUtils): self.open_ohos_triple('aarch64'), self.open_ohos_triple('riscv64'), self.open_ohos_triple('mipsel'), self.open_ohos_triple('x86_64'), self.open_ohos_triple('loongarch64')] + omp_list = [self.open_ohos_triple("aarch64"), self.open_ohos_triple("arm"), self.open_ohos_triple('x86_64')] libcxx_ndk_install = self.merge_out_path('libcxx-ndk') self.check_create_dir(libcxx_ndk_install) @@ -1591,9 +1594,11 @@ class LlvmLibs(BuildUtils): self.build_lldb_tools(llvm_install, llvm_path, arch, llvm_triple, cflags, ldflags, defines) seen_arch_list.append(llvm_triple) + if llvm_triple in omp_list: + self.build_libomp(llvm_install, arch, llvm_triple, cflags, ldflags, multilib_suffix, defines, 'TRUE') + self.build_libomp(llvm_install, arch, llvm_triple, cflags, ldflags, multilib_suffix, defines, 'FALSE') continue - self.build_libomp(llvm_install, arch, llvm_triple, cflags, ldflags, multilib_suffix, defines) self.build_libz(arch, llvm_triple, cflags, ldflags, defines) if self.build_config.need_lldb_tools and has_lldb_tools and llvm_triple not in seen_arch_list: self.build_lldb_tools(llvm_install, llvm_path, arch, llvm_triple, cflags, ldflags, defines) @@ -1791,8 +1796,8 @@ class LlvmLibs(BuildUtils): cflags, ldflags, multilib_suffix, - defines): - + defines, + enable_shared): self.logger().info('Building libomp for %s', arch) libomp_path = self.merge_out_path('lib', 'libomp-%s' % llvm_triple) @@ -1813,7 +1818,7 @@ class LlvmLibs(BuildUtils): libomp_defines['OPENMP_ENABLE_LIBOMPTARGET'] = 'FALSE' libomp_defines['OPENMP_LIBDIR_SUFFIX'] = os.path.join(os.sep, llvm_triple, multilib_suffix) - libomp_defines['LIBOMP_ENABLE_SHARED'] = 'FALSE' + libomp_defines['LIBOMP_ENABLE_SHARED'] = enable_shared libomp_defines['CMAKE_POLICY_DEFAULT_CMP0056'] = 'NEW' libomp_defines['CMAKE_INSTALL_PREFIX'] = llvm_install libomp_defines['COMPILER_RT_USE_BUILTINS_LIBRARY'] = 'ON' @@ -1823,13 +1828,17 @@ class LlvmLibs(BuildUtils): libomp_defines['CMAKE_TRY_COMPILE_TARGET_TYPE'] = 'STATIC_LIBRARY' libomp_cmake_path = os.path.join(self.build_config.LLVM_PROJECT_DIR, 'openmp') - self.rm_cmake_cache(libomp_path) + + if enable_shared == "TRUE": + libomp_path = os.path.join(libomp_path, "shared") + else: + libomp_path = os.path.join(libomp_path, "static") + self.rm_cmake_cache(libomp_path) self.invoke_cmake(libomp_cmake_path, libomp_path, libomp_defines, env=dict(self.build_config.ORIG_ENV)) - self.invoke_ninja(out_path=libomp_path, env=dict(self.build_config.ORIG_ENV), target=None, diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py index 0242e0b75af3..4a38b1f1b9b1 100644 --- a/llvm/utils/lit/lit/TestRunner.py +++ b/llvm/utils/lit/lit/TestRunner.py @@ -1722,7 +1722,7 @@ def _runShTest(test, litConfig, useExternalSh, script, tmpBase): def executeShTest(test, litConfig, useExternalSh, extra_substitutions=[], - preamble_commands=[]): + preamble_commands=[]): if test.config.unsupported: return lit.Test.Result(Test.UNSUPPORTED, 'Test is unsupported') @@ -1734,6 +1734,9 @@ def executeShTest(test, litConfig, useExternalSh, if litConfig.noExecute: return lit.Test.Result(Test.PASS) + # Setting environment variables on a remote device, this command is used only for OpenMP test. + if test.config.operating_system == 'OHOS': + script = replaceEnvrunForScript(script) tmpDir, tmpBase = getTempPaths(test) substitutions = list(extra_substitutions) @@ -1742,5 +1745,18 @@ def executeShTest(test, litConfig, useExternalSh, conditions = { feature: True for feature in test.config.available_features } script = applySubstitutions(script, substitutions, conditions, recursion_limit=test.config.recursiveExpansionLimit) - return _runShTest(test, litConfig, useExternalSh, script, tmpBase) + +def replaceEnvrunForScript(script): + """ + Replace `env xxxx %libomp-run` in the script with `%libomp-env-run env xxxx %root-path%t`. + """ + newScript = [] + pattern = re.compile(r"(env\s+.*?)(\s+%libomp-run)") + replacement = r'%libomp-env-run \1 %root-path%t' + for ln in script: + if pattern.search(ln): + newScript.append(pattern.sub(replacement, ln)) + else: + newScript.append(ln) + return newScript \ No newline at end of file diff --git a/llvm/utils/lit/lit/TestingConfig.py b/llvm/utils/lit/lit/TestingConfig.py index 55e2a764d8fa..e5d752f017aa 100644 --- a/llvm/utils/lit/lit/TestingConfig.py +++ b/llvm/utils/lit/lit/TestingConfig.py @@ -43,6 +43,10 @@ class TestingConfig(object): 'ADB', 'ANDROID_SERIAL', 'SSH_AUTH_SOCK', + 'HDC', + 'HDC_SERVER', + 'HDC_TARGET_SERIAL', + 'LIB_PATH_ON_TARGET', 'SANITIZER_IGNORE_CVE_2016_2143', 'TMPDIR', 'TMP', diff --git a/openmp/runtime/src/kmp_config.h.cmake b/openmp/runtime/src/kmp_config.h.cmake index 40d20115c9ec..7e8dad4ca6c9 100644 --- a/openmp/runtime/src/kmp_config.h.cmake +++ b/openmp/runtime/src/kmp_config.h.cmake @@ -134,9 +134,9 @@ # define KMP_GOMP_COMPAT #endif -// use shared memory with dynamic library (except Android, where shm_* +// use shared memory with dynamic library (except Android and OHOS, where shm_* // functions don't exist). -#if KMP_OS_UNIX && KMP_DYNAMIC_LIB && !__ANDROID__ +#if KMP_OS_UNIX && KMP_DYNAMIC_LIB && !__ANDROID__ && !__OHOS__ #define KMP_USE_SHM #endif #endif // KMP_CONFIG_H diff --git a/openmp/runtime/test/affinity/format/nested.c b/openmp/runtime/test/affinity/format/nested.c index db2e607bf8e6..6928eddaba59 100644 --- a/openmp/runtime/test/affinity/format/nested.c +++ b/openmp/runtime/test/affinity/format/nested.c @@ -1,4 +1,4 @@ -// RUN: %libomp-compile && env OMP_DISPLAY_AFFINITY=true OMP_PLACES=threads OMP_PROC_BIND=spread,close %libomp-run | %python %S/check.py -c 'CHECK' %s +// RUN: %libomp-compile && env OMP_DISPLAY_AFFINITY=true OMP_PLACES=threads OMP_PROC_BIND=spread,close KMP_WARNINGS=false %libomp-run | %python %S/check.py -c 'CHECK' %s // REQUIRES: affinity #include diff --git a/openmp/runtime/test/affinity/format/nested2.c b/openmp/runtime/test/affinity/format/nested2.c index f259aeace0d6..cb2eea451c06 100644 --- a/openmp/runtime/test/affinity/format/nested2.c +++ b/openmp/runtime/test/affinity/format/nested2.c @@ -1,4 +1,4 @@ -// RUN: %libomp-compile && env OMP_DISPLAY_AFFINITY=true OMP_PLACES=threads OMP_PROC_BIND=spread,close KMP_HOT_TEAMS_MAX_LEVEL=2 %libomp-run | %python %S/check.py -c 'CHECK' %s +// RUN: %libomp-compile && env OMP_DISPLAY_AFFINITY=true OMP_PLACES=threads OMP_PROC_BIND=spread,close KMP_HOT_TEAMS_MAX_LEVEL=2 KMP_WARNINGS=false %libomp-run | %python %S/check.py -c 'CHECK' %s #include #include diff --git a/openmp/runtime/test/affinity/format/nested_mixed.c b/openmp/runtime/test/affinity/format/nested_mixed.c index 288e1c21c2bf..2acdc02a0db6 100644 --- a/openmp/runtime/test/affinity/format/nested_mixed.c +++ b/openmp/runtime/test/affinity/format/nested_mixed.c @@ -1,4 +1,4 @@ -// RUN: %libomp-compile && env OMP_DISPLAY_AFFINITY=true %libomp-run | %python %S/check.py -c 'CHECK' %s +// RUN: %libomp-compile && env OMP_DISPLAY_AFFINITY=true KMP_WARNINGS=false %libomp-run | %python %S/check.py -c 'CHECK' %s #include #include diff --git a/openmp/runtime/test/affinity/format/nested_serial.c b/openmp/runtime/test/affinity/format/nested_serial.c index 70ccf5be3c84..9da9d4658d62 100644 --- a/openmp/runtime/test/affinity/format/nested_serial.c +++ b/openmp/runtime/test/affinity/format/nested_serial.c @@ -1,4 +1,4 @@ -// RUN: %libomp-compile && env OMP_DISPLAY_AFFINITY=true %libomp-run | %python %S/check.py -c 'CHECK' %s +// RUN: %libomp-compile && env OMP_DISPLAY_AFFINITY=true KMP_WARNINGS=false %libomp-run | %python %S/check.py -c 'CHECK' %s #include #include diff --git a/openmp/runtime/test/lit.cfg b/openmp/runtime/test/lit.cfg index 45e65d9c3ef6..32faec52ffdd 100644 --- a/openmp/runtime/test/lit.cfg +++ b/openmp/runtime/test/lit.cfg @@ -51,6 +51,9 @@ if config.has_omit_frame_pointer_flag: config.test_flags = " -I " + config.omp_header_directory + flags config.test_flags_use_compiler_omp_h = flags +# OHOS LOCAL +if config.operating_system == 'OHOS': + config.test_flags += " --target=aarch64-linux-ohos" # extra libraries libs = "" @@ -105,7 +108,7 @@ if 'Linux' in config.operating_system: if config.operating_system == 'NetBSD': config.available_features.add("netbsd") -if config.operating_system in ['Linux', 'Windows']: +if config.operating_system in ['Linux', 'Windows', 'OHOS']: config.available_features.add('affinity') import multiprocessing @@ -134,7 +137,23 @@ config.substitutions.append(("%libomp-compile", \ "%clang %openmp_flags %flags %s -o %t" + libs)) config.substitutions.append(("%libomp-c99-compile", \ "%clang %openmp_flags %flags -std=c99 %s -o %t" + libs)) -config.substitutions.append(("%libomp-run", "%t")) + +if config.operating_system == 'OHOS': + # Settings required to run test cases remotely on OHOS + if not (config.environment.get('HDC') != None and config.environment.get('HDC_SERVER') != None + and config.environment.get('HDC_TARGET_SERIAL') != None and config.environment.get('LIB_PATH_ON_TARGET') != None): + raise ValueError("Error: One or more environment variables in HDC, HDC_SERVER, HDC_TARGET_SERIAL or LIB_PATH_ON_TARGET are not set.") + hdc = f"{config.environment['HDC']} -s {config.environment['HDC_SERVER']} -t {config.environment['HDC_TARGET_SERIAL']}" + cmd_set_ld_library_path = f"env LD_LIBRARY_PATH={config.environment['LIB_PATH_ON_TARGET']}:$LD_LIBRARY_PATH" + cmd_mkdir_to_device = f"{hdc} shell mkdir -p /data/local/temp/$(dirname %t)" + cmd_push_to_device = f"{hdc} file send %t %root-path%t" + cmd_chmod_to_test = f"{hdc} shell chmod 755 %root-path%t" + cmd_run_on_device = f"{hdc} shell {cmd_set_ld_library_path} %root-path%t" + config.substitutions.append(("%libomp-env-run", f"{cmd_mkdir_to_device} && {cmd_push_to_device} && {cmd_chmod_to_test} && {hdc} shell {cmd_set_ld_library_path}")) + config.substitutions.append(("%libomp-run", f"{cmd_mkdir_to_device} && {cmd_push_to_device} && {cmd_chmod_to_test} && {cmd_run_on_device}")) + config.substitutions.append(("%root-path", "/data/local/temp")) +else: + config.substitutions.append(("%libomp-run", "%t")) config.substitutions.append(("%clangXX", config.test_cxx_compiler)) config.substitutions.append(("%clang", config.test_c_compiler)) config.substitutions.append(("%openmp_flags", config.test_openmp_flags)) diff --git a/openmp/tools/multiplex/tests/lit.cfg b/openmp/tools/multiplex/tests/lit.cfg index 69df2fd944cb..b65de5bf6cf2 100644 --- a/openmp/tools/multiplex/tests/lit.cfg +++ b/openmp/tools/multiplex/tests/lit.cfg @@ -67,6 +67,10 @@ append_dynamic_library_path(config.test_obj_root+"/..") if config.operating_system == 'Darwin': config.test_flags += " -Wl,-rpath," + config.omp_library_dir +# OHOS LOCAL +if config.operating_system == 'OHOS': + config.test_flags += " --target=aarch64-linux-ohos" + # Find the SDK on Darwin if config.operating_system == 'Darwin': cmd = subprocess.Popen(['xcrun', '--show-sdk-path'], @@ -90,7 +94,21 @@ config.substitutions.append(("%libomp-compile", \ "%clang %cflags %s -o %t")) config.substitutions.append(("%libomp-tool", \ "%clang %cflags -shared -fPIC -g")) -config.substitutions.append(("%libomp-run", "%t")) +if config.operating_system == 'OHOS': + if not (config.environment.get('HDC') != None and config.environment.get('HDC_SERVER') != None + and config.environment.get('HDC_TARGET_SERIAL') != None and config.environment.get('LIB_PATH_ON_TARGET') != None): + raise ValueError("Error: One or more environment variables in HDC, HDC_SERVER, HDC_TARGET_SERIAL or LIB_PATH_ON_TARGET are not set.") + hdc = f"{config.environment['HDC']} -s {config.environment['HDC_SERVER']} -t {config.environment['HDC_TARGET_SERIAL']}" + cmd_set_ld_library_path = f"env LD_LIBRARY_PATH={config.environment['LIB_PATH_ON_TARGET']}:$LD_LIBRARY_PATH" + cmd_mkdir_to_device = f"{hdc} shell mkdir -p /data/local/temp/$(dirname %t)" + cmd_push_to_device = f"{hdc} file send %t %root-path%t" + cmd_chmod_to_test = f"{hdc} shell chmod 755 %root-path%t" + cmd_run_on_device = f"{hdc} shell {cmd_set_ld_library_path} %root-path%t" + config.substitutions.append(("%libomp-env-run", f"{cmd_mkdir_to_device} && {cmd_push_to_device} && {cmd_chmod_to_test} && {hdc} shell {cmd_set_ld_library_path}")) + config.substitutions.append(("%libomp-run", f"{cmd_mkdir_to_device} && {cmd_push_to_device} && {cmd_chmod_to_test} && {cmd_run_on_device}")) + config.substitutions.append(("%root-path", "/data/local/temp")) +else: + config.substitutions.append(("%libomp-run", "%t")) config.substitutions.append(("%clang", config.test_c_compiler)) config.substitutions.append(("%openmp_flag", config.test_openmp_flags)) config.substitutions.append(("%cflags", config.test_flags)) -- Gitee From 341d84b4b56a61b92c4992ffd30d213264779de8 Mon Sep 17 00:00:00 2001 From: yangbinfa Date: Mon, 2 Dec 2024 10:45:47 +0800 Subject: [PATCH 2/5] lldb unit test failed fix In LLDB lit tests, litconfig does not set operating_system, which leads an error.So add a condition to check the module name in the lit test. Signed-off-by: yangbinfa --- llvm/utils/lit/lit/TestRunner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py index 4a38b1f1b9b1..ccd6e756158d 100644 --- a/llvm/utils/lit/lit/TestRunner.py +++ b/llvm/utils/lit/lit/TestRunner.py @@ -1735,7 +1735,7 @@ def executeShTest(test, litConfig, useExternalSh, if litConfig.noExecute: return lit.Test.Result(Test.PASS) # Setting environment variables on a remote device, this command is used only for OpenMP test. - if test.config.operating_system == 'OHOS': + if (test.config.name == 'libomp' or test.config.name == 'OMPT multiplex') and test.config.operating_system == 'OHOS': script = replaceEnvrunForScript(script) tmpDir, tmpBase = getTempPaths(test) -- Gitee From 1d2f5ac245ce22cc07923f0c07f2c43061acab50 Mon Sep 17 00:00:00 2001 From: yangbinfa Date: Wed, 4 Dec 2024 18:36:36 +0800 Subject: [PATCH 3/5] Add OHOS_LOCAL labels. Signed-off-by: yangbinfa --- llvm/utils/lit/lit/TestRunner.py | 3 ++- openmp/runtime/test/lit.cfg | 4 +++- openmp/tools/multiplex/tests/lit.cfg | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py index ccd6e756158d..ca48b4a7ad3f 100644 --- a/llvm/utils/lit/lit/TestRunner.py +++ b/llvm/utils/lit/lit/TestRunner.py @@ -1734,10 +1734,11 @@ def executeShTest(test, litConfig, useExternalSh, if litConfig.noExecute: return lit.Test.Result(Test.PASS) + # OHOS_LOCAL begin # Setting environment variables on a remote device, this command is used only for OpenMP test. if (test.config.name == 'libomp' or test.config.name == 'OMPT multiplex') and test.config.operating_system == 'OHOS': script = replaceEnvrunForScript(script) - + # OHOS_LOCAL end tmpDir, tmpBase = getTempPaths(test) substitutions = list(extra_substitutions) substitutions += getDefaultSubstitutions(test, tmpDir, tmpBase, diff --git a/openmp/runtime/test/lit.cfg b/openmp/runtime/test/lit.cfg index 32faec52ffdd..96a6b7543398 100644 --- a/openmp/runtime/test/lit.cfg +++ b/openmp/runtime/test/lit.cfg @@ -138,6 +138,7 @@ config.substitutions.append(("%libomp-compile", \ config.substitutions.append(("%libomp-c99-compile", \ "%clang %openmp_flags %flags -std=c99 %s -o %t" + libs)) +# OHOS_LOCAL begin if config.operating_system == 'OHOS': # Settings required to run test cases remotely on OHOS if not (config.environment.get('HDC') != None and config.environment.get('HDC_SERVER') != None @@ -151,7 +152,8 @@ if config.operating_system == 'OHOS': cmd_run_on_device = f"{hdc} shell {cmd_set_ld_library_path} %root-path%t" config.substitutions.append(("%libomp-env-run", f"{cmd_mkdir_to_device} && {cmd_push_to_device} && {cmd_chmod_to_test} && {hdc} shell {cmd_set_ld_library_path}")) config.substitutions.append(("%libomp-run", f"{cmd_mkdir_to_device} && {cmd_push_to_device} && {cmd_chmod_to_test} && {cmd_run_on_device}")) - config.substitutions.append(("%root-path", "/data/local/temp")) + config.substitutions.append(("%root-path", "/data/local/temp")) +# OHOS_LOCAL end else: config.substitutions.append(("%libomp-run", "%t")) config.substitutions.append(("%clangXX", config.test_cxx_compiler)) diff --git a/openmp/tools/multiplex/tests/lit.cfg b/openmp/tools/multiplex/tests/lit.cfg index b65de5bf6cf2..3e0666d360e6 100644 --- a/openmp/tools/multiplex/tests/lit.cfg +++ b/openmp/tools/multiplex/tests/lit.cfg @@ -94,6 +94,8 @@ config.substitutions.append(("%libomp-compile", \ "%clang %cflags %s -o %t")) config.substitutions.append(("%libomp-tool", \ "%clang %cflags -shared -fPIC -g")) + +# OHOS_LOCAL begin if config.operating_system == 'OHOS': if not (config.environment.get('HDC') != None and config.environment.get('HDC_SERVER') != None and config.environment.get('HDC_TARGET_SERIAL') != None and config.environment.get('LIB_PATH_ON_TARGET') != None): @@ -106,7 +108,8 @@ if config.operating_system == 'OHOS': cmd_run_on_device = f"{hdc} shell {cmd_set_ld_library_path} %root-path%t" config.substitutions.append(("%libomp-env-run", f"{cmd_mkdir_to_device} && {cmd_push_to_device} && {cmd_chmod_to_test} && {hdc} shell {cmd_set_ld_library_path}")) config.substitutions.append(("%libomp-run", f"{cmd_mkdir_to_device} && {cmd_push_to_device} && {cmd_chmod_to_test} && {cmd_run_on_device}")) - config.substitutions.append(("%root-path", "/data/local/temp")) + config.substitutions.append(("%root-path", "/data/local/temp")) +# OHOS_LOCAL end else: config.substitutions.append(("%libomp-run", "%t")) config.substitutions.append(("%clang", config.test_c_compiler)) -- Gitee From b45c78f02e822ecb0e7035669e98f0f5ff9ff9f3 Mon Sep 17 00:00:00 2001 From: yangbinfa Date: Thu, 5 Dec 2024 21:04:50 +0800 Subject: [PATCH 4/5] Use %platform-flag substition to set KMP_WARNINGS=false flag. Signed-off-by: yangbinfa --- openmp/runtime/test/affinity/format/nested.c | 2 +- openmp/runtime/test/affinity/format/nested2.c | 2 +- openmp/runtime/test/affinity/format/nested_mixed.c | 2 +- openmp/runtime/test/affinity/format/nested_serial.c | 2 +- openmp/runtime/test/lit.cfg | 4 +++- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/openmp/runtime/test/affinity/format/nested.c b/openmp/runtime/test/affinity/format/nested.c index 6928eddaba59..1d8bc8cb35c3 100644 --- a/openmp/runtime/test/affinity/format/nested.c +++ b/openmp/runtime/test/affinity/format/nested.c @@ -1,4 +1,4 @@ -// RUN: %libomp-compile && env OMP_DISPLAY_AFFINITY=true OMP_PLACES=threads OMP_PROC_BIND=spread,close KMP_WARNINGS=false %libomp-run | %python %S/check.py -c 'CHECK' %s +// RUN: %libomp-compile && env OMP_DISPLAY_AFFINITY=true OMP_PLACES=threads OMP_PROC_BIND=spread,close %platform-flag %libomp-run | %python %S/check.py -c 'CHECK' %s // REQUIRES: affinity #include diff --git a/openmp/runtime/test/affinity/format/nested2.c b/openmp/runtime/test/affinity/format/nested2.c index cb2eea451c06..059ea6a9c425 100644 --- a/openmp/runtime/test/affinity/format/nested2.c +++ b/openmp/runtime/test/affinity/format/nested2.c @@ -1,4 +1,4 @@ -// RUN: %libomp-compile && env OMP_DISPLAY_AFFINITY=true OMP_PLACES=threads OMP_PROC_BIND=spread,close KMP_HOT_TEAMS_MAX_LEVEL=2 KMP_WARNINGS=false %libomp-run | %python %S/check.py -c 'CHECK' %s +// RUN: %libomp-compile && env OMP_DISPLAY_AFFINITY=true OMP_PLACES=threads OMP_PROC_BIND=spread,close KMP_HOT_TEAMS_MAX_LEVEL=2 %platform-flag %libomp-run | %python %S/check.py -c 'CHECK' %s #include #include diff --git a/openmp/runtime/test/affinity/format/nested_mixed.c b/openmp/runtime/test/affinity/format/nested_mixed.c index 2acdc02a0db6..dd1376a07b64 100644 --- a/openmp/runtime/test/affinity/format/nested_mixed.c +++ b/openmp/runtime/test/affinity/format/nested_mixed.c @@ -1,4 +1,4 @@ -// RUN: %libomp-compile && env OMP_DISPLAY_AFFINITY=true KMP_WARNINGS=false %libomp-run | %python %S/check.py -c 'CHECK' %s +// RUN: %libomp-compile && env OMP_DISPLAY_AFFINITY=true %platform-flag %libomp-run | %python %S/check.py -c 'CHECK' %s #include #include diff --git a/openmp/runtime/test/affinity/format/nested_serial.c b/openmp/runtime/test/affinity/format/nested_serial.c index 9da9d4658d62..5e0ffc9cbbaf 100644 --- a/openmp/runtime/test/affinity/format/nested_serial.c +++ b/openmp/runtime/test/affinity/format/nested_serial.c @@ -1,4 +1,4 @@ -// RUN: %libomp-compile && env OMP_DISPLAY_AFFINITY=true KMP_WARNINGS=false %libomp-run | %python %S/check.py -c 'CHECK' %s +// RUN: %libomp-compile && env OMP_DISPLAY_AFFINITY=true %platform-flag %libomp-run | %python %S/check.py -c 'CHECK' %s #include #include diff --git a/openmp/runtime/test/lit.cfg b/openmp/runtime/test/lit.cfg index 96a6b7543398..d4507c06d865 100644 --- a/openmp/runtime/test/lit.cfg +++ b/openmp/runtime/test/lit.cfg @@ -152,10 +152,12 @@ if config.operating_system == 'OHOS': cmd_run_on_device = f"{hdc} shell {cmd_set_ld_library_path} %root-path%t" config.substitutions.append(("%libomp-env-run", f"{cmd_mkdir_to_device} && {cmd_push_to_device} && {cmd_chmod_to_test} && {hdc} shell {cmd_set_ld_library_path}")) config.substitutions.append(("%libomp-run", f"{cmd_mkdir_to_device} && {cmd_push_to_device} && {cmd_chmod_to_test} && {cmd_run_on_device}")) - config.substitutions.append(("%root-path", "/data/local/temp")) + config.substitutions.append(("%root-path", "/data/local/temp")) + config.substitutions.append(("%platform-flag", "KMP_WARNINGS=false")) # OHOS_LOCAL end else: config.substitutions.append(("%libomp-run", "%t")) + config.substitutions.append(("%platform-flag", "")) config.substitutions.append(("%clangXX", config.test_cxx_compiler)) config.substitutions.append(("%clang", config.test_c_compiler)) config.substitutions.append(("%openmp_flags", config.test_openmp_flags)) -- Gitee From 569edf7f961e88ec98a2277d22ab8c12fbcf018a Mon Sep 17 00:00:00 2001 From: yangbinfa Date: Fri, 6 Dec 2024 10:51:12 +0800 Subject: [PATCH 5/5] Delete extra white spaces. Signed-off-by: yangbinfa --- llvm/utils/lit/lit/TestRunner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py index ca48b4a7ad3f..4eceea37a05d 100644 --- a/llvm/utils/lit/lit/TestRunner.py +++ b/llvm/utils/lit/lit/TestRunner.py @@ -1722,7 +1722,7 @@ def _runShTest(test, litConfig, useExternalSh, script, tmpBase): def executeShTest(test, litConfig, useExternalSh, extra_substitutions=[], - preamble_commands=[]): + preamble_commands=[]): if test.config.unsupported: return lit.Test.Result(Test.UNSUPPORTED, 'Test is unsupported') -- Gitee