echristo added a comment.

In https://reviews.llvm.org/D47070#1105533, @Hahnfeld wrote:

> Looks like this was added as a "temporary solution" in 
> https://reviews.llvm.org/D8984. Meanwhile the attribute whitelist was merged 
> half a year later (https://reviews.llvm.org/D7802), so maybe we can just get 
> rid of comparing `target-cpu` and `target-features` entirely?


You don't want to get rid of the comparison because you might have specific 
code that can't be inlined from one into another.

In https://reviews.llvm.org/D47070#1104846, @tra wrote:

> This was not intended. :-( I was unaware that GetCPUAndFeaturesAttributes() 
> would add any feature that looks like a valid CPU name to the target-cpu 
> attribute.
>  All I needed is to make builtins available or not. Setting them as function 
> attributes is not what we need here.
>
> I'm not sure what's the best way to deal with this. On one hand I do need to 
> make some builtins available depending on combination of GPU arch and PTX 
> version. The only way to do it is via the features. On the other hand, the 
> features appear to propagate to LLVM IR, which is something I don't need or 
> want.
>
> One way would be to introduce some sort of feature blacklist which would 
> prevent them from being converted to function attributes.
>  Or, perhaps, we can change TARGET_BUILTIN or create something similar which 
> would allow availability of builtins w/o relying on features.
>
> As a short-term fix we can disable feature-to-function attribute propagation 
> for NVPTX until we fix it.
>
> @echristo -- any other suggestions?


This is some of what I was talking about when I was mentioning how function 
attributes and the targets work. Ideally you'll have a compatible set of 
features and it won't really cause an issue. The idea is that if you're 
compiling for a minimum ptx feature of X, then any "compatible" set of ptx 
should be able to inline into your code. I think you do want the features to 
propagate in general, just specific use cases may not care one way or another - 
that said, for those use cases you're probably just compiling everything with 
the same feature anyhow.

I guess, ultimately, I'm not seeing what the concern here is for how features 
are working or not working for the target so it's harder to help. What is the 
problem you're running into, or can you try a different way of explaining it to 
me? :)


Repository:
  rC Clang

https://reviews.llvm.org/D47070



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to