efriedma-quic wrote:

> we only know the concrete target when we are finalising, which happens at a 
> completely different time-point, on possibly a different machine;

This is precisely why we want the frontend diagnostic: if we diagnose the bad 
cases in the frontend, later stages are guaranteed to lower correctly.  If we 
diagnose later, you don't know you messed up until you get crash reports from 
your users.

> conversely, for the abstract case we are targeting a generic target which has 
> all the features, so at most we could be somewhat spammy and say "be sure to 
> wrap this in a __builtin_amdgcn_is_invocable call;

I prefer to think of it as a generic target which has none of the features.

Yes, you might have to take some time to annotate your code, but once you have 
the annotations, it catches a lot of potential mistakes.

----

In case nobody else has brought it up, we currently do the following on Arm, 
which is conceptually similar:

```
#include <arm_sve.h>
__attribute((target("sve"))) void f() {
  svbool_t x = svptrue_b8(); // Allowed
}
void f2() {
  svbool_t x = svptrue_b8(); // Error: SVE isn't enabled.
}
```

https://github.com/llvm/llvm-project/pull/134016
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to