Skip to content

Commit

Permalink
Integrates/llvm 20240910 (#18480)
Browse files Browse the repository at this point in the history
Bumps llvm to commit:
iree-org/llvm-project@e268afb
in branch
https://github.com/iree-org/llvm-project/tree/shared/integrates_20240910

Following changes are made:
1. Fix formatv call to pass validation added by
llvm/llvm-project#105745
2. API changes in DICompositeTypeAttr::get introduced by
llvm/llvm-project#106571
  3. Fix API call from llvm/llvm-project#100361
  4. Fix chipset comparison in ROCMTarget.cpp

There are two cherry-picks from upstream main as they contain fixes we
need and one cheery-pick that is yet to land
1.
iree-org/llvm-project@0d5d355
2.
iree-org/llvm-project@650d852
3.
iree-org/llvm-project@e268afb
(the upstream PR for this one is
llvm/llvm-project#108302

And a revert due to an outstanding torch-mlir issue

iree-org/llvm-project@cf22797
  • Loading branch information
nirvedhmeshram authored Sep 12, 2024
1 parent 5a6521c commit 861695b
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 21 deletions.
2 changes: 1 addition & 1 deletion compiler/plugins/target/ROCM/ROCMTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ static void annotateKernelForTranslation(LLVM::LLVMFuncOp funcOp,
FailureOr<amdgpu::Chipset> chipset = getChipsetVersion(targetAttr);
if (failed(chipset))
return;
if (chipset->majorVersion != 9 && chipset->minorVersion < 0x40)
if (chipset->majorVersion != 9 || *chipset < amdgpu::Chipset(9, 4, 0))
return;

auto inRegAttrName =
Expand Down
1 change: 1 addition & 0 deletions compiler/plugins/target/ROCM/ROCMTargetUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ static void overridePlatformGlobal(llvm::Module *module, StringRef globalName,

LogicalResult setHIPGlobals(Location loc, llvm::Module *module,
StringRef targetChip) {
// TODO: This should be updated to use `amdgpu::Chipset`.
// Link target chip ISA version as global.
const int kLenOfChipPrefix = 3;
StringRef chipId = targetChip.substr(kLenOfChipPrefix);
Expand Down
7 changes: 2 additions & 5 deletions compiler/src/iree/compiler/Codegen/LLVMCPU/DispatchABI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ ExecutableLibraryDI::getPtrOf(LLVM::DITypeAttr typeAttr) {
LLVM::DICompositeTypeAttr
ExecutableLibraryDI::getArrayOf(LLVM::DITypeAttr typeAttr, int64_t count) {
return LLVM::DICompositeTypeAttr::get(
builder.getContext(), llvm::dwarf::DW_TAG_array_type, /*recId=*/{},
builder.getContext(), llvm::dwarf::DW_TAG_array_type,
/*name=*/builder.getStringAttr(""), fileAttr,
/*line=*/227, fileAttr,
/*baseType=*/typeAttr, LLVM::DIFlags::Zero,
Expand Down Expand Up @@ -221,7 +221,7 @@ LLVM::DITypeAttr ExecutableLibraryDI::getBasicType(Type type) {
LLVM::DICompositeTypeAttr ExecutableLibraryDI::getProcessorV0T() {
unsigned offsetInBits = 0;
return LLVM::DICompositeTypeAttr::get(
builder.getContext(), llvm::dwarf::DW_TAG_structure_type, /*recId=*/{},
builder.getContext(), llvm::dwarf::DW_TAG_structure_type,
builder.getStringAttr("iree_hal_processor_v0_t"), fileAttr,
/*line=*/227, fileAttr,
/*baseType=*/nullptr, LLVM::DIFlags::Zero, /*sizeInBits=*/512,
Expand All @@ -239,7 +239,6 @@ LLVM::DIDerivedTypeAttr ExecutableLibraryDI::getEnvironmentV0T() {
"iree_hal_executable_environment_v0_t",
LLVM::DICompositeTypeAttr::get(
builder.getContext(), llvm::dwarf::DW_TAG_structure_type,
/*recId=*/{},
builder.getStringAttr("iree_hal_executable_environment_v0_t"),
fileAttr,
/*line=*/246, fileAttr,
Expand Down Expand Up @@ -268,7 +267,6 @@ LLVM::DIDerivedTypeAttr ExecutableLibraryDI::getDispatchStateV0T() {
"iree_hal_executable_dispatch_state_v0_t",
LLVM::DICompositeTypeAttr::get(
builder.getContext(), llvm::dwarf::DW_TAG_structure_type,
/*recId=*/{},
builder.getStringAttr("iree_hal_executable_dispatch_state_v0_t"),
fileAttr, /*line=*/275, fileAttr,
/*baseType=*/nullptr, LLVM::DIFlags::Zero, /*sizeInBits=*/384,
Expand Down Expand Up @@ -304,7 +302,6 @@ LLVM::DIDerivedTypeAttr ExecutableLibraryDI::getWorkgroupStateV0T() {
"iree_hal_executable_workgroup_state_v0_t",
LLVM::DICompositeTypeAttr::get(
builder.getContext(), llvm::dwarf::DW_TAG_structure_type,
/*recId=*/{},
builder.getStringAttr("iree_hal_executable_workgroup_state_v0_t"),
fileAttr, /*line=*/321, fileAttr,
/*baseType=*/nullptr, LLVM::DIFlags::Zero, /*sizeInBits=*/256,
Expand Down
1 change: 1 addition & 0 deletions compiler/src/iree/compiler/Codegen/LLVMGPU/Passes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "llvm/Support/CommandLine.h"
#include "mlir/Conversion/AffineToStandard/AffineToStandard.h"
#include "mlir/Conversion/ComplexToStandard/ComplexToStandard.h"
#include "mlir/Conversion/MathToLLVM/MathToLLVM.h"
#include "mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h"
#include "mlir/Dialect/Affine/Passes.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,9 @@ static void prettyPrintStreamInfo(const UsageInfo &usageInfo,
llvm::raw_fd_ostream &os) {
auto parentOp = executeOp->getParentOfType<mlir::FunctionOpInterface>();

prettyPrintItemHeader(
llvm::formatv("stream.cmd.execute", parentOp->getName().getStringRef()),
os);
prettyPrintItemHeader(llvm::Twine("stream.cmd.execute ") +
parentOp->getName().getStringRef(),
os);
os << "// ";
prettyPrintOpBreadcrumb(executeOp, os);
os << "\n";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,8 @@ class TimepointCoverage
.Case([&](mlir::CallOpInterface callOp) {
// Step into callees and get a coverage intersection of all return
// sites.
auto callableOp =
callOp.resolveCallable(&solver.getExplorer().getSymbolTables());
auto callableOp = callOp.resolveCallableInTable(
&solver.getExplorer().getSymbolTables());
unsigned resultIndex = llvm::cast<OpResult>(value).getResultNumber();
gatherRegionReturns(callableOp, resultIndex);
})
Expand Down
26 changes: 17 additions & 9 deletions compiler/src/iree/compiler/Dialect/VM/Tools/VMOpEncoderGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,27 @@ bool emitEncodeFnDefs(const llvm::RecordKeeper &recordKeeper, raw_ostream &os) {
StringRef expr = encodingExpr->getValueAsString("expr");
std::vector<StringRef> params =
encodingExpr->getValueAsListOfStrings("params");
assert(params.size() <= 1);

// Note the following relies on the fact that only encoding expressions
// involving operands/results have one parameter. It's a bit inflexible,
// Note the following relies on the fact that encoding expressions
// have zero or one parameter. It's a bit inflexible,
// but it works for now and we can change when the extra flexibility is
// really needed.
std::string param;
if (params.size() == 1) {
param = "get" + llvm::convertToCamelFromSnakeCase(params.front(), true);
} else {
param = expr;
switch (params.size()) {
case 0: {
os << "failed(" << formatv(expr.data()) << ")";
break;
}
case 1: {
std::string param =
"get" + llvm::convertToCamelFromSnakeCase(params.front(), true);
os << "failed(" << formatv(expr.data(), param) << ")";
break;
}
default: {
assert(false && "unhandled parameter size");
break;
}
}
os << formatv("failed({0})", formatv(expr.data(), param));
};
interleave(encodingExprs, os, printOneCondition, " ||\n ");
os << ") {\n";
Expand Down
2 changes: 1 addition & 1 deletion third_party/llvm-project
Submodule llvm-project updated 5292 files

0 comments on commit 861695b

Please sign in to comment.