aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c/usm-1.c
diff options
context:
space:
mode:
authorAndrew Stubbs <ams@codesourcery.com>2022-06-17 13:07:11 +0100
committerAndrew Stubbs <ams@codesourcery.com>2022-06-27 17:28:03 +0100
commitd1eb334f7b24ee865601d3ab067e05a86802c4d1 (patch)
treee612fb39e095d18223d31485f4bf88652eead09f /libgomp/testsuite/libgomp.c/usm-1.c
parent9aefadc9e6ac17437ead1bf3bcf452b52c447b78 (diff)
amdgcn, openmp: Auto-detect USM mode and set HSA_XNACK
The AMD GCN runtime must be set to the correct mode for Unified Shared Memory to work, but this is not always clear at compile and link time due to the split nature of the offload compilation pipeline. This patch sets a new attribute on OpenMP offload functions to ensure that the information is passed all the way to the backend. The backend then places a marker in the assembler code for mkoffload to find. Finally mkoffload places a constructor function into the final program to ensure that the HSA_XNACK environment variable passes the correct mode to the GPU. The HSA_XNACK variable must be set before the HSA runtime is even loaded, so it makes more sense to have this set within the constructor than at some point later within libgomp or the GCN plugin. gcc/ChangeLog: * config/gcn/gcn.c (unified_shared_memory_enabled): New variable. (gcn_init_cumulative_args): Handle attribute "omp unified memory". (gcn_hsa_declare_function_name): Emit "MKOFFLOAD OPTIONS: USM+". * config/gcn/mkoffload.c (TEST_XNACK_OFF): New macro. (process_asm): Detect "MKOFFLOAD OPTIONS: USM+". Emit configure_xnack constructor, as required. * omp-low.c (create_omp_child_function): Add attribute "omp unified memory".
Diffstat (limited to 'libgomp/testsuite/libgomp.c/usm-1.c')
0 files changed, 0 insertions, 0 deletions