From b9549261e218cee2ad1305fb7272b831799b7bfe Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Wed, 5 Jun 2024 14:43:58 +0100 Subject: [Flang][OpenMP] Add -fopenmp-force-usm option to flang (#94359) This patch enables the `-fopenmp-force-usm` option to be passed to the flang driver, which forwards it to the compiler frontend. This flag, when set, results in the introduction of the `unified_shared_memory` bit to the `omp.requires` attribute of the top-level module operation. This is later combined with any other target device-related REQUIRES clauses that may have been explicitly set in the compilation unit. --- flang/lib/Frontend/CompilerInvocation.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'flang/lib/Frontend/CompilerInvocation.cpp') diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp index 50c3e8b..f64a939 100644 --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -906,6 +906,9 @@ static bool parseDialectArgs(CompilerInvocation &res, llvm::opt::ArgList &args, res.getLangOpts().OpenMPVersion, diags)) { res.getLangOpts().OpenMPVersion = Version; } + if (args.hasArg(clang::driver::options::OPT_fopenmp_force_usm)) { + res.getLangOpts().OpenMPForceUSM = 1; + } if (args.hasArg(clang::driver::options::OPT_fopenmp_is_target_device)) { res.getLangOpts().OpenMPIsTargetDevice = 1; -- cgit v1.1