public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Chung-Lin Tang <cltang@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/omp/gcc-11] libgomp: Fix GOMP_DEVICE_NUM_VAR stringification during offload image load Date: Tue, 4 Jan 2022 09:31:56 +0000 (GMT) [thread overview] Message-ID: <20220104093156.BD6B33858430@sourceware.org> (raw) https://gcc.gnu.org/g:b5435aab8658396c9209027007eed268fa9232f1 commit b5435aab8658396c9209027007eed268fa9232f1 Author: Chung-Lin Tang <cltang@codesourcery.com> Date: Tue Jan 4 17:26:23 2022 +0800 libgomp: Fix GOMP_DEVICE_NUM_VAR stringification during offload image load In the patch that implemented omp_get_device_num(), there was an error where the stringification of GOMP_DEVICE_NUM_VAR, which is the macro expanding to the actual symbol used, was erroneously using the STRINGX() macro in the libgomp offload image symbol search, and expansion of the variable name string through the additional layer of preprocessor symbol was not properly achieved. This patch fixes this by changing to properly use XSTRING(), also from include/symcat.h. libgomp/ChangeLog: * plugin/plugin-gcn.c (GOMP_OFFLOAD_load_image): Change uses of STRINGX into XSTRING when looking for GOMP_DEVICE_NUM_VAR in offload image. * plugin/plugin-nvptx.c (GOMP_OFFLOAD_load_image): Likewise. (cherry picked from commit fbb592407c9dd244b4cea086cbb90d7bd0bf60bb) Diff: --- libgomp/plugin/plugin-gcn.c | 4 ++-- libgomp/plugin/plugin-nvptx.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libgomp/plugin/plugin-gcn.c b/libgomp/plugin/plugin-gcn.c index c760c172229..582c07929f9 100644 --- a/libgomp/plugin/plugin-gcn.c +++ b/libgomp/plugin/plugin-gcn.c @@ -3458,12 +3458,12 @@ GOMP_OFFLOAD_load_image (int ord, unsigned version, const void *target_data, } } - GCN_DEBUG ("Looking for variable %s\n", STRINGX (GOMP_DEVICE_NUM_VAR)); + GCN_DEBUG ("Looking for variable %s\n", XSTRING (GOMP_DEVICE_NUM_VAR)); hsa_status_t status; hsa_executable_symbol_t var_symbol; status = hsa_fns.hsa_executable_get_symbol_fn (agent->executable, NULL, - STRINGX (GOMP_DEVICE_NUM_VAR), + XSTRING (GOMP_DEVICE_NUM_VAR), agent->id, 0, &var_symbol); if (status == HSA_STATUS_SUCCESS) { diff --git a/libgomp/plugin/plugin-nvptx.c b/libgomp/plugin/plugin-nvptx.c index b7669cc1db2..61cf3ee639d 100644 --- a/libgomp/plugin/plugin-nvptx.c +++ b/libgomp/plugin/plugin-nvptx.c @@ -1382,7 +1382,7 @@ GOMP_OFFLOAD_load_image (int ord, unsigned version, const void *target_data, size_t device_num_varsize; CUresult r = CUDA_CALL_NOCHECK (cuModuleGetGlobal, &device_num_varptr, &device_num_varsize, module, - STRINGX (GOMP_DEVICE_NUM_VAR)); + XSTRING (GOMP_DEVICE_NUM_VAR)); if (r == CUDA_SUCCESS) { targ_tbl->start = (uintptr_t) device_num_varptr;
reply other threads:[~2022-01-04 9:31 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220104093156.BD6B33858430@sourceware.org \ --to=cltang@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).