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

[AIEX] Bail out from waw rewriter for spilled register #361

Merged
merged 1 commit into from
Feb 18, 2025

Conversation

niwinanto
Copy link
Collaborator

There is an upstream bug which stop us from unassigning the spilled register after greedy. So we bail out for such cases from aie-waw-rewriter pass.
llvm/llvm-project#48255

@@ -33,6 +33,7 @@
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/MC/MCRegister.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this include necessary?

#
# (c) Copyright 2025 Advanced Micro Devices, Inc. or its affiliates

# Workaround WAW register renaming pass for llvm bug #48911. We must not crash here.
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Add a comment which register is now skipped due to being a spill register

@niwinanto niwinanto force-pushed the niwin.waw.crash branch 2 times, most recently from 81a5d18 to 486a896 Compare February 18, 2025 09:45
@F-Stuckmann
Copy link
Collaborator

LGTM

@niwinanto niwinanto enabled auto-merge (rebase) February 18, 2025 10:25
@niwinanto niwinanto disabled auto-merge February 18, 2025 10:25
@@ -253,7 +253,12 @@ bool AIEWawRegRewriter::renameMBBPhysRegs(const MachineBasicBlock *MBB) {
// WAW dependency resolution
if (LastVRegDef[Reg] != &MI)
continue;

// See llvm bug #48911.
// Skip reassign if a register has originated from such split.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would appreciate a brief inline explanation of 'such split' if possible/feasible.

@niwinanto niwinanto merged commit ad9e67d into aie-public Feb 18, 2025
8 checks passed
// FIXME: Remove the workaround when bug #48911 is fixed.
if (VRM->getPreSplitReg(Reg)) {
continue;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm wondering if we shouldn't abort altogether? It seems dangerous to do further manipulations to the LiveRegMatrix if isn't up to date. Or is this really safe to just skip this register, but continue with the other ones?

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.

5 participants