Hi Sebastian!

On 2026-06-11T01:17:48-0400, "Sebastian Galindo" 
<[email protected]> wrote:
> I'm a GSoC contributor this year and I'm implementing the device_type   
> clause for some directives. For now I'm leaving the implementation      
> working without the 'grouping' or device-specific clauses as the        
> OpenACC spec recommend.                                                 

Right, that "grouping" is not applicable to the OpenACC 'init',
'shutdown', 'set' usage of the 'device_type' clause.

> I saw a couple of comments regarding the integration of the clause, for 
> example:                                                                
>
>> /*TODO Things are conceptually wrong here: 'loop' clauses may be      
>> hidden behind 'device_type', so we have to defer a lot of processing  
>> until we're in the offloading compilation. "Fortunately", GCC doesn't 
>> support the OpenACC 'device_type' clause yet, so we get away that. */ 
>
> Or:
>
>>  /* TODO: This will need amending when device_type is implemented. */
>
> I would be interested in fully implementing the device_type as part     
> of the last part in my GSoC project (as long as my mentors are ok       
> with that) but I'm even more interested in getting some context         
> regarding the challenges that device_type clause would imply and how to 
> actually implement the device-specific clauses (maybe having multiple   
> gfc_omp_clauses instances in the case of Fortran? I don't know).        

That's quite right: especially for cases where OpenACC directives accept
'device_type' clauses with a 'device-type-list' (multiple
'device-type's), we'll indeed need some refactoring of data structures,
to allow for several "chains of clauses" (per each device type).  These
will have to exist until the offload code gets split off, and only then
(in the subsequent host as well as device code generation) we'll be able
to discard all "chains of clauses" that are not applicable to the
respective compilation target.

We'll have to individually address the several cases; for example, for
the OpenACC 'loop' construct, this may imply adding additional
abstractions (as per the "TODO" comment you've cited above).


There is a old WIP patch for 'device_type' clause handling (pre-dating
existence of the 'init', 'shutdown', 'set' directives you're currently
working on, so not helpful for those), but indeed the "chains of clauses"
middle end handling was not yet implemented, only basic front end
handling.  (..., if I remember correctly.)  I'll dig it out once we get
to implementing it for 'loop' etc.


Grüße
 Thomas

Reply via email to