Some checks failed
Validate Operations / validate-operations (push) Failing after 18m36s
docs)
42 lines
1.6 KiB
C++
42 lines
1.6 KiB
C++
#include "llvm/ADT/STLExtras.h"
|
|
|
|
#include "src/Accelerators/PIM/Common/Support/Diagnostics.hpp"
|
|
|
|
namespace onnx_mlir::pim {
|
|
|
|
mlir::InFlightDiagnostic emitUnsupportedStaticShapeDiagnostic(mlir::Operation* op, llvm::StringRef valueDescription) {
|
|
return op->emitOpError() << "requires statically shaped " << valueDescription;
|
|
}
|
|
|
|
mlir::InFlightDiagnostic emitUnsupportedRankDiagnostic(mlir::Operation* op,
|
|
llvm::StringRef valueDescription,
|
|
int64_t actualRank,
|
|
llvm::ArrayRef<int64_t> supportedRanks) {
|
|
auto diag = op->emitOpError() << "has unsupported rank " << actualRank << " for " << valueDescription;
|
|
if (supportedRanks.empty())
|
|
return diag;
|
|
|
|
diag << "; supported rank";
|
|
if (supportedRanks.size() != 1)
|
|
diag << 's';
|
|
diag << ' ';
|
|
|
|
llvm::interleaveComma(supportedRanks, diag, [&](int64_t rank) { diag << rank; });
|
|
return diag;
|
|
}
|
|
|
|
mlir::InFlightDiagnostic
|
|
emitMissingSymbolDiagnostic(mlir::Operation* op, llvm::StringRef symbolKind, llvm::StringRef symbolName) {
|
|
return op->emitOpError() << "references missing " << symbolKind << " `" << symbolName << "`";
|
|
}
|
|
|
|
mlir::LogicalResult emitFileSystemError(mlir::Location loc,
|
|
llvm::StringRef action,
|
|
llvm::StringRef path,
|
|
const std::error_code& errorCode) {
|
|
mlir::emitError(loc) << "failed to " << action << " `" << path << "`: " << errorCode.message();
|
|
return mlir::failure();
|
|
}
|
|
|
|
} // namespace onnx_mlir::pim
|