Skip to content
Snippets Groups Projects
  • Tobias Burnus's avatar
    cdb9aa0f
    OpenMP: Fix omp_get_device_from_uid, minor cleanup · cdb9aa0f
    Tobias Burnus authored
    In Fortran, omp_get_device_from_uid can also accept substrings, which are
    then not NUL terminated.  Fixed by introducing a fortran.c wrapper function.
    Additionally, in case of a fail the plugin functions now return NULL instead
    of failing fatally such that a fall-back UID is generated.
    
    gcc/ChangeLog:
    
    	* omp-general.cc (omp_runtime_api_procname): Strip "omp_" from
    	string; move get_device_from_uid as now a '_' suffix exists.
    
    libgomp/ChangeLog:
    
    	* fortran.c (omp_get_device_from_uid_): New function.
    	* libgomp.map (GOMP_6.0): Add it.
    	* oacc-host.c (host_dispatch): Init '.uid' and '.get_uid_func'.
    	* omp_lib.f90.in: Make it used by removing bind(C).
    	* omp_lib.h.in: Likewise.
    	* target.c (omp_get_device_from_uid): Ensure the device is initialized.
    	* plugin/plugin-gcn.c (GOMP_OFFLOAD_get_uid): Add function comment;
    	return NULL in case of an error.
    	* plugin/plugin-nvptx.c (GOMP_OFFLOAD_get_uid): Likewise.
    	* testsuite/libgomp.fortran/device_uid.f90: Update to test substrings.
    cdb9aa0f
    History
    OpenMP: Fix omp_get_device_from_uid, minor cleanup
    Tobias Burnus authored
    In Fortran, omp_get_device_from_uid can also accept substrings, which are
    then not NUL terminated.  Fixed by introducing a fortran.c wrapper function.
    Additionally, in case of a fail the plugin functions now return NULL instead
    of failing fatally such that a fall-back UID is generated.
    
    gcc/ChangeLog:
    
    	* omp-general.cc (omp_runtime_api_procname): Strip "omp_" from
    	string; move get_device_from_uid as now a '_' suffix exists.
    
    libgomp/ChangeLog:
    
    	* fortran.c (omp_get_device_from_uid_): New function.
    	* libgomp.map (GOMP_6.0): Add it.
    	* oacc-host.c (host_dispatch): Init '.uid' and '.get_uid_func'.
    	* omp_lib.f90.in: Make it used by removing bind(C).
    	* omp_lib.h.in: Likewise.
    	* target.c (omp_get_device_from_uid): Ensure the device is initialized.
    	* plugin/plugin-gcn.c (GOMP_OFFLOAD_get_uid): Add function comment;
    	return NULL in case of an error.
    	* plugin/plugin-nvptx.c (GOMP_OFFLOAD_get_uid): Likewise.
    	* testsuite/libgomp.fortran/device_uid.f90: Update to test substrings.