Skip to content

Commit 7fff30f

Browse files
committed
format
1 parent a6e4fbe commit 7fff30f

File tree

10 files changed

+34
-29
lines changed

10 files changed

+34
-29
lines changed

mlir/lib/Catalyst/Transforms/DetectQNodes.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,13 @@ struct AddExceptionHandlingTransform : public OpRewritePattern<LLVM::CallOp> {
120120
* The reason behind this separation between the previous pattern and this one,
121121
* is that this pattern can potentially be reused as long as this single annotation is present.
122122
*/
123-
LogicalResult AddExceptionHandlingTransform::matchAndRewrite(LLVM::CallOp callOp, PatternRewriter &rewriter) const
123+
LogicalResult AddExceptionHandlingTransform::matchAndRewrite(LLVM::CallOp callOp,
124+
PatternRewriter &rewriter) const
124125
{
125126
// The following is a valid match
126127
// llvm.call @callee() { catalyst.preInvoke }
127128
bool validCandidate = AsyncUtils::isScheduledForTransformation(callOp);
128-
if (!validCandidate){
129+
if (!validCandidate) {
129130
return failure();
130131
}
131132

@@ -274,8 +275,9 @@ struct RemoveAbortAndPutsInsertCallTransform : public OpRewritePattern<LLVM::Cal
274275
// %results = call @async_execute_fn()
275276
//
276277
// These functions return async values or tokens.
277-
LogicalResult RemoveAbortAndPutsInsertCallTransform::matchAndRewrite(LLVM::CallOp callOp,
278-
PatternRewriter &rewriter) const
278+
LogicalResult
279+
RemoveAbortAndPutsInsertCallTransform::matchAndRewrite(LLVM::CallOp callOp,
280+
PatternRewriter &rewriter) const
279281
{
280282
auto maybeCallee = AsyncUtils::getCalleeSafe(callOp);
281283
if (!maybeCallee) {
@@ -289,7 +291,6 @@ LogicalResult RemoveAbortAndPutsInsertCallTransform::matchAndRewrite(LLVM::CallO
289291
return failure();
290292
}
291293

292-
293294
// Here, we are declaring an external function which is available in the Catalyst runtime.
294295
// llvm.func @__catalyst__host__rt__unrecoverable_error()
295296
auto moduleOp = callOp->getParentOfType<ModuleOp>();
@@ -446,11 +447,12 @@ struct LivenessAnalysisDropRef : public OpRewritePattern<LLVM::CallOp> {
446447
LogicalResult matchAndRewrite(LLVM::CallOp op, PatternRewriter &rewriter) const override;
447448
};
448449

449-
LogicalResult LivenessAnalysisDropRef::matchAndRewrite(LLVM::CallOp sink, PatternRewriter &rewriter) const
450+
LogicalResult LivenessAnalysisDropRef::matchAndRewrite(LLVM::CallOp sink,
451+
PatternRewriter &rewriter) const
450452
{
451453
// We match on function calls that have the sink attribute.
452454
// llvm.call @__catalyst__host__rt__unrecoverable_error() { catalyst.sink }
453-
if (!AsyncUtils::isSink(sink)){
455+
if (!AsyncUtils::isSink(sink)) {
454456
return failure();
455457
}
456458

mlir/lib/Catalyst/Transforms/InlineNestedModules.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -425,16 +425,14 @@ struct InlineNestedSymbolTablePass : PassWrapper<InlineNestedSymbolTablePass, Op
425425
renameFunctions.add<RenameFunctionsPattern>(context, &symbolTables);
426426

427427
bool run = _stopAfterStep >= 2 || _stopAfterStep == 0;
428-
if (run &&
429-
failed(applyPatternsGreedily(symbolTable, std::move(renameFunctions), config))) {
428+
if (run && failed(applyPatternsGreedily(symbolTable, std::move(renameFunctions), config))) {
430429
signalPassFailure();
431430
}
432431

433432
RewritePatternSet inlineNested(context);
434433
inlineNested.add<InlineNestedModule>(context);
435434
run = _stopAfterStep >= 3 || _stopAfterStep == 0;
436-
if (run &&
437-
failed(applyPatternsGreedily(symbolTable, std::move(inlineNested), config))) {
435+
if (run && failed(applyPatternsGreedily(symbolTable, std::move(inlineNested), config))) {
438436
signalPassFailure();
439437
}
440438

@@ -460,8 +458,7 @@ struct InlineNestedSymbolTablePass : PassWrapper<InlineNestedSymbolTablePass, Op
460458
nestedToFlat.add<NestedToFlatCallPattern, SymbolReplacerPattern, ZNEReplacerPattern>(
461459
context, &old_to_new);
462460
run = _stopAfterStep >= 4 || _stopAfterStep == 0;
463-
if (run &&
464-
failed(applyPatternsGreedily(symbolTable, std::move(nestedToFlat), config))) {
461+
if (run && failed(applyPatternsGreedily(symbolTable, std::move(nestedToFlat), config))) {
465462
signalPassFailure();
466463
}
467464

mlir/lib/Gradient/Transforms/ConversionPatterns.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ struct ForwardOpPattern : public ConvertOpToLLVMPattern<ForwardOp> {
826826
using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern;
827827

828828
LogicalResult matchAndRewrite(ForwardOp op, OpAdaptor adaptor,
829-
ConversionPatternRewriter &rewriter) const override
829+
ConversionPatternRewriter &rewriter) const override
830830
{
831831
// convert all arguments to pointers...
832832
auto typeConverter = getTypeConverter();
@@ -872,7 +872,7 @@ struct ReverseOpPattern : public ConvertOpToLLVMPattern<ReverseOp> {
872872
using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern;
873873

874874
LogicalResult matchAndRewrite(ReverseOp op, OpAdaptor adaptor,
875-
ConversionPatternRewriter &rewriter) const override
875+
ConversionPatternRewriter &rewriter) const override
876876
{
877877
auto argc = op.getArgc();
878878
auto resc = op.getResc();
@@ -996,7 +996,8 @@ struct ReverseOpPattern : public ConvertOpToLLVMPattern<ReverseOp> {
996996
struct ReturnOpPattern : public ConvertOpToLLVMPattern<ReturnOp> {
997997
using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern;
998998

999-
LogicalResult matchAndRewrite(ReturnOp op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const override
999+
LogicalResult matchAndRewrite(ReturnOp op, OpAdaptor adaptor,
1000+
ConversionPatternRewriter &rewriter) const override
10001001
{
10011002
auto loc = op.getLoc();
10021003
if (op.getEmpty()) {

mlir/lib/Gradient/Transforms/GradMethods/Adjoint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace gradient {
3030

3131
LogicalResult AdjointLowering::matchAndRewrite(func::FuncOp op, PatternRewriter &rewriter) const
3232
{
33-
if (!(getQNodeDiffMethod(op) == "adjoint" && requiresCustomGradient(op))){
33+
if (!(getQNodeDiffMethod(op) == "adjoint" && requiresCustomGradient(op))) {
3434
return failure();
3535
}
3636

mlir/lib/Gradient/Transforms/GradMethods/ParameterShift.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
namespace catalyst {
2424
namespace gradient {
2525

26-
LogicalResult ParameterShiftLowering::matchAndRewrite(func::FuncOp op, PatternRewriter &rewriter) const
26+
LogicalResult ParameterShiftLowering::matchAndRewrite(func::FuncOp op,
27+
PatternRewriter &rewriter) const
2728
{
2829
if (!(getQNodeDiffMethod(op) == "parameter-shift" && requiresCustomGradient(op))) {
2930
return failure();

mlir/lib/QEC/Transforms/CommuteCliffordPastPPM.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
#define DEBUG_TYPE "merge_ppr_ppm"
1616

17-
#include "llvm/Support/Casting.h"
18-
#include "llvm/Support/Debug.h"
1917
#include "mlir/Analysis/SliceAnalysis.h"
2018
#include "mlir/Analysis/TopologicalSortUtils.h"
19+
#include "llvm/Support/Casting.h"
20+
#include "llvm/Support/Debug.h"
2121

2222
#include "QEC/IR/QECDialect.h"
2323
#include "QEC/IR/QECOpInterfaces.h"

mlir/lib/QEC/Transforms/CommuteCliffordTPPR.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
#define DEBUG_TYPE "commute_ppr"
1616

17-
#include "llvm/Support/Debug.h"
1817
#include "mlir/Analysis/TopologicalSortUtils.h"
18+
#include "llvm/Support/Debug.h"
1919

2020
#include "QEC/IR/QECDialect.h"
2121
#include "QEC/IR/QECOpInterfaces.h"

mlir/lib/Quantum/Transforms/annotate_function.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ struct AnnotateFunctionPattern : public OpInterfaceRewritePattern<FunctionOpInte
8686
LogicalResult matchAndRewrite(FunctionOpInterface op, PatternRewriter &rewriter) const override;
8787
};
8888

89-
LogicalResult AnnotateFunctionPattern::matchAndRewrite(FunctionOpInterface op, PatternRewriter &rewriter) const
89+
LogicalResult AnnotateFunctionPattern::matchAndRewrite(FunctionOpInterface op,
90+
PatternRewriter &rewriter) const
9091
{
91-
if (!successfulMatchLeaf(op)){
92+
if (!successfulMatchLeaf(op)) {
9293
return failure();
9394
}
9495

@@ -161,9 +162,10 @@ struct PropagateAnnotationPattern : public OpInterfaceRewritePattern<FunctionOpI
161162
CallGraph &callgraph;
162163
};
163164

164-
LogicalResult PropagateAnnotationPattern::matchAndRewrite(FunctionOpInterface op, PatternRewriter &rewriter) const
165+
LogicalResult PropagateAnnotationPattern::matchAndRewrite(FunctionOpInterface op,
166+
PatternRewriter &rewriter) const
165167
{
166-
if (!successfulMatchNode(op, hasInvalidGradientOp, callgraph)){
168+
if (!successfulMatchNode(op, hasInvalidGradientOp, callgraph)) {
167169
return failure();
168170
}
169171

mlir/lib/Quantum/Transforms/cp_global_buffers.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,14 @@ struct CopyGlobalMemRefTransform : public OpRewritePattern<func::FuncOp> {
169169
LogicalResult matchAndRewrite(func::FuncOp op, PatternRewriter &rewriter) const override;
170170
};
171171

172-
LogicalResult CopyGlobalMemRefTransform::matchAndRewrite(func::FuncOp op, PatternRewriter &rewriter) const
172+
LogicalResult CopyGlobalMemRefTransform::matchAndRewrite(func::FuncOp op,
173+
PatternRewriter &rewriter) const
173174
{
174175
bool isCandidate = hasCWrapperButNoCopyWrapperAttribute(op);
175176
if (!isCandidate) {
176177
return failure();
177178
}
178-
if (!hasMemRefReturnTypes(op)){
179+
if (!hasMemRefReturnTypes(op)) {
179180
return failure();
180181
}
181182

mlir/lib/Quantum/Transforms/emit_catalyst_pyface.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,10 @@ struct EmitCatalystPyInterfaceTransform : public OpRewritePattern<LLVM::LLVMFunc
176176
LogicalResult matchAndRewrite(LLVM::LLVMFuncOp op, PatternRewriter &rewriter) const override;
177177
};
178178

179-
LogicalResult EmitCatalystPyInterfaceTransform::matchAndRewrite(LLVM::LLVMFuncOp op, PatternRewriter &rewriter) const
179+
LogicalResult EmitCatalystPyInterfaceTransform::matchAndRewrite(LLVM::LLVMFuncOp op,
180+
PatternRewriter &rewriter) const
180181
{
181-
if (!isFunctionMLIRCWrapper(op)){
182+
if (!isFunctionMLIRCWrapper(op)) {
182183
return failure();
183184
}
184185

0 commit comments

Comments
 (0)