Skip to content
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
7 changes: 4 additions & 3 deletions mlir/lib/Target/LLVM/ModuleToObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,18 @@ ModuleToObject::getOrCreateTargetMachine() {
return targetMachine.get();
// Load the target.
std::string error;
llvm::Triple parsedTriple(triple);
const llvm::Target *target =
llvm::TargetRegistry::lookupTarget(triple, error);
llvm::TargetRegistry::lookupTarget(parsedTriple, error);
if (!target) {
getOperation().emitError()
<< "Failed to lookup target for triple '" << triple << "' " << error;
return std::nullopt;
}

// Create the target machine using the target.
targetMachine.reset(target->createTargetMachine(llvm::Triple(triple), chip,
features, {}, {}));
targetMachine.reset(
target->createTargetMachine(parsedTriple, chip, features, {}, {}));
if (!targetMachine)
return std::nullopt;
return targetMachine.get();
Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Target/LLVM/ROCDL/Target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ SerializeGPUModuleBase::assembleIsa(StringRef isa) {
llvm::Triple triple(llvm::Triple::normalize(targetTriple));
std::string error;
const llvm::Target *target =
llvm::TargetRegistry::lookupTarget(triple.normalize(), error);
llvm::TargetRegistry::lookupTarget(triple, error);
if (!target) {
emitError(loc, Twine("failed to lookup target: ") + error);
return std::nullopt;
Expand Down
7 changes: 4 additions & 3 deletions mlir/lib/Target/LLVMIR/Transforms/TargetUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,17 @@ getTargetMachine(mlir::LLVM::TargetAttrInterface attr) {
llvm::cast_if_present<LLVM::TargetFeaturesAttr>(attr.getFeatures());
std::string features = featuresAttr ? featuresAttr.getFeaturesString() : "";

llvm::Triple parsedTriple(triple);
std::string error;
const llvm::Target *target =
llvm::TargetRegistry::lookupTarget(triple, error);
llvm::TargetRegistry::lookupTarget(parsedTriple, error);
if (!target || !error.empty()) {
LDBG() << "Looking up target '" << triple << "' failed: " << error << "\n";
return failure();
}

return std::unique_ptr<llvm::TargetMachine>(target->createTargetMachine(
llvm::Triple(triple), chipAKAcpu, features, {}, {}));
return std::unique_ptr<llvm::TargetMachine>(
target->createTargetMachine(parsedTriple, chipAKAcpu, features, {}, {}));
}

FailureOr<llvm::DataLayout>
Expand Down