[llvm] [KernelInfo] Implement new LLVM IR pass for GPU code analysis (PR #102944)
Joel E. Denny via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 16 09:22:21 PDT 2024
================
@@ -0,0 +1,121 @@
+//=- KernelInfo.h - Kernel Analysis -------------------------------*- C++ -*-=//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the KernelInfo, KernelInfoAnalysis, and KernelInfoPrinter
+// classes used to extract function properties from a GPU kernel.
+//
+// See llvm/docs/KernelInfo.rst.
+// ===---------------------------------------------------------------------===//
+
+#ifndef LLVM_ANALYSIS_KERNELINFO_H
+#define LLVM_ANALYSIS_KERNELINFO_H
+
+#include "llvm/Analysis/OptimizationRemarkEmitter.h"
+#include "llvm/Analysis/TargetTransformInfo.h"
+
+namespace llvm {
+class DominatorTree;
+class Function;
+
+/// Data structure holding function info for kernels.
+class KernelInfo {
+ void updateForBB(const BasicBlock &BB, int64_t Direction,
+ OptimizationRemarkEmitter &ORE);
+
+public:
+ static KernelInfo getKernelInfo(Function &F, FunctionAnalysisManager &FAM);
+
+ bool operator==(const KernelInfo &FPI) const {
+ return std::memcmp(this, &FPI, sizeof(KernelInfo)) == 0;
----------------
jdenny-ornl wrote:
Sorry, those functions are unused. Removed. Thanks.
https://github.com/llvm/llvm-project/pull/102944
More information about the llvm-commits
mailing list