Skip to content

[AMDGPU] Fix unittest linking error with LLVM_LINK_LLVM_DYLIB #91727

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 2 commits into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "llvm/BinaryFormat/MsgPackDocument.h"
#include "llvm/Support/AMDGPUMetadata.h"
#include "llvm/Support/Alignment.h"
#include "llvm/Support/Compiler.h"

namespace llvm {

Expand Down Expand Up @@ -61,7 +62,8 @@ class MetadataStreamer {
msgpack::MapDocNode Kern) = 0;
};

class MetadataStreamerMsgPackV4 : public MetadataStreamer {
class LLVM_EXTERNAL_VISIBILITY MetadataStreamerMsgPackV4
: public MetadataStreamer {
protected:
std::unique_ptr<msgpack::Document> HSAMetadataDoc =
std::make_unique<msgpack::Document>();
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/AMDGPU/SIProgramInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define LLVM_LIB_TARGET_AMDGPU_SIPROGRAMINFO_H

#include "llvm/IR/CallingConv.h"
#include "llvm/Support/Compiler.h"
#include <cstdint>

namespace llvm {
Expand All @@ -27,7 +28,7 @@ class MCExpr;
class MachineFunction;

/// Track resource usage for kernels / entry functions.
struct SIProgramInfo {
struct LLVM_EXTERNAL_VISIBILITY SIProgramInfo {
// Fields set in PGM_RSRC1 pm4 packet.
const MCExpr *VGPRBlocks = nullptr;
const MCExpr *SGPRBlocks = nullptr;
Expand Down
12 changes: 4 additions & 8 deletions llvm/unittests/MC/AMDGPU/SIProgramInfoMCExprs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
//===----------------------------------------------------------------------===//

#include "AMDGPUHSAMetadataStreamer.h"
#include "AMDGPUTargetMachine.h"
#include "GCNSubtarget.h"
#include "SIProgramInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
Expand All @@ -25,9 +24,8 @@ using namespace llvm;

class SIProgramInfoMCExprsTest : public testing::Test {
protected:
std::unique_ptr<GCNTargetMachine> TM;
std::unique_ptr<LLVMTargetMachine> TM;
std::unique_ptr<LLVMContext> Ctx;
std::unique_ptr<GCNSubtarget> ST;
std::unique_ptr<MachineModuleInfo> MMI;
std::unique_ptr<MachineFunction> MF;
std::unique_ptr<Module> M;
Expand All @@ -49,7 +47,7 @@ class SIProgramInfoMCExprsTest : public testing::Test {
const Target *TheTarget = TargetRegistry::lookupTarget(Triple, Error);
TargetOptions Options;

TM.reset(static_cast<GCNTargetMachine *>(TheTarget->createTargetMachine(
TM.reset(static_cast<LLVMTargetMachine *>(TheTarget->createTargetMachine(
Triple, CPU, FS, Options, std::nullopt, std::nullopt)));

Ctx = std::make_unique<LLVMContext>();
Expand All @@ -59,9 +57,7 @@ class SIProgramInfoMCExprsTest : public testing::Test {
auto *F = Function::Create(FType, GlobalValue::ExternalLinkage, "Test", *M);
MMI = std::make_unique<MachineModuleInfo>(TM.get());

ST = std::make_unique<GCNSubtarget>(TM->getTargetTriple(),
TM->getTargetCPU(),
TM->getTargetFeatureString(), *TM);
auto *ST = TM->getSubtargetImpl(*F);

MF = std::make_unique<MachineFunction>(*F, *TM, *ST, 1, *MMI);
PI.reset(*MF.get());
Expand Down
Loading