Skip to content

Commit 53992f2

Browse files
hamptonm1MegoHam21
andauthored
Remove Pragma Once (#2890)
* Remove Pragma Once * Fix linter * Still fixing the format * Remove duplicate header * Fix duplicate header name * More fixes * Address comments --------- Co-authored-by: Megan Hampton <[email protected]>
1 parent 226a0d6 commit 53992f2

File tree

108 files changed

+408
-189
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+408
-189
lines changed

src/Accelerators/Accelerator.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44

55
//===-------------------------- Accelerator.hpp ---------------------------===//
66
//
7-
// Copyright 2022 The IBM Research Authors.
7+
// Copyright 2022-2024 The IBM Research Authors.
88
//
99
// =============================================================================
1010
//
1111
// Accelerator base class
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#pragma once
15+
#ifndef ONNX_MLIR_ACCELERATOR_H
16+
#define ONNX_MLIR_ACCELERATOR_H
1617

1718
#include "mlir/Conversion/LLVMCommon/TypeConverter.h"
1819
#include "mlir/IR/BuiltinOps.h"
@@ -164,3 +165,4 @@ extern void initAccelerators(llvm::ArrayRef<Accelerator::Kind> kinds);
164165

165166
} // namespace accel
166167
} // namespace onnx_mlir
168+
#endif

src/Accelerators/NNPA/Compiler/NNPACompilerOptions.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44

55
//===------------------------ NNPACompilerOptions.hpp ---------------------===//
66
//
7-
// Copyright 2022 The IBM Research Authors.
7+
// Copyright 2022-2024 The IBM Research Authors.
88
//
99
// =============================================================================
1010
//
1111
//
1212
//===----------------------------------------------------------------------===//
1313

14-
#pragma once
14+
#ifndef ONNX_MLIR_NNPA_COMPILER_OPTIONS_H
15+
#define ONNX_MLIR_NNPA_COMPILER_OPTIONS_H
1516

1617
#include "llvm/Support/CommandLine.h"
1718

@@ -69,3 +70,4 @@ extern llvm::cl::opt<std::string> nnpaSaveDevicePlacementFile;
6970
extern llvm::cl::opt<bool> nnpaEnableSaturation;
7071

7172
} // namespace onnx_mlir
73+
#endif

src/Accelerators/NNPA/Compiler/NNPACompilerUtils.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44

55
//===------------------------- NNPACompilerUtils.hpp ----------------------===//
66
//
7-
// Copyright 2022 The IBM Research Authors.
7+
// Copyright 2022-2024 The IBM Research Authors.
88
//
99
// =============================================================================
1010
//
1111
//
1212
//===----------------------------------------------------------------------===//
1313

14-
#pragma once
14+
#ifndef ONNX_MLIR_NNPA_COMPILER_UTILS_H
15+
#define ONNX_MLIR_NNPA_COMPILER_UTILS_H
1516

1617
#include "mlir/IR/BuiltinOps.h"
1718
#include "mlir/Pass/PassManager.h"
@@ -37,3 +38,4 @@ void addPassesNNPA(mlir::OwningOpRef<mlir::ModuleOp> &module,
3738
void configurePassesNNPA();
3839

3940
} // namespace onnx_mlir
41+
#endif

src/Accelerators/NNPA/Conversion/ONNXToZHigh/DevicePlacementHeuristic.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44

55
//===-------- DevicePlacementHeuristic.hpp - Place ops using model -------===//
66
//
7-
// Copyright 2023 The IBM Research Authors.
7+
// Copyright 2023-2024 The IBM Research Authors.
88
//
99
// =============================================================================
1010
//
1111
// This file contains heuristics to place operations on CPU or NNPA.
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#pragma once
15+
#ifndef ONNX_MLIR_HEURISTICS_H
16+
#define ONNX_MLIR_HEURISTICS_H
1617

1718
#include "mlir/IR/BuiltinOps.h"
1819

@@ -85,3 +86,4 @@ void PlaceBeneficialOpsOnNNPAWithStickUnstick(mlir::MLIRContext *context,
8586
double significantNNPAFactor = 3.0);
8687

8788
} // namespace onnx_mlir
89+
#endif

src/Accelerators/NNPA/Conversion/ONNXToZHigh/ONNXLegalityCheck.hpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
//===---------- ONNXLegalityCheck.hpp - Check legality for ONNX ops -------===//
66
//
7-
// Copyright 2019-2023 The IBM Research Authors.
7+
// Copyright 2019-2024 The IBM Research Authors.
88
//
99
// =============================================================================
1010
//
@@ -14,7 +14,8 @@
1414
//
1515
//===----------------------------------------------------------------------===//
1616

17-
#pragma once
17+
#ifndef ONNX_MLIR_LEGALITY_H
18+
#define ONNX_MLIR_LEGALITY_H
1819

1920
#include "src/Conversion/ONNXToKrnl/ONNXToKrnlCommon.hpp"
2021
#include "src/Dialect/ONNX/ONNXDimAnalysis.hpp"
@@ -53,3 +54,5 @@ bool onnxToZHighUnsupportedReport(
5354

5455
bool onnxToZHighInCompatibilityReport(
5556
mlir::Operation *op, std::string inputNNPALevel);
57+
58+
#endif

src/Accelerators/NNPA/Conversion/ONNXToZHigh/ONNXToZHigh.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
//====------ ONNXToZHigh.hpp - ONNX dialect to ZHigh lowering -------------===//
66
//
7-
// Copyright 2019-2022 The IBM Research Authors.
7+
// Copyright 2019-2024 The IBM Research Authors.
88
//
99
// =============================================================================
1010
//
@@ -13,7 +13,8 @@
1313
//
1414
//===----------------------------------------------------------------------===//
1515

16-
#pragma once
16+
#ifndef ONNX_MLIR_ONNX_TO_ZHIGH_H
17+
#define ONNX_MLIR_ONNX_TO_ZHIGH_H
1718

1819
#include "mlir/IR/PatternMatch.h"
1920
#include "mlir/Transforms/DialectConversion.h"
@@ -30,3 +31,4 @@ void getONNXToZHighOneOpDynamicallyLegal(
3031
mlir::ConversionTarget *target, const DimAnalysis *dimAnalysis);
3132

3233
} // namespace onnx_mlir
34+
#endif

src/Accelerators/NNPA/Conversion/ONNXToZHigh/ONNXToZHighCommon.hpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
* SPDX-License-Identifier: Apache-2.0
33
*/
44

5-
//===---------- ONNXToZHigh.hpp - Common functions in ONNXToZHigh ---------===//
5+
//===---------- ONNXToZHighCommon.hpp - Common functions in ONNXToZHigh
6+
//---------===//
67
//
78
// Copyright 2019-2024 The IBM Research Authors.
89
//
@@ -12,7 +13,8 @@
1213
//
1314
//===----------------------------------------------------------------------===//
1415

15-
#pragma once
16+
#ifndef ONNX_MLIR_ZHIGH_COMMON_H
17+
#define ONNX_MLIR_ZHIGH_COMMON_H
1618

1719
#include "llvm/ADT/STLExtras.h"
1820

@@ -115,3 +117,4 @@ mlir::Value getDynShape(
115117
mlir::Location loc, mlir::PatternRewriter &rewriter, mlir::Value x);
116118

117119
} // namespace onnx_mlir
120+
#endif

src/Accelerators/NNPA/Conversion/ONNXToZHigh/PerfModel.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
//===-------- PerfModel.hpp - Estimate if CPU or NNPA is faster ----------===//
66
//
7-
// Copyright 2023 The IBM Research Authors.
7+
// Copyright 2023-2024 The IBM Research Authors.
88
//
99
// =============================================================================
1010
//
@@ -13,7 +13,8 @@
1313
//
1414
//===----------------------------------------------------------------------===//
1515

16-
#pragma once
16+
#ifndef ONNX_MLIR_PERF_H
17+
#define ONNX_MLIR_PERF_H
1718

1819
#include "mlir/IR/BuiltinOps.h"
1920

@@ -32,3 +33,4 @@ double estimateTimeForStickOp(mlir::Value oper);
3233
double estimateTimeForUnstickOp(mlir::Value oper);
3334

3435
} // namespace onnx_mlir
36+
#endif

src/Accelerators/NNPA/Conversion/ONNXToZHigh/RewriteONNXForZHigh.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44

55
//===--- RewriteONNXForZHigh.hpp - Rewrite ONNX ops for ZHigh lowering ----===//
66
//
7-
// Copyright 2019-2023 The IBM Research Authors.
7+
// Copyright 2019-2024 The IBM Research Authors.
88
//
99
// =============================================================================
1010
//
1111
// This file implements pass for rewriting of ONNX operations to generate
1212
// combination of ONNX and ZHigh operations.
1313

14-
#pragma once
14+
#ifndef ONNX_MLIR_REWRITE_ZHIGH_H
15+
#define ONNX_MLIR_REWRITE_ZHIGH_H
1516

1617
#include "mlir/IR/PatternMatch.h"
1718
#include "mlir/Transforms/DialectConversion.h"
@@ -28,3 +29,4 @@ void getRewriteONNXForZHighDynamicallyLegal(
2829
mlir::ConversionTarget *target, const DimAnalysis *dimAnalysis);
2930

3031
} // namespace onnx_mlir
32+
#endif

src/Accelerators/NNPA/Conversion/ZHighToZLow/ZHighToZLow.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44

55
//====------ ZHighToZLow.hpp - ZHigh dialect to ZLow lowering -------------===//
66
//
7-
// Copyright 2019-2021 The IBM Research Authors.
7+
// Copyright 2019-2024 The IBM Research Authors.
88
//
99
// =============================================================================
1010
//
1111
// This file implements the lowering of ZHigh operations to ZLow operations.
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#pragma once
15+
#ifndef ONNX_MLIR_ZHIGH_TO_ZLOW_H
16+
#define ONNX_MLIR_ZHIGH_TO_ZLOW_H
1617

1718
#include "mlir/IR/BuiltinAttributes.h"
1819
#include "mlir/IR/BuiltinTypes.h"
@@ -57,3 +58,4 @@ void populateZHighToZLowConversionPattern(mlir::RewritePatternSet &patterns,
5758

5859
} // namespace zhigh
5960
} // namespace onnx_mlir
61+
#endif

src/Accelerators/NNPA/Conversion/ZLowToLLVM/ZLowToLLVM.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44

55
//===---------- ZLowToLLVM.hpp - Lowering from ZLow to LLVM ---------------===//
66
//
7-
// Copyright 2019-2022 The IBM Research Authors.
7+
// Copyright 2019-2024 The IBM Research Authors.
88
//
99
// =============================================================================
1010
//
1111
//
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#pragma once
15+
#ifndef ONNX_MLIR_ZLOW_TO_LLVM_H
16+
#define ONNX_MLIR_ZLOW_TO_LLVM_H
1617

1718
#include "mlir/Conversion/LLVMCommon/TypeConverter.h"
1819
#include "mlir/IR/PatternMatch.h"
@@ -27,3 +28,4 @@ void populateZLowToLLVMConversionPattern(mlir::RewritePatternSet &patterns,
2728

2829
} // namespace zlow
2930
} // namespace onnx_mlir
31+
#endif

src/Accelerators/NNPA/Conversion/ZLowToLLVM/ZLowToLLVMCommon.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44

55
//===---------- ZLowToLLVMCommon.hpp - Lowering from ZLow to LLVM ---------===//
66
//
7-
// Copyright 2019-2020 The IBM Research Authors.
7+
// Copyright 2019-2024 The IBM Research Authors.
88
//
99
// =============================================================================
1010
//
1111
// This file contains common methods used in lowering ZLow to LLVM
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#pragma once
15+
#ifndef ONNX_MLIR_ZLOW_TO_LLVM_COMMON_H
16+
#define ONNX_MLIR_ZLOW_TO_LLVM_COMMON_H
1617

1718
#include "mlir/Dialect/Func/IR/FuncOps.h"
1819
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
@@ -200,3 +201,4 @@ void fillInZTensor(mlir::PatternRewriter &rewriter, mlir::Location loc,
200201

201202
} // namespace zlow
202203
} // namespace onnx_mlir
204+
#endif

src/Accelerators/NNPA/Dialect/ZHigh/ZHighOps.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44

55
//===------------------ ZHighOps.hpp - ZHigh Operations -------------------===//
66
//
7-
// Copyright 2019-2022 The IBM Research Authors.
7+
// Copyright 2019-2024 The IBM Research Authors.
88
//
99
// =============================================================================
1010
//
1111
// This file defines the ZHigh operations in the MLIR operation set.
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#pragma once
15+
#ifndef ONNX_MLIR_ZHIGH_H
16+
#define ONNX_MLIR_ZHIGH_H
1617

1718
#include <map>
1819
#include <string>
@@ -58,3 +59,4 @@ class SameOperandsAndResultLayout
5859

5960
#define GET_OP_CLASSES
6061
#include "src/Accelerators/NNPA/Dialect/ZHigh/ZHighOps.hpp.inc"
62+
#endif

src/Accelerators/NNPA/Dialect/ZHigh/ZHighOps/OpHelper.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44

55
//===-------- ZHighHelper.hpp - ZHigh Helper Functions --------------------===//
66
//
7-
// Copyright 2019-2022 The IBM Research Authors.
7+
// Copyright 2019-2024 The IBM Research Authors.
88
//
99
// =============================================================================
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#pragma once
13+
#ifndef ONNX_MLIR_OP_HELPER_H
14+
#define ONNX_MLIR_OP_HELPER_H
1415

1516
#include "mlir/IR/Builders.h"
1617
#include "mlir/IR/BuiltinAttributes.h"
@@ -89,3 +90,4 @@ mlir::IntegerAttr getDefaultSaturation(mlir::PatternRewriter &rewriter);
8990

9091
} // namespace zhigh
9192
} // namespace onnx_mlir
93+
#endif

src/Accelerators/NNPA/Dialect/ZHigh/ZHighOps/ShapeHelper.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
//===----------------ShapeHelper.hpp - shape helpers for ZHigh ------------===//
66
//
7-
// Copyright 2019-2022 The IBM Research Authors.
7+
// Copyright 2019-2024 The IBM Research Authors.
88
//
99
// =============================================================================
1010
//
@@ -13,7 +13,8 @@
1313
//
1414
//===----------------------------------------------------------------------===//
1515

16-
#pragma once
16+
#ifndef ONNX_MLIR_ZHIGH_SHAPE_HELPER_H
17+
#define ONNX_MLIR_ZHIGH_SHAPE_HELPER_H
1718

1819
#include "mlir/IR/Builders.h"
1920
#include "mlir/IR/BuiltinTypes.h"
@@ -174,3 +175,4 @@ using ZHighFixGRUYOpShapeHelper = ONNXUnaryOpShapeHelper;
174175

175176
} // namespace zhigh
176177
} // namespace onnx_mlir
178+
#endif

src/Accelerators/NNPA/Dialect/ZLow/DialectBuilder.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44

55
//====--------- DialectBuilder.hpp - ZLow Dialect Builder -----------------===//
66
//
7-
// Copyright 2022-2023 The IBM Research Authors.
7+
// Copyright 2022-2024 The IBM Research Authors.
88
//
99
// =============================================================================
1010
//
1111
// This file declares the ZLow Dialect Builder.
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#pragma once
15+
#ifndef ONNX_MLIR_DIALECT_BUILDER_H
16+
#define ONNX_MLIR_DIALECT_BUILDER_H
1617

1718
#include "src/Dialect/Mlir/DialectBuilder.hpp"
1819
#include "src/Dialect/Mlir/IndexExprBuilder.hpp"
@@ -53,3 +54,4 @@ struct MultiDialectBuilder<IndexExprBuilderForZLow, Ts...>
5354
};
5455

5556
} // namespace onnx_mlir
57+
#endif

0 commit comments

Comments
 (0)