This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [libgomp, OpenACC] Add more map handling for enter/exit data directives


On 2017/6/14 12:00 AM, Jakub Jelinek wrote:
> I don't see sufficient information on what you want to change and why
> and whether the changes are backwards compatible (say will a valid
> OpenACC 2.0 program compiled by GCC 7 work against both libgomp from GCC 7
> as well as one with this patch)?
> Can you write a few paragraphs on it (doesn't have to be comments in the
> source, mailing list is fine)?

The current code doesn't handle GOMP_MAP_TO (present_or_copyin) and also the
GOMP_MAP_PSET/MAP_POINTER handling wasn't entirely correct. This patch fixes
them.

In the new attached patch, I added a fix a memory management fix that was
forgotten earlier. The collective patch was originally by Cesar, from here:
https://gcc.gnu.org/ml/gcc-patches/2015-05/msg01367.html
(in that post, his main emphasis was the memory management fix)

>> +		case GOMP_MAP_ALLOC:
>> +		  acc_present_or_create (hostaddrs[i], sizes[i]);
>>  		  break;
>>  		case GOMP_MAP_FORCE_ALLOC:
>>  		  acc_create (hostaddrs[i], sizes[i]);
>>  		  break;
>> -		case GOMP_MAP_FORCE_PRESENT:
>> +		case GOMP_MAP_TO:
>>  		  acc_present_or_copyin (hostaddrs[i], sizes[i]);
>>  		  break;
>>  		case GOMP_MAP_FORCE_TO:
>> -		  acc_present_or_copyin (hostaddrs[i], sizes[i]);
>> +		  acc_copyin (hostaddrs[i], sizes[i]);
>>  		  break;
> 
> E.g. in this hunk you remove GOMP_MAP_POINTER and GOMP_MAP_FORCE_PRESENT
> handling and significantly change GOMP_MAP_FORCE_TO.  The first two will
> now gomp_fatal, right?  Can it ever appear in GOACC_enter_exit_data
> calls?

GOMP_MAP_FORCE_PRESENT does not appear in enter/exit data directives, while
GOMP_MAP_POINTER is handled in find_pointer().

Thanks,
Chung-Lin

2017-06-22  Cesar Philippidis  <cesar@codesourcery.com>
            Thomas Schwinge  <thomas@codesourcery.com>
            Chung-Lin Tang  <cltang@codesourcery.com>

        libgomp/
	* oacc-mem.c (gomp_acc_remove_pointer): Fix a memory leak preventing
	target_mem_desc.to_free from being deallocated with acc exit data.
	* oacc-parallel.c (find_pset): Adjust and rename from...
	(find_pointer): ...this function.
	(GOACC_enter_exit_data): Handle GOMP_MAP_TO and GOMP_MAP_ALLOC,
	adjust find_pointer calls into find_pset, adjust pointer map handling,
	add acc_is_present guards to calls to gomp_acc_insert_pointer and
	gomp_acc_remove_pointer.

	* testsuite/libgomp.oacc-c-c++-common/data-2.c: Update test.
	* testsuite/libgomp.oacc-c-c++-common/enter-data.c: New test.
	* testsuite/libgomp.oacc-fortran/data-2.f90: Update test.


Attachment: 272.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]