Skip to content

Figure out if we should use globalisel for DXIL lowering #86

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

Closed
7 of 8 tasks
damyanp opened this issue Oct 21, 2024 · 1 comment
Closed
7 of 8 tasks

Figure out if we should use globalisel for DXIL lowering #86

damyanp opened this issue Oct 21, 2024 · 1 comment
Assignees

Comments

@damyanp
Copy link
Collaborator

damyanp commented Oct 21, 2024

  • Add a cl:opt flag to toggle GlobalIsel on or off
  • Add support for an LLVM to MIR translation via the irtranslator pass
    • Test with -stop-after=irtranslator
  • Add support for a legalization pass
    • Test with -stop-after= legalizer and -run-pass=legalizer
  • Add news passes to llvm/lib/Target/DirectX/DirectXTargetMachine.cpp and disable register allocation checks and passes that are needed for physical registers
  • Try to use as much of existing coreIsel pass infra as possible
  • Add support for an instruction selector
  • Test with -stop-after= instruction-select and -run-pass=instruction-select
  • Run through All GlobalIsel passes without stopping
  • convert MIR to DXIL

llvm/llvm-project@main...farzonl:llvm-project:directxGlobalIsel

@damyanp damyanp converted this from a draft issue Oct 21, 2024
@damyanp damyanp moved this from Designing to Planning in HLSL Support Feb 11, 2025
@damyanp damyanp moved this from Planning to Active in HLSL Support Feb 11, 2025
@farzonl
Copy link
Member

farzonl commented Feb 25, 2025

The options to convert MIR to DXIL are to have MIR emit LLVMIR or create a MIR BitcodeWriter.
MIR to LLVMIR has potential perf and memory degrdations. Doubling the LLVMIR memory size in the worst case.
Writing a MIR bitcode writer will need to be able to account for the fact that LLVM IR is value based because of SSA and MIR is not because phsyical registers can't be represented in SSA. For example Instruction operands are values while MIR instruction operands are MachineOperands. Even with Virtual Registers MIR doesn't have values so all the value based data structures would need to be rewritten.

TLDR we have decided not to proceed with GlobalIsel because it would require a rewrite of the DXILBitcodewriter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants