This patch ensures that the maximum vectorization factor used to set the "safelen" attribute on "omp simd" constructs is suitable for all the configured offload devices. Right now it makes the proper adjustment for NVPTX, but otherwise just uses a value suitable for the host system (always x86_64 in the case of amdgcn). This typically ends up being 16 where 64 is the minimum for vectorization to work properly on GCN. There is a potential problem that one "safelen" must be set for *all* offload devices, which means it can't be perfect for all devices. However I believe that too big is always OK (at least for powers of two?) whereas too small is not OK, so this code always selects the largest value of max_vf, regardless of where it comes from. The existing target VF function, omp_max_simt_vf, is tangled up with the notion of whether SIMT is available or not, so I couldn't add amdgcn in there. It's tempting to have omp_max_vf do some kind of autodetect what VF to choose, but the current implementation in omp-general.cc doesn't have access to the context in a convenient way, and nor do all the callers, so I couldn't easily do that. Instead, I have opted to add a new function, omp_max_simd_vf, which can check for the presence of amdgcn. While reviewing the callers of omp_max_vf I found one other case that looks like it ought to be tuned for the device, not just the host. In that case it's not clear how to achieve that and in fact, at least on x86_64, the way it is coded the actual value from omp_max_vf is always ignored in favour of a much larger "minimum", so I have added a comment for the next person to touch that spot and left it alone. This change gives a 10x performance improvement on the BabelStream "dot" benchmark on amdgcn and is not harmful on nvptx. OK for mainline? I will commit a backport to OG12 shortly. Andrew