Skip to content

Commit

Permalink
Merged master:e7b4feea8e1b into amd-gfx:f99c1c4e1ba6
Browse files Browse the repository at this point in the history
Local branch amd-gfx f99c1c4 Merged master:633f9fcb820b into amd-gfx:7af372bc8c89
Remote branch master e7b4fee [Format/ObjC] Add NS_SWIFT_NAME() and CF_SWIFT_NAME() to WhitespaceSensitiveMacros
  • Loading branch information
Sw authored and Sw committed Oct 14, 2020
2 parents f99c1c4 + e7b4fee commit 5894e00
Show file tree
Hide file tree
Showing 12 changed files with 1,216 additions and 773 deletions.
1 change: 1 addition & 0 deletions clang/include/clang/module.modulemap
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ module Clang_Basic {
textual header "Basic/OpenMPKinds.def"
textual header "Basic/OperatorKinds.def"
textual header "Basic/Sanitizers.def"
textual header "Basic/TargetCXXABI.def"
textual header "Basic/TokenKinds.def"
textual header "Basic/X86Target.def"

Expand Down
2 changes: 2 additions & 0 deletions clang/lib/Format/Format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,8 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) {
LLVMStyle.WhitespaceSensitiveMacros.push_back("STRINGIZE");
LLVMStyle.WhitespaceSensitiveMacros.push_back("PP_STRINGIZE");
LLVMStyle.WhitespaceSensitiveMacros.push_back("BOOST_PP_STRINGIZE");
LLVMStyle.WhitespaceSensitiveMacros.push_back("NS_SWIFT_NAME");
LLVMStyle.WhitespaceSensitiveMacros.push_back("CF_SWIFT_NAME");

// Defaults that differ when not C++.
if (Language == FormatStyle::LK_TableGen) {
Expand Down
6 changes: 6 additions & 0 deletions clang/unittests/Format/FormatTestObjC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,12 @@ TEST_F(FormatTestObjC, ObjCSnippets) {
verifyFormat("@property(assign, nonatomic) CGFloat hoverAlpha;");
verifyFormat("@property(assign, getter=isEditable) BOOL editable;");

verifyFormat("extern UIWindow *MainWindow(void) "
"NS_SWIFT_NAME(getter:MyHelper.mainWindow());");

verifyFormat("extern UIWindow *MainWindow(void) "
"CF_SWIFT_NAME(getter:MyHelper.mainWindow());");

Style.ColumnLimit = 50;
verifyFormat("@interface Foo\n"
"- (void)doStuffWithFoo:(id)name\n"
Expand Down
2 changes: 1 addition & 1 deletion mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class Linalg_ReshapeLikeOp<string mnemonic, list<OpTrait> traits = []> :
"ArrayRef<NamedAttribute> attrs = {}", [{
auto reassociationMaps =
convertReassociationIndicesToMaps($_builder, reassociation);
build($_builder, $_state, src, reassociationMaps, attrs);
build($_builder, $_state, resultType, src, reassociationMaps, attrs);
}]>
];

Expand Down
14 changes: 14 additions & 0 deletions mlir/include/mlir/Dialect/Linalg/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ std::unique_ptr<OperationPass<FuncOp>> createLinalgFoldUnitExtentDimsPass();

std::unique_ptr<OperationPass<FuncOp>> createLinalgFusionPass();
std::unique_ptr<Pass> createLinalgFusionOfTensorOpsPass();
std::unique_ptr<Pass> createFoldReshapeOpsByLinearizationPass();

std::unique_ptr<OperationPass<FuncOp>>
createLinalgTilingPass(ArrayRef<int64_t> tileSizes = {});
Expand Down Expand Up @@ -48,6 +49,19 @@ std::unique_ptr<OperationPass<FuncOp>> createConvertLinalgToAffineLoopsPass();
/// buffers instead.
std::unique_ptr<OperationPass<ModuleOp>> createLinalgBufferizePass();

/// Patterns to fold an expanding (collapsing) tensor_reshape operation with its
/// producer (consumer) generic operation by expanding the dimensionality of the
/// loop in the generic op.
void populateFoldReshapeOpsByExpansionPatterns(
MLIRContext *context, OwningRewritePatternList &patterns);

/// Patterns to fold a collapsing (expanding) tensor_reshape operation with its
/// producer (consumer) generic/indexed_generic operation by linearizing the
/// indexing map used to access the source (target) of the reshape operation in
/// the generic/indexed_generic operation.
void populateFoldReshapeOpsByLinearizationPatterns(
MLIRContext *context, OwningRewritePatternList &patterns);

/// Patterns for fusing linalg operation on tensors.
void populateLinalgTensorOpsFusionPatterns(MLIRContext *context,
OwningRewritePatternList &patterns);
Expand Down
8 changes: 8 additions & 0 deletions mlir/include/mlir/Dialect/Linalg/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ def LinalgFusionOfTensorOps : Pass<"linalg-fusion-for-tensor-ops"> {
let dependentDialects = ["linalg::LinalgDialect", "AffineDialect"];
}

def LinalgFoldReshapeOpsByLinearization :
Pass<"linalg-fold-reshape-ops-by-linearization"> {
let summary = "Fold TensorReshapeOps with generic/indexed generic ops by "
"linearization";
let constructor = "mlir::createFoldReshapeOpsByLinearizationPass()";
let dependentDialects = ["AffineDialect"];
}

def LinalgLowerToAffineLoops : FunctionPass<"convert-linalg-to-affine-loops"> {
let summary = "Lower the operations from the linalg dialect into affine "
"loops";
Expand Down
6 changes: 3 additions & 3 deletions mlir/include/mlir/Dialect/Linalg/Utils/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ Optional<FusionInfo> fuseProducerOf(OpBuilder &b, LinalgOp consumer,

/// Fuse linalg operation on tensors, with the producer of the operand at
/// position `consumerIdx` of the consumer.
Operation *fuseTensorOps(PatternRewriter &rewriter, Operation *consumer,
unsigned consumerIdx,
OperationFolder *folder = nullptr);
Optional<SmallVector<Value, 1>>
fuseTensorOps(PatternRewriter &rewriter, Operation *consumer,
unsigned consumerIdx, OperationFolder *folder = nullptr);

/// Returns the linearized list of all shape dimensions in a `linalgOp`.
/// Applying the inverse, concatenated loopToOperandRangeMaps to this list
Expand Down
5 changes: 2 additions & 3 deletions mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,9 +514,8 @@ struct CollapseReshapeOps : public OpRewritePattern<ReshapeOpTy> {
return success();
}
// Check if producer and consumer are both collapsing dims.
else if (areReshapeOpsFoldable(srcReshapeOp.getSrcType(),
reshapeOp.getSrcType(),
reshapeOp.getResultType())) {
if (areReshapeOpsFoldable(srcReshapeOp.getSrcType(), reshapeOp.getSrcType(),
reshapeOp.getResultType())) {
rewriter.replaceOpWithNewOp<ReshapeOpTy>(
reshapeOp, reshapeOp.getResultType(), srcReshapeOp.src(),
collapseReassociationMaps(srcReshapeOp.getReassociationMaps(),
Expand Down
Loading

0 comments on commit 5894e00

Please sign in to comment.