*
* This function is called back by the functions that need to return a reference
* to the portion of the string with the following arguments:
- * - an MlirStringRef represening the current portion of the string
+ * - an MlirStringRef representing the current portion of the string
* - a pointer to user data forwarded from the printing call.
*/
typedef void (*MlirStringCallback)(MlirStringRef, void *);
/// the host module code to LLVM.
///
/// This transformation creates a sequence of global variables that are later
-/// linked to the varables in the kernel module, and a series of copies to/from
+/// linked to the variables in the kernel module, and a series of copies to/from
/// them to emulate the memory transfer from the host or to the device sides. It
/// also converts the remaining Standard dialect into LLVM dialect, emitting C
/// wrappers.
AllTypesMatch<["src1", "src2"]>,
AllTypesMatch<["acc", "dst"]>,
]> {
- let summary = "Matrix-matrix mutiply and accumulate op";
+ let summary = "Matrix-matrix multiply and accumulate op";
let description = [{
SMMLA: Signed integer matrix multiply-accumulate.
AllTypesMatch<["src1", "src2"]>,
AllTypesMatch<["acc", "dst"]>,
]> {
- let summary = "Matrix-matrix mutiply and accumulate op";
+ let summary = "Matrix-matrix multiply and accumulate op";
let description = [{
UMMLA: Unsigned integer matrix multiply-accumulate.
// 1. Operation returns async result (e.g. the result of an `async.execute`).
// 2. Async value passed in as a block argument.
//
-// It is the responsiblity of the async value user to extend the lifetime by
+// It is the responsibility of the async value user to extend the lifetime by
// adding a +1 reference, if the reference counted value captured by the
// asynchronously executed region (`async.execute` operation), and drop it after
// the last nested use.
* In a "do-while" loop, this region contains the loop body. */
%next = call @payload(%arg1) : (f32) -> f32
- /* And also evalutes the condition. */
+ /* And also evaluates the condition. */
%condition = call @evaluate_condition(%arg1) : (f32) -> i1
/* Loop through the "after" region. */
* "after" region. */
%shared = call @shared_compute(%arg1) : (f32) -> i64
- /* Evalute the condition. */
+ /* Evaluate the condition. */
%condition = call @evaluate_condition(%arg1, %shared) : (f32, i64) -> i1
/* Forward the result of the shared computation to the "after" region.
<!-- End of AutoGen section -->
```
uclamp-op ::= ssa-id `=` `spv.GLSL.UClamp` ssa-use, ssa-use, ssa-use `:`
- unsgined-signless-scalar-vector-type
+ unsigned-signless-scalar-vector-type
```
#### Example:
// Uninitialized externally visible variable.
global_memref @z : memref<3xf16> = uninitialized
- // Externally visibile constant variable.
+ // Externally visible constant variable.
global_memref constant @c : memref<2xi32> = dense<1, 4>
```
}];
As this pass rewrites function operations, it also rewrites the
corresponding return operations. Other return-like operations that
implement the `ReturnLike` trait are not rewritten in general, as they
- require that the correspondign parent operation is also rewritten.
+ require that the corresponding parent operation is also rewritten.
Finally, this pass fails for unknown terminators, as we cannot decide
whether they need rewriting.
}];
namespace tosa {
//===----------------------------------------------------------------------===//
-// Utililty functions to support quantization handling in Tosa.
+// Utility functions to support quantization handling in Tosa.
//===----------------------------------------------------------------------===//
/// From a scale value, computes multiplier and shift values
along each dimension.
The dimension associated to each element of `ids` used to extract are
- implicitly deduced from the the destination type. For each dimension the
+ implicitly deduced from the destination type. For each dimension the
multiplicity is the destination dimension size divided by the source
dimension size, each dimension with a multiplicity greater than 1 is
associated to the next id, following ids order.
namespace mlir {
-/// ImplictLocOpBuilder maintains a 'current location', allowing use of the
+/// ImplicitLocOpBuilder maintains a 'current location', allowing use of the
/// create<> method without specifying the location. It is otherwise the same
/// as OpBuilder.
class ImplicitLocOpBuilder : public mlir::OpBuilder {
} // namespace mlir
-#endif // MLIR_IR_IMPLICITLOCOPBUILDER_H
\ No newline at end of file
+#endif // MLIR_IR_IMPLICITLOCOPBUILDER_H
/// Ensure that the given region has the terminator required by this trait.
/// If OpBuilder is provided, use it to build the terminator and notify the
- /// OpBuilder litsteners accordingly. If only a Builder is provided, locally
+ /// OpBuilder listeners accordingly. If only a Builder is provided, locally
/// construct an OpBuilder with no listeners; this should only be used if no
/// OpBuilder is available at the call site, e.g., in the parser.
static void ensureTerminator(Region ®ion, Builder &builder,
std::unique_ptr<detail::PassPipelineCLParserImpl> impl;
};
-/// This class implements a command-line parser spefically for MLIR pass names.
-/// It registers a cl option with a given argument and description that accepts
-/// a comma delimited list of pass names.
+/// This class implements a command-line parser specifically for MLIR pass
+/// names. It registers a cl option with a given argument and description that
+/// accepts a comma delimited list of pass names.
class PassNameCLParser {
public:
/// Construct a parser with the given command line description.
return *this;
}
- /// Emits whitespace and sets the indendation for the stream.
+ /// Emits whitespace and sets the indentation for the stream.
raw_indented_ostream &indent(int with) {
os.indent(with);
atStartOfLine = false;
DenseMap<Block *, llvm::BasicBlock *> blockMapping;
/// A mapping between MLIR LLVM dialect terminators and LLVM IR terminators
- /// they are converted to. This allows for conneting PHI nodes to the source
+ /// they are converted to. This allows for connecting PHI nodes to the source
/// values after all operations are converted.
DenseMap<Operation *, llvm::Instruction *> branchMapping;
};
TypeToLLVMIRTranslator(llvm::LLVMContext &context);
~TypeToLLVMIRTranslator();
- /// Returns the perferred alignment for the type given the data layout. Note
+ /// Returns the preferred alignment for the type given the data layout. Note
/// that this will perform type conversion and store its results for future
/// uses.
// TODO: this should be removed when MLIR has proper data layout.
/// "legal" in the given ConversionTarget.
///
/// This function should be called by all bufferization passes using
-/// BufferizeTypeConverter so that materializations work proprely. One exception
+/// BufferizeTypeConverter so that materializations work properly. One exception
/// is bufferization passes doing "full" conversions, where it can be desirable
/// for even the materializations to remain illegal so that they are eliminated,
/// such as via the patterns in
/// constant term.
static int64_t valueAt(ArrayRef<int64_t> expr, ArrayRef<int64_t> point) {
assert(expr.size() == 1 + point.size() &&
- "Dimensionalities of point and expresion don't match!");
+ "Dimensionalities of point and expression don't match!");
int64_t value = expr.back();
for (unsigned i = 0; i < point.size(); ++i)
value += expr[i] * point[i];
}
static void bind(py::module &m) {
- py::class_<PyRegionList>(m, "ReqionSequence")
+ py::class_<PyRegionList>(m, "RegionSequence")
.def("__len__", &PyRegionList::dunderLen)
.def("__getitem__", &PyRegionList::dunderGetItem);
}
-//===- CAPIPasses.cpp - C API for Tranformations Passes -------------------===//
+//===- CAPIPasses.cpp - C API for Transformations Passes ------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
targetMachine.reset(target->createTargetMachine(triple.str(), targetChip,
features, {}, {}));
if (targetMachine == nullptr) {
- emitError(loc, "connot initialize target machine");
+ emitError(loc, "cannot initialize target machine");
return {};
}
}
// PredicateBuilder
//===----------------------------------------------------------------------===//
-/// This class provides utilties for constructing predicates.
+/// This class provides utilities for constructing predicates.
class PredicateBuilder {
public:
PredicateBuilder(PredicateUniquer &uniquer, MLIRContext *ctx)
auto numKernelOperands = launchOp.getNumKernelOperands();
auto kernelOperands = operands.take_back(numKernelOperands);
for (auto operand : llvm::enumerate(kernelOperands)) {
- // Check if the kernel's opernad is a ranked memref.
+ // Check if the kernel's operand is a ranked memref.
auto memRefType = launchOp.getKernelOperand(operand.index())
.getType()
.dyn_cast<MemRefType>();
return [&, loopIdx](OpBuilder &b, Location loc, Value iv, ValueRange args) {
blockInductionVars[loopIdx] = iv;
- // Continute building async loop nest.
+ // Continue building async loop nest.
if (loopIdx < op.getNumLoops() - 1) {
b.create<scf::ForOp>(
loc, blockLowerBounds[loopIdx + 1], blockUpperBounds[loopIdx + 1],
/// Returns the identifier of a key for identified structs.
StringRef getIdentifier() const {
assert(isIdentified() &&
- "non-identified struct key canont have an identifier");
+ "non-identified struct key cannot have an identifier");
return name;
}
key.isOpaque());
}
- /// Hook into the type unquing infrastructure.
+ /// Hook into the type uniquing infrastructure.
bool operator==(const KeyTy &other) const { return getKey() == other; };
static llvm::hash_code hashKey(const KeyTy &key) { return key.hashValue(); }
static LLVMStructTypeStorage *construct(TypeStorageAllocator &allocator,
// the operation, if the accesses in the producer/consumer are transposes
// of each other, the loop bounds for the tiled producer can be
// manipulated accordingly. This requires some additional bookkeeping in
- // the implementation of tile+fuse that is defered to later.
+ // the implementation of tile+fuse that is deferred to later.
if (doesTransposeAccess(*consumerLoopToProducerLoop, fusableLoops)) {
op.emitRemark("unhandled fusion when fusion requires permutation");
return {};
if (!consumerMap.isProjectedPermutation()) {
op.emitRemark(
"unhandled case where indexing map for fused view in the consumer "
- "is "
- "not a projected permuration while fusing at index ")
+ "is not a projected permutation while fusing at index ")
<< operandIndex;
return FusableOpDependencesTy{};
}
}
/// Computes a single conjunction of two lattice points by taking the "union"
- /// of loop indices (effectively constucting a larger "intersection" of those
+ /// of loop indices (effectively constructing a larger "intersection" of those
/// indices) with a newly constructed tensor (sub)expression of given kind.
/// Returns the index of the new lattice point.
unsigned conjLatPoint(Kind kind, unsigned p0, unsigned p1) {
<< resultTypes.size() << " constraints";
}
- // If the operation is within a rewrite body and doesn't have type inferrence,
+ // If the operation is within a rewrite body and doesn't have type inference,
// ensure that the result types can be resolved.
if (isWithinRewrite && !op.hasTypeInference()) {
if (failed(verifyResultTypesAreInferrable(op, opResults, resultTypes)))
/// An identified struct type is uniqued only by the first part (field 0)
/// of the key.
///
- /// A literal struct type is unqiued only by the second part (fields 1, 2, and
+ /// A literal struct type is uniqued only by the second part (fields 1, 2, and
/// 3) of the key. The identifier field (field 0) must be empty.
using KeyTy =
std::tuple<StringRef, ArrayRef<Type>, ArrayRef<StructType::OffsetInfo>,
//
//===----------------------------------------------------------------------===//
//
-// This file implements the the SPIR-V module combiner library.
+// This file implements the SPIR-V module combiner library.
//
//===----------------------------------------------------------------------===//
/// Note: We use the operation's name (not the symbol name) as part of the hash
/// computation. This prevents, for example, mistakenly considering a global
/// variable and a spec constant as duplicates because their descriptor set +
-/// binding and spec_id, repectively, happen to hash to the same value.
+/// binding and spec_id, respectively, happen to hash to the same value.
static llvm::hash_code computeHash(SymbolOpInterface symbolOp) {
llvm::hash_code hashCode(0);
hashCode = llvm::hash_combine(symbolOp->getName());
// renamed in order to maintain the conflicting symbol in the input module
// being merged. For example, if the conflict is between a global variable in
// the current combined module and a function in the input module, the global
- // varaible is renamed. In order to notify listeners of the symbol updates in
+ // variable is renamed. In order to notify listeners of the symbol updates in
// such cases, we need to keep track of the module from which the renamed
// symbol in the combined module originated. This map keeps such information.
DenseMap<StringRef, spirv::ModuleOp> symNameToModuleMap;
spirv::ModuleOp moduleClone = module.clone();
// In the combined module, rename all symbols that conflict with symbols
- // from the current input module. This renmaing applies to all ops except
+ // from the current input module. This renaming applies to all ops except
// for spv.funcs. This way, if the conflicting op in the input module is
// non-spv.func, we rename that symbol instead and maintain the spv.func in
// the combined module name as it is.
symRenameListener(originalModule, oldSymName, newSymName);
// Since the symbol name is updated, there is no need to maintain the
- // entry that assocaites the old symbol name with the original module.
+ // entry that associates the old symbol name with the original module.
symNameToModuleMap.erase(oldSymName);
// Instead, add a new entry to map the new symbol name to the original
// module in case it gets renamed again later.
}
};
-/// Fold dim of a dim of a cast into the the dim of the source of the tensor
-/// cast.
+/// Fold dim of a dim of a cast into the dim of the source of the tensor cast.
template <typename CastOpTy>
struct DimOfCastOp : public OpRewritePattern<DimOp> {
using OpRewritePattern<DimOp>::OpRewritePattern;
-//===- StdExpandDivs.cpp - Code to prepare Std for lowring Divs 0to LLVM -===//
+//===- StdExpandDivs.cpp - Code to prepare Std for lowering Divs to LLVM -===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
//===----------------------------------------------------------------------===//
//
// This file Std transformations to expand Divs operation to help for the
-// lowering to LLVM. Currently implemented tranformations are Ceil and Floor
+// lowering to LLVM. Currently implemented transformations are Ceil and Floor
// for Signed Integers.
//
//===----------------------------------------------------------------------===//
static void computeReshapeOutput(ArrayRef<int64_t> higherRankShape,
ArrayRef<int64_t> lowerRankShape,
SmallVectorImpl<int64_t> &reshapeOutputShape) {
- // Intialize new shapes with [1] * higherRank.
+ // Initialize new shapes with [1] * higherRank.
int64_t higherRank = higherRankShape.size();
int64_t lowerRank = lowerRankShape.size();
auto dstVecType = op.getType().cast<VectorType>();
unsigned dstRank = dstVecType.getRank();
unsigned rankDiff = dstRank - srcRrank;
- // Check if the most inner dimensions of the source of the broacast are the
+ // Check if the most inner dimensions of the source of the broadcast are the
// same as the destination of the extract. If this is the case we can just
// use a broadcast as the original dimensions are untouched.
bool lowerDimMatch = true;
private:
/// Print the given operation in the generic form.
void printGenericOp(Operation *op) override {
- // Consider nested opertions for aliases.
+ // Consider nested operations for aliases.
if (op->getNumRegions() != 0) {
for (Region ®ion : op->getRegions())
printRegion(region, /*printEntryBlockArgs=*/true,
if (succeeded(generateAlias(type, aliasToType)))
return;
- // Visit several subtypes that contain types or atttributes.
+ // Visit several subtypes that contain types or attributes.
if (auto funcType = type.dyn_cast<FunctionType>()) {
// Visit input and result types for functions.
for (auto input : funcType.getInputs())
PDLByteCodeMutableState &state,
SmallVectorImpl<MatchResult> *matches) const;
- /// A vector containing pointers to unqiued data. The storage is intentionally
+ /// A vector containing pointers to uniqued data. The storage is intentionally
/// opaque such that we can store a wide range of data types. The types of
/// data stored here include:
/// * Attribute, Identifier, OperationName, Type
LogicalResult Serializer::processType(Location loc, Type type,
uint32_t &typeID) {
// Maintains a set of names for nested identified struct types. This is used
- // to properly serialize resursive references.
+ // to properly serialize recursive references.
llvm::SetVector<StringRef> serializationCtx;
return processTypeImpl(loc, type, typeID, serializationCtx);
}
//
//===----------------------------------------------------------------------===//
//
-// This file implements utilties for buffer optimization passes.
+// This file implements utilities for buffer optimization passes.
//
//===----------------------------------------------------------------------===//
return constOp;
}
- // TODO: To faciliate splitting the std dialect (PR48490), have a special case
- // for falling back to std.constant. Eventually, we will have separate ops
- // tensor.constant, int.constant, float.constant, etc. that live in their
+ // TODO: To facilitate splitting the std dialect (PR48490), have a special
+ // case for falling back to std.constant. Eventually, we will have separate
+ // ops tensor.constant, int.constant, float.constant, etc. that live in their
// respective dialects, which will allow each dialect to implement the
// materializeConstant hook above.
//
return success(checkTilingLegalityImpl(origLoops));
}
-/// Check if the input data is valid and wheter tiled code will be legal or not.
+/// Check if the input data is valid and whether tiled code will be legal or
+/// not.
template <typename t>
void performPreTilingChecks(MutableArrayRef<AffineForOp> input,
ArrayRef<t> tileSizes) {
// If the lhs or rhs has external uses, the blocks cannot be merged as the
// merged version of this operation will not be either the lhs or rhs
- // alone (thus semantically incorrect), but some mix dependening on which
+ // alone (thus semantically incorrect), but some mix dependending on which
// block preceeded this.
// TODO allow merging of operations when one block does not dominate the
// other