[gcc r11-3355] [libgomp, nvptx] Print error log for link error

Tom de Vries vries@gcc.gnu.org
Tue Sep 22 11:38:58 GMT 2020


https://gcc.gnu.org/g:c0e9cee285e47f806227b22812b15ffea677d578

commit r11-3355-gc0e9cee285e47f806227b22812b15ffea677d578
Author: Tom de Vries <tdevries@suse.de>
Date:   Tue Sep 22 07:51:58 2020 +0200

    [libgomp, nvptx] Print error log for link error
    
    By running libgomp test-case libgomp.c/target-28.c with GOMP_NVPTX_PTXRW=w
    (using a maintenance patch that adds support for this env var), we dump the
    ptx in target-28.exe to file.  By editing one ptx file to rename
    gomp_nvptx_main to gomp_nvptx_main2 in both declaration and call, and
    running with GOMP_NVPTX_PTXRW=r, we trigger a link error:
    ...
    $ GOMP_NVPTX_PTXRW=r ./target-28.exe
    libgomp: cuLinkComplete error: unknown error
    ...
    The error is somewhat uninformative.
    
    Fix this by dumping the error log returned by the failing cuda call, such
    that we have instead:
    ...
    $ GOMP_NVPTX_PTXRW=r ./target-28.exe
    libgomp: Link error log error   : \
      Undefined reference to 'gomp_nvptx_main2' in ''
    libgomp: cuLinkComplete error: unknown error
    ...
    
    Build on x86_64 with nvptx accelerator, tested libgomp.
    
    libgomp/ChangeLog:
    
            * plugin/plugin-nvptx.c (link_ptx): Print elog if cuLinkComplete call
            fails.

Diff:
---
 libgomp/plugin/plugin-nvptx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libgomp/plugin/plugin-nvptx.c b/libgomp/plugin/plugin-nvptx.c
index 390804ad1fa..a63dd1a99fb 100644
--- a/libgomp/plugin/plugin-nvptx.c
+++ b/libgomp/plugin/plugin-nvptx.c
@@ -701,6 +701,7 @@ link_ptx (CUmodule *module, const struct targ_ptx_obj *ptx_objs,
 
   if (r != CUDA_SUCCESS)
     {
+      GOMP_PLUGIN_error ("Link error log %s\n", &elog[0]);
       GOMP_PLUGIN_error ("cuLinkComplete error: %s", cuda_error (r));
       return false;
     }


More information about the Gcc-cvs mailing list