Currently, this is a rather useless patch - even though it helps to reduce the number of local patches I have. Due to the printed sorry, adding a testcase with -fdump-tree-* is also not possible, yet. For reverse offload, the plan is to call GOMP_target_ext inside the on the device, passing 'device(omp_initial_device)' alias device(GOMP_DEVICE_HOST_FALLBACK) to the target device's libgomp. The pointer to the generated target-region function is then passed as argument. However, that only works if that function is not nullified ... The reason that nullifying was added is: https://gcc.gnu.org/PR100573 https://gcc.gnu.org/r12-1066-g95d67762171f83277a5700b270c0d1e2756f83f4 https://gcc.gnu.org/pipermail/gcc-patches/2021-May/571285.html Note: Instead of just checking for GOMP_DEVICE_HOST_FALLBACK, more effort could be done, e.g. by setting some attribute on the generated function and then check for check for it. Example: 'omp target device_ancestor' + using lookup_attribute). That's what's done in the second variant. OK for mainline (which variant)? Or do you prefer to wait for a more complete patch? Tobias PS: Reverse offload - still to do: - 'requires' patch - Generate two variants of the target-region function: an empty version on the device (just to have a pointer address in the offload_func table) and the full version (on the host only) Those together are sufficient for a omp_get_num_device() == 0 version (implied by 'required reverse_offload' not being fulfilled by any device). For a more useful implementation, more work inside libgomp is required. ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955