[PATCH] openmp: Implement support for OMP_TARGET_OFFLOAD

Kwok Cheung Yeung kcy@codesourcery.com
Tue Oct 20 21:28:23 GMT 2020


On 20/10/2020 1:57 pm, Jakub Jelinek wrote:
> On Tue, Oct 20, 2020 at 02:17:26PM +0200, Tobias Burnus wrote:
>> On 10/20/20 2:11 PM, Tobias Burnus wrote:
>>
>>> Unfortunately, the committed patch
>>> (r11-4121-g1bfc07d150790fae93184a79a7cce897655cb37b)
>>> causes build errors.
>>>
>>> The error seems to be provoked by function cloning – as the code
>>> itself looks fine:
>>> ...
>>>   struct gomp_device_descr *devices_s
>>>      = malloc (num_devices * sizeof (struct gomp_device_descr));
>>> ...
>>>    for (i = 0; i < num_devices; i++)
>>>      if (!(devices[i].capabilities & GOMP_OFFLOAD_CAP_OPENMP_400))
>>>        devices_s[num_devices_after_openmp++] = devices[i];
>>
>> gomp_target_init.part.0 ()
>> {
>> ...
>> <bb 2>
>>    devices_s_1 = malloc (0);
>> ...
>>    num_devices.16_67 = num_devices;
>> ...
>>    if (num_devices.16_67 > 0)
>>      goto <bb 3>; [89.00%]
>>    else
>>      goto <bb 18>; [11.00%]
>>
>> Which seems to have an ordering problem.
> 
> This patch fixes the warning that breaks the bootstrap, but haven't
> tested it with offloading to see if it doesn't break offloading somehow.
> 

Thank you for the fix.

It appears that the issue only occurs when offloading is not enabled (I tested 
with offloading to Nvidia and AMD GCN devices, but forgot to test no offloading).

Kwok


More information about the Gcc-patches mailing list