Skip to content

Conversation

@arsenm
Copy link
Contributor

@arsenm arsenm commented Jun 21, 2025

31f39c8 claimed to have removed it,
but it's still here so really remove it.

Copy link
Contributor Author

arsenm commented Jun 21, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@arsenm arsenm marked this pull request as ready for review June 21, 2025 02:38
@llvmbot
Copy link
Member

llvmbot commented Jun 21, 2025

@llvm/pr-subscribers-backend-amdgpu

Author: Matt Arsenault (arsenm)

Changes

31f39c8 claimed to have removed it,
but it's still here so really remove it.


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

1 Files Affected:

  • (removed) llvm/lib/Target/AMDGPU/AMDGPUAnnotateKernelFeatures.cpp (-128)
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAnnotateKernelFeatures.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAnnotateKernelFeatures.cpp
deleted file mode 100644
index 9c9fa5c6e2f0f..0000000000000
--- a/llvm/lib/Target/AMDGPU/AMDGPUAnnotateKernelFeatures.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-//===- AMDGPUAnnotateKernelFeaturesPass.cpp -------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-/// \file This pass propagates the uniform-work-group-size attribute from
-/// kernels to leaf functions when possible. It also adds additional attributes
-/// to hint ABI lowering optimizations later.
-//
-//===----------------------------------------------------------------------===//
-
-#include "AMDGPU.h"
-#include "GCNSubtarget.h"
-#include "llvm/Analysis/CallGraph.h"
-#include "llvm/Analysis/CallGraphSCCPass.h"
-#include "llvm/CodeGen/TargetPassConfig.h"
-#include "llvm/Target/TargetMachine.h"
-
-#define DEBUG_TYPE "amdgpu-annotate-kernel-features"
-
-using namespace llvm;
-
-namespace {
-class AMDGPUAnnotateKernelFeatures : public CallGraphSCCPass {
-private:
-  const TargetMachine *TM = nullptr;
-
-  bool addFeatureAttributes(Function &F);
-
-public:
-  static char ID;
-
-  AMDGPUAnnotateKernelFeatures() : CallGraphSCCPass(ID) {}
-
-  bool doInitialization(CallGraph &CG) override;
-  bool runOnSCC(CallGraphSCC &SCC) override;
-
-  StringRef getPassName() const override {
-    return "AMDGPU Annotate Kernel Features";
-  }
-
-  void getAnalysisUsage(AnalysisUsage &AU) const override {
-    AU.setPreservesAll();
-    CallGraphSCCPass::getAnalysisUsage(AU);
-  }
-};
-
-} // end anonymous namespace
-
-char AMDGPUAnnotateKernelFeatures::ID = 0;
-
-bool AMDGPUAnnotateKernelFeatures::addFeatureAttributes(Function &F) {
-  bool HaveStackObjects = false;
-  bool Changed = false;
-  bool HaveCall = false;
-  bool IsFunc = !AMDGPU::isEntryFunctionCC(F.getCallingConv());
-
-  for (BasicBlock &BB : F) {
-    for (Instruction &I : BB) {
-      if (isa<AllocaInst>(I)) {
-        HaveStackObjects = true;
-        continue;
-      }
-
-      if (auto *CB = dyn_cast<CallBase>(&I)) {
-        const Function *Callee =
-            dyn_cast<Function>(CB->getCalledOperand()->stripPointerCasts());
-
-        // Note the occurrence of indirect call.
-        if (!Callee) {
-          if (!CB->isInlineAsm())
-            HaveCall = true;
-
-          continue;
-        }
-
-        Intrinsic::ID IID = Callee->getIntrinsicID();
-        if (IID == Intrinsic::not_intrinsic) {
-          HaveCall = true;
-          Changed = true;
-        }
-      }
-    }
-  }
-
-  // TODO: We could refine this to captured pointers that could possibly be
-  // accessed by flat instructions. For now this is mostly a poor way of
-  // estimating whether there are calls before argument lowering.
-  if (!IsFunc && HaveCall) {
-    F.addFnAttr("amdgpu-calls");
-    Changed = true;
-  }
-
-  if (HaveStackObjects) {
-    F.addFnAttr("amdgpu-stack-objects");
-    Changed = true;
-  }
-
-  return Changed;
-}
-
-bool AMDGPUAnnotateKernelFeatures::runOnSCC(CallGraphSCC &SCC) {
-  bool Changed = false;
-
-  for (CallGraphNode *I : SCC) {
-    Function *F = I->getFunction();
-    // Ignore functions with graphics calling conventions, these are currently
-    // not allowed to have kernel arguments.
-    if (!F || F->isDeclaration() || AMDGPU::isGraphics(F->getCallingConv()))
-      continue;
-    // Add feature attributes
-    Changed |= addFeatureAttributes(*F);
-  }
-
-  return Changed;
-}
-
-bool AMDGPUAnnotateKernelFeatures::doInitialization(CallGraph &CG) {
-  auto *TPC = getAnalysisIfAvailable<TargetPassConfig>();
-  if (!TPC)
-    report_fatal_error("TargetMachine is required");
-
-  TM = &TPC->getTM<TargetMachine>();
-  return false;
-}

31f39c8 claimed to have removed it,
but it's still here so really remove it.
@arsenm arsenm force-pushed the users/arsenm/amdgpu/really-delete-AMDGPUAnnotateKernelFeatures branch from 5cbe0d6 to 2e9b85b Compare June 21, 2025 03:19
Copy link
Collaborator

@rampitec rampitec left a comment

Choose a reason for hiding this comment

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

Seems to be already disabled. LGTM.

@arsenm arsenm merged commit 5f2135d into main Jun 21, 2025
7 checks passed
@arsenm arsenm deleted the users/arsenm/amdgpu/really-delete-AMDGPUAnnotateKernelFeatures branch June 21, 2025 08:25
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 21, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-key-instructions running on sie-linux-worker5 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/208/builds/2167

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'Clang-Unit :: ./AllClangUnitTests/33/48' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/buildbot/buildbot-root/llvm-ki/build/tools/clang/unittests/./AllClangUnitTests-Clang-Unit-3710339-33-48.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=48 GTEST_SHARD_INDEX=33 /home/buildbot/buildbot-root/llvm-ki/build/tools/clang/unittests/./AllClangUnitTests
--

Note: This is test shard 34 of 48.
[==========] Running 510 tests from 104 test suites.
[----------] Global test environment set-up.
[----------] 1 test from MinimizeSourceToDependencyDirectivesTest
[ RUN      ] MinimizeSourceToDependencyDirectivesTest.RawStringLiteral
[       OK ] MinimizeSourceToDependencyDirectivesTest.RawStringLiteral (0 ms)
[----------] 1 test from MinimizeSourceToDependencyDirectivesTest (0 ms total)

[----------] 1 test from LexerTest
[ RUN      ] LexerTest.GetSourceTextExpandsAcrossMultipleMacroCalls
[       OK ] LexerTest.GetSourceTextExpandsAcrossMultipleMacroCalls (0 ms)
[----------] 1 test from LexerTest (0 ms total)

[----------] 1 test from PPCallbacksTest
[ RUN      ] PPCallbacksTest.OpenCLExtensionPragmaDisabled
[       OK ] PPCallbacksTest.OpenCLExtensionPragmaDisabled (0 ms)
[----------] 1 test from PPCallbacksTest (0 ms total)

[----------] 1 test from ToolChainTest
[ RUN      ] ToolChainTest.VFSGnuLibcxxPathNoSysroot
[       OK ] ToolChainTest.VFSGnuLibcxxPathNoSysroot (0 ms)
[----------] 1 test from ToolChainTest (0 ms total)

[----------] 1 test from MultilibTest
[ RUN      ] MultilibTest.SelectHard
[       OK ] MultilibTest.SelectHard (0 ms)
[----------] 1 test from MultilibTest (0 ms total)

[----------] 2 tests from ExprMutationAnalyzerTest
[ RUN      ] ExprMutationAnalyzerTest.ArrayToPointerDecay
[       OK ] ExprMutationAnalyzerTest.ArrayToPointerDecay (4 ms)
[ RUN      ] ExprMutationAnalyzerTest.PointeeMutatedByAssign
[       OK ] ExprMutationAnalyzerTest.PointeeMutatedByAssign (9 ms)
[----------] 2 tests from ExprMutationAnalyzerTest (14 ms total)

[----------] 1 test from ArenaTest
[ RUN      ] ArenaTest.GetOrCreateDisjunctionReturnsSameExprOnSubsequentCalls
[       OK ] ArenaTest.GetOrCreateDisjunctionReturnsSameExprOnSubsequentCalls (0 ms)
[----------] 1 test from ArenaTest (0 ms total)

[----------] 1 test from EnvironmentTest
[ RUN      ] EnvironmentTest.LambdaCapturingThisInFieldInitializer
[       OK ] EnvironmentTest.LambdaCapturingThisInFieldInitializer (3 ms)
[----------] 1 test from EnvironmentTest (3 ms total)
...

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.

5 participants