[PATCH] D151349: [HIP] emit macro `__HIP_NO_IMAGE_SUPPORT`

Yaxun Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 5 09:57:00 PDT 2023


yaxunl added a comment.

In D151349#4395312 <https://reviews.llvm.org/D151349#4395312>, @arsenm wrote:

> In D151349#4381569 <https://reviews.llvm.org/D151349#4381569>, @yaxunl wrote:
>
>> In D151349#4381471 <https://reviews.llvm.org/D151349#4381471>, @arsenm wrote:
>>
>>> In D151349#4377792 <https://reviews.llvm.org/D151349#4377792>, @yaxunl wrote:
>>>
>>>> using ISA version to determine whether image is supported
>>>
>>> That’s backward. You can track the feature in clang separately and just not emit it. We do that for a few other features. You just stop the TargetParser parts
>>
>> Sorry, I did not quite get it. Do you mean to add a feature to https://github.com/llvm/llvm-project/blob/85670ac86813b170c9301aa477421c56a71a7e1e/llvm/lib/TargetParser/TargetParser.cpp#L107 ? should I add FEATURE_IMAGE or FEATURE_NO_IMAGE ?
>
> It's expressed as positive image feature. I thought there was a feature where clang tracks it per-target, but doesn't emit it in the IR in "target-features" but I can't remember which one it is. Is there a way to track the image feature without emitting it?

clang tracks target feature by TargetOptions::FeatureMap ( https://github.com/llvm/llvm-project/blob/7a2b12b05b39bce08987968270b43ca05d9a4836/clang/include/clang/Basic/TargetOptions.h#L62 )

Each target-specific TargetInfo-derived class initializes this map and CodeGen uses it to emit function attributes consistently.

There is no separate data structure to track target features not emitted to function attributes.

If we want to make these target features unchangeable and not emitted to IR, we could add a set for unchangeable target features and each target can initialize it. These features are read-only and will not be emitted to IR, and will cause a warning and be ignored if users try to force enabling or disabling them.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151349/new/

https://reviews.llvm.org/D151349



More information about the llvm-commits mailing list