amdgcn target machine creation assertion FuseFPOpsView RegisterCodeGenFlags

Creating the target machine with target 'amdgcn' hits the following assertion:

llvm-project/llvm/lib/CodeGen/CommandFlags.cpp:65: llvm::FPOpFusion::FPOpFusionMode llvm::codegen::getFuseFPOps(): Assertion `FuseFPOpsView && "RegisterCodeGenFlags not created."' failed.

Here the code that runs into the assertion:

llvm::Triple TheTriple;
TheTriple.setArch (llvm::Triple::ArchType::amdgcn);
TheTriple.setVendor (llvm::Triple::VendorType::AMD);
TheTriple.setOS (llvm::Triple::OSType::AMDHSA);

std::string Error;
const llvm::Target *TheTarget = llvm::TargetRegistry::lookupTarget( TheTriple.str() , Error );

llvm::TargetOptions Options = llvm::codegen::InitTargetOptionsFromCodeGenFlags();

std::string CPUStr("gfx906");
std::string FeaturesStr;

std::unique_ptr<llvm::TargetMachine> TargetMachine(TheTarget->createTargetMachine(
TheTriple.getTriple(),
CPUStr,
FeaturesStr,
Options,
llvm::Optional< llvm::Reloc::Model >() ));

Anyone sees what's missing?

This is using the llvm from RadeonOpenCompute/llvm-project and I am not sure what llvm version that corresponds to.

Thanks,

Frank

Hi Frank,

Creating the target machine with target 'amdgcn' hits the following
assertion:

llvm-project/llvm/lib/CodeGen/CommandFlags.cpp:65:
llvm::FPOpFusion::FPOpFusionMode llvm::codegen::getFuseFPOps():
Assertion `FuseFPOpsView && "RegisterCodeGenFlags not created."' failed.

Here the code that runs into the assertion:

[snip]

Does that error occur on LLVM master? If you're writing your own
frontend or tooling, that's what you should ideally target, because we
generally upstream our changes as much as possible.

Cheers,
Nicolai