llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[NVPTX] Implement `TLI.isTruncateFree(EVT, EVT)` and `TLI.isZExtFree()`

Open justinfargnoli opened this issue 2 years ago • 12 comments

NVPTX currently does not override TLI.isTruncateFree(EVT, EVT) and TLI.isZExtFree(), and it probably should.

zext/truncate between i32/i64 can probably be considered free, as the values already live in separate 32-bit registers in hardware.

Originally posted by @Artem-B in https://github.com/llvm/llvm-project/pull/98666#discussion_r1681805956

justinfargnoli avatar Oct 31 '24 01:10 justinfargnoli

Hi!

This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:

  1. Check that no other contributor has already been assigned to this issue. If you believe that no one is actually working on it despite an assignment, ping the person. After one week without a response, the assignee may be changed.
  2. In the comments of this issue, request for it to be assigned to you, or just create a pull request after following the steps below. Mention this issue in the description of the pull request.
  3. Fix the issue locally.
  4. Run the test suite locally. Remember that the subdirectories under test/ create fine-grained testing targets, so you can e.g. use make check-clang-ast to only run Clang's AST tests.
  5. Create a Git commit.
  6. Run git clang-format HEAD~1 to format your changes.
  7. Open a pull request to the upstream repository on GitHub. Detailed instructions can be found in GitHub's documentation. Mention this issue in the description of the pull request.

If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below.

llvmbot avatar Oct 31 '24 01:10 llvmbot

@llvm/issue-subscribers-good-first-issue

Author: Justin Fargnoli (justinfargnoli)

NVPTX currently does not override `TLI.isTruncateFree` and `TLI.isZExtFree`, and it probably should.

zext/truncate between i32/i64 can probably be considered free, as the values already live in separate 32-bit registers in hardware.

Originally posted by @Artem-B in https://github.com/llvm/llvm-project/pull/98666#discussion_r1681805956

llvmbot avatar Oct 31 '24 01:10 llvmbot

i want to work on this issue

SergeantCooper avatar Nov 01 '24 21:11 SergeantCooper

@Quark-69, that's fantastic to hear! Please let me know if I should expand on what the ask is or if I can help in any way :)

justinfargnoli avatar Nov 01 '24 23:11 justinfargnoli

@Quark-69 Go for it. Patches are welcome.

Artem-B avatar Nov 01 '24 23:11 Artem-B

@justinfargnoli there were 2 virtual functions for isZextfree and 1 for istruncatefree that weren't implemented in the nvptx library. So I have to implement all these? Also can you elaborate a little for the issue and give me some testing strategies.

SergeantCooper avatar Nov 02 '24 03:11 SergeantCooper

@justinfargnoli Hello! I wanted to check in to see if this PR looks correct, or if there’s anything I might have missed. This is my current approach based on my understanding for isZextfree and istruncatefree for the nvptx arch.

SergeantCooper avatar Nov 03 '24 09:11 SergeantCooper

@justinfargnoli there were 2 virtual functions for isZextfree and 1 for istruncatefree that weren't implemented in the nvptx library. So I have to implement all these?

You can implement however many you'd like! The issue is just tracking the fact that these three are unimplemented. If you'd only like to implement 1, feel free to do just that.

@justinfargnoli Hello! I wanted to check in to see if this PR looks correct, or if there’s anything I might have missed. This is my current approach based on my understanding for isZextfree and istruncatefree for the nvptx arch.

I followed up on the PR. I'm happy you took an initial stab at it. Great work so far!

justinfargnoli avatar Nov 04 '24 18:11 justinfargnoli

@Quark-69 Hi, are you still working on this issue?

lwshanbd avatar Jan 31 '25 15:01 lwshanbd

@lwshanbd I wasn't able to generate a test case which reflected some changes in the assembly before and after adding istruncatefree(). So yeah I finally left it.

SergeantCooper avatar Feb 01 '25 20:02 SergeantCooper

Hi @justinfargnoli, could you assign it to me? I just submit a new PR of this issue.

lwshanbd avatar Feb 03 '25 21:02 lwshanbd

@justinfargnoli: Could you please elaborate? Both merge requests referring to this issue were not merged.

EugeneZelenko avatar Aug 12 '26 17:08 EugeneZelenko