Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass the target machine to the LLVM pass builder #4655

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

giuseros
Copy link
Contributor

@giuseros giuseros commented Sep 5, 2024

In a recent change to the LLVM AMD backend, we moved the AMDGPUAttributor pass into the optimization pipeline (as opposed to the codegen pipeline).

Since this is a pass specific for AMD targets, we want to pass the TargetMachine when building the pipeline, i.e., during the call to optimize_module.

Failure to do so will result in an increase of number of registers used. Also, we spoke with our LLVM backend team, and they advised to always pass the TargetMachine when building the LLVM optimization pipeline.

This PR is addressing this issue, in the following way:

  • I added optional parameters to the optimize_module funciton (similar to those passed to translate_to_asm)
  • if those params are passed in, then we will create the TargetMachine and pass it to the PassBuilder
  • Otherwise the TargetMachine will still be nullptr (as it was before)

Please note that, as it stands now, this change will only effect the AMD backend.

@giuseros giuseros marked this pull request as draft September 5, 2024 14:17
Copy link
Collaborator

@antiagainst antiagainst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks!

@antiagainst antiagainst marked this pull request as ready for review September 5, 2024 15:50
@antiagainst antiagainst merged commit 7783738 into triton-lang:main Sep 5, 2024
7 checks passed
antiagainst pushed a commit that referenced this pull request Sep 8, 2024
#4655 sets the TargetMachine
primarily for the AMD backend but we want it to remain nullptr when
using LLVM IR level plugins as well.

This PR just adds an additional check when adding TargetMachine value.
leshikus pushed a commit to intel/intel-xpu-backend-for-triton that referenced this pull request Sep 12, 2024
triton-lang/triton#4655 sets the TargetMachine
primarily for the AMD backend but we want it to remain nullptr when
using LLVM IR level plugins as well.

This PR just adds an additional check when adding TargetMachine value.
bertmaher pushed a commit to bertmaher/triton that referenced this pull request Dec 10, 2024
In a recent change to the [LLVM AMD
backend](llvm/llvm-project#83131), we moved the
`AMDGPUAttributor` pass into the optimization pipeline (as opposed to
the codegen pipeline).

Since this is a pass specific for `AMD` targets, we want to pass the
`TargetMachine` when building the pipeline, i.e., during the call to
`optimize_module`.

Failure to do so will result in an increase of number of registers used.
Also, we spoke with our LLVM backend team, and they advised to always
pass the `TargetMachine` when building the LLVM optimization pipeline.

This PR is addressing this issue, in the following way:
- I added optional parameters to the `optimize_module` funciton (similar
to those passed to `translate_to_asm`)
- if those params are passed in, then we will create the `TargetMachine`
and pass it to the `PassBuilder`
- Otherwise the `TargetMachine` will still be `nullptr` (as it was
before)

Please note that, as it stands now, this change will only effect the AMD
backend.
bertmaher pushed a commit to bertmaher/triton that referenced this pull request Dec 10, 2024
…g#4669)

triton-lang#4655 sets the TargetMachine
primarily for the AMD backend but we want it to remain nullptr when
using LLVM IR level plugins as well.

This PR just adds an additional check when adding TargetMachine value.
scxiao added a commit to scxiao/triton that referenced this pull request Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants