stfc / PSyclone

Domain-specific compiler and code transformation system for Finite Difference/Volume/Element Earth-system models in Fortran
BSD 3-Clause "New" or "Revised" License
107 stars 29 forks source link

Move out remaining checks from backend #2680

Open sergisiso opened 3 months ago

sergisiso commented 3 months ago

In #2656 there are comments about .debug_string() sometimes failing backend validations, making it turn up later, but currently necessary due to single transformations not being enough to validate in some cases. Also, that this per-backend validations can lead to code duplication.

We do have a mechanism to solve this, the validations should be implemented in each node's validate_global_constraints() which is called by the base visitor, so there is no code duplication, and potentially could be called (in addition) early for certain scenarios (e.g. after a self-contained meta-transformation).

These are then disabled for the DebugWriter, so I assume the validation that fails there is encoded inside the visitor itself. We should move these remaining checks to the respective validate_global_constraints()? Potentially the issue comes from: