[PATCH] D25845: [CUDA] Ignore implicit target attributes during function template instantiation.

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 21 14:02:12 PDT 2016


tra added a comment.

In https://reviews.llvm.org/D25845#576819, @jlebar wrote:

> > This patch changes the way we match target attributes of base template vs attributes used in explicit instantiation or specialization so that only explicitly specified attributes are considered.
>
> Another question about this: When we have something inside of the force-host-device pragma, the HD attributes it gets are implicit.


.. and therefore ignored for the purposes of matching specialization to template.

> This means that the only way to specialize something inside one of these pragmas is to use the pragma around the specialization?  That...seems weird?

The whole purpose of this patch is to *ignore* implicit attributes added by compiler and only consider what user has written in the source code. Specialization will work exactly the same regardless of whether template or its specialization are within the pragma. In all cases we'll only consider attributes explicitly specified by the user. I've used constexpr template to illustrate the case where compiler adds implicit HD attributes to the template, but the logic will apply to the specialization, too -- if attributes are not written, they are not considered when we consider which template to match.


https://reviews.llvm.org/D25845





More information about the cfe-commits mailing list