[PATCH 5/7 libgomp,amdgcn] Optimize GCN OpenMP malloc performance

Andrew Stubbs ams@codesourcery.com
Tue Nov 12 13:30:00 GMT 2019


This patch implements a malloc optimization to improve the startup and
shutdown overhead for each OpenMP team.

New malloc functions are created, "team_malloc" and "team_free", that
take memory from a per-team memory arena provided by the plugin, rather
than the shared heap space, which is slow, and gets worse the more teams
are trying to allocate at once.

These new functions are used both in the gcn/team.c file and in selected
places elsewhere in libgomp.  Arena-space is limited (and larger sizes
have greater overhead at launch time) so this should not be a global
search and replace.

Dummy pass-through definitions are provided for other targets.

OK to commit?

Thanks

Andrew


2019-11-12  Andrew Stubbs  <ams@codesourcery.com>

	libgomp/
	* config/gcn/team.c (gomp_gcn_enter_kernel): Set up the team arena
	and use team_malloc variants.
	(gomp_gcn_exit_kernel): Use team_free.
	* libgomp.h (TEAM_ARENA_SIZE): Define.
	(TEAM_ARENA_FREE): Define.
	(TEAM_ARENA_END): Define.
	(team_malloc): New function.
	(team_malloc_cleared): New function.
	(team_free): New function.
	* team.c (gomp_new_team): Use team_malloc.
	(free_team): Use team_free.
	(gomp_free_thread): Use team_free.
	(gomp_pause_host): Use team_free.
	* work.c (gomp_init_work_share): Use team_malloc.
	(gomp_fini_work_share): Use team_free.
---
 libgomp/config/gcn/team.c | 18 ++++++++++---
 libgomp/libgomp.h         | 56 +++++++++++++++++++++++++++++++++++++++
 libgomp/team.c            | 12 ++++-----
 libgomp/work.c            |  4 +--
 4 files changed, 78 insertions(+), 12 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-Optimize-GCN-OpenMP-malloc-performance.patch
Type: text/x-patch
Size: 6259 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20191112/8a33ab08/attachment.bin>


More information about the Gcc-patches mailing list