Skip to content

[X86] Replace hasVirtualTileReg with AMXProgModel #95105

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

Merged
merged 1 commit into from
Jun 12, 2024

Conversation

aengelke
Copy link
Contributor

Cleanup after AMXProgModel introduction. AMXProgModel is ManagedRA
whenever virtual tile registers exist at some point.

Cleanup after AMXProgModel introduction. AMXProgModel is ManagedRA
whenever virtual tile registers exist at some point.
@llvmbot
Copy link
Member

llvmbot commented Jun 11, 2024

@llvm/pr-subscribers-backend-x86

Author: None (aengelke)

Changes

Cleanup after AMXProgModel introduction. AMXProgModel is ManagedRA
whenever virtual tile registers exist at some point.


Full diff: https://github.com/llvm/llvm-project/pull/95105.diff

4 Files Affected:

  • (modified) llvm/lib/Target/X86/X86FastTileConfig.cpp (-3)
  • (modified) llvm/lib/Target/X86/X86FrameLowering.cpp (+1-1)
  • (modified) llvm/lib/Target/X86/X86MachineFunctionInfo.h (-7)
  • (modified) llvm/lib/Target/X86/X86PreTileConfig.cpp (-1)
diff --git a/llvm/lib/Target/X86/X86FastTileConfig.cpp b/llvm/lib/Target/X86/X86FastTileConfig.cpp
index 2a20cd13791de..d695d8274c0c0 100644
--- a/llvm/lib/Target/X86/X86FastTileConfig.cpp
+++ b/llvm/lib/Target/X86/X86FastTileConfig.cpp
@@ -161,9 +161,6 @@ bool X86FastTileConfig::configBasicBlock(MachineBasicBlock &MBB) {
     }
   }
 
-  if (Change)
-    X86FI->setHasVirtualTileReg(true);
-
   return Change;
 }
 
diff --git a/llvm/lib/Target/X86/X86FrameLowering.cpp b/llvm/lib/Target/X86/X86FrameLowering.cpp
index 4521401d8741c..76bcf875f00e2 100644
--- a/llvm/lib/Target/X86/X86FrameLowering.cpp
+++ b/llvm/lib/Target/X86/X86FrameLowering.cpp
@@ -2594,7 +2594,7 @@ void X86FrameLowering::emitEpilogue(MachineFunction &MF,
   }
 
   // Emit tilerelease for AMX kernel.
-  if (X86FI->hasVirtualTileReg())
+  if (X86FI->getAMXProgModel() == AMXProgModelEnum::ManagedRA)
     BuildMI(MBB, Terminator, DL, TII.get(X86::TILERELEASE));
 }
 
diff --git a/llvm/lib/Target/X86/X86MachineFunctionInfo.h b/llvm/lib/Target/X86/X86MachineFunctionInfo.h
index 8aaa49945f9d4..ff09291d268ad 100644
--- a/llvm/lib/Target/X86/X86MachineFunctionInfo.h
+++ b/llvm/lib/Target/X86/X86MachineFunctionInfo.h
@@ -119,10 +119,6 @@ class X86MachineFunctionInfo : public MachineFunctionInfo {
   /// other tools to detect the extended record.
   bool HasSwiftAsyncContext = false;
 
-  /// True if this function has tile virtual register. This is used to
-  /// determine if we should insert tilerelease in frame lowering.
-  bool HasVirtualTileReg = false;
-
   /// Ajust stack for push2/pop2
   bool PadForPush2Pop2 = false;
 
@@ -250,9 +246,6 @@ class X86MachineFunctionInfo : public MachineFunctionInfo {
   bool hasSwiftAsyncContext() const { return HasSwiftAsyncContext; }
   void setHasSwiftAsyncContext(bool v) { HasSwiftAsyncContext = v; }
 
-  bool hasVirtualTileReg() const { return HasVirtualTileReg; }
-  void setHasVirtualTileReg(bool v) { HasVirtualTileReg = v; }
-
   bool padForPush2Pop2() const { return PadForPush2Pop2; }
   void setPadForPush2Pop2(bool V) { PadForPush2Pop2 = V; }
 
diff --git a/llvm/lib/Target/X86/X86PreTileConfig.cpp b/llvm/lib/Target/X86/X86PreTileConfig.cpp
index 75ad58e5cdcb7..1125584ed7d74 100644
--- a/llvm/lib/Target/X86/X86PreTileConfig.cpp
+++ b/llvm/lib/Target/X86/X86PreTileConfig.cpp
@@ -301,7 +301,6 @@ bool X86PreTileConfig::runOnMachineFunction(MachineFunction &MF) {
   // There's no AMX instruction if we didn't find a tile config live in point.
   if (CfgNeedInsert.empty())
     return false;
-  X86FI->setHasVirtualTileReg(true);
 
   // Avoid to insert ldtilecfg before any shape defs.
   SmallVector<MachineBasicBlock *, 8> WorkList;

Copy link
Contributor

@phoebewang phoebewang left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@phoebewang
Copy link
Contributor

Is there any test affected? I assume tests for X86FastPreTileConfig might be affect by this change.

@aengelke
Copy link
Contributor Author

FastPreTileConfig has (without #94989) it's own check whether virtual tile registers exist, it finds this out by iterating over all virtual registers. Functionality should be identical, so no tests are affected.

@phoebewang
Copy link
Contributor

FastPreTileConfig has (without #94989) it's own check whether virtual tile registers exist, it finds this out by iterating over all virtual registers. Functionality should be identical, so no tests are affected.

Sorry, my mistake. I didn't notice FastPreTileConfig also called setHasVirtualTileReg...

@aengelke aengelke merged commit 55bc04f into llvm:main Jun 12, 2024
9 checks passed
@aengelke aengelke deleted the amx-virtreg-cleanup branch June 12, 2024 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants