gcc/libgomp/plugin
Tom de Vries 4a75460b00 [nvptx, libgomp] Fix cuMemAlloc with size zero
Consider test-case:
...
int
main (void)
{
  #pragma acc parallel async
  ;
  #pragma acc parallel async
  ;
  #pragma acc wait

  return 0;
}
...

This fails with:
...
libgomp: cuMemAlloc error: invalid argument
Segmentation fault (core dumped)
...
The cuMemAlloc error is due to the fact that we're try to allocate 0 bytes.

Fix this by preventing calling map_push with size zero argument in nvptx_exec.

This also has the consequence that for the abort-1.c test-case, we end up
calling cuMemFree during map_fini for the struct cuda_map allocated in
map_init, which fails because an abort happened.  Fix this by calling
cuMemFree with CUDA_CALL_NOCHECK in cuda_map_destroy.

2019-01-23  Tom de Vries  <tdevries@suse.de>

	PR target/PR88946
	* plugin/plugin-nvptx.c (cuda_map_destroy): Use CUDA_CALL_NOCHECK for
	cuMemFree.
	(nvptx_exec): Don't call map_push if mapnum == 0.
	* testsuite/libgomp.oacc-c-c++-common/pr88946.c: New test.

From-SVN: r268178
2019-01-23 08:16:56 +00:00
..
cuda Update copyright years. 2019-01-01 13:31:55 +01:00
configfrag.ac Update copyright years. 2019-01-01 13:31:55 +01:00
cuda-lib.def [nvptx] Use CUDA driver API to select default runtime launch geometry 2018-08-13 12:04:24 +00:00
hsa_ext_finalize.h Update copyright years. 2019-01-01 13:31:55 +01:00
Makefrag.am Update copyright years. 2019-01-01 13:31:55 +01:00
plugin-hsa.c Update copyright years. 2019-01-01 13:31:55 +01:00
plugin-nvptx.c [nvptx, libgomp] Fix cuMemAlloc with size zero 2019-01-23 08:16:56 +00:00