Skip to content

Commit

Permalink
Changing compiler namespaces to the new single-line syntax. (#15827)
Browse files Browse the repository at this point in the history
Some files already do this and now all do for consistency.
  • Loading branch information
benvanik authored Dec 7, 2023
1 parent 324bc6d commit e5f95c2
Show file tree
Hide file tree
Showing 733 changed files with 1,663 additions and 4,407 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@

#include "stablehlo-iree/Conversion/Passes.h"

namespace mlir {
namespace iree_compiler {
namespace stablehlo {
namespace mlir::iree_compiler::stablehlo {

namespace {

Expand Down Expand Up @@ -158,9 +156,7 @@ struct StableHLOSession

} // namespace

} // namespace stablehlo
} // namespace iree_compiler
} // namespace mlir
} // namespace mlir::iree_compiler::stablehlo

IREE_DEFINE_COMPILER_OPTION_FLAGS(
::mlir::iree_compiler::stablehlo::StableHLOOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

using namespace mlir;

namespace mlir {
namespace iree_compiler {
namespace mlir::iree_compiler {

class Converti48Toi64Pass : public Converti48Toi64Base<Converti48Toi64Pass> {
public:
Expand Down Expand Up @@ -184,5 +183,4 @@ std::unique_ptr<OperationPass<func::FuncOp>> createConverti48Toi64() {
return std::make_unique<Converti48Toi64Pass>();
}

} // namespace iree_compiler
} // namespace mlir
} // namespace mlir::iree_compiler
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
#include "mlir/IR/BuiltinOps.h"
#include "mlir/Pass/Pass.h"

namespace mlir {
namespace iree_compiler {
namespace mlir::iree_compiler {

#define GEN_PASS_CLASSES
#include "tosa-iree/InputConversion/Passes.h.inc"

} // namespace iree_compiler
} // namespace mlir
} // namespace mlir::iree_compiler

#endif // TOSA_IREE_INPUTCONVERSION_PASSDETAIL_H_
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
#include "mlir/Pass/PassRegistry.h"
#include "mlir/Transforms/Passes.h"

namespace mlir {
namespace iree_compiler {
namespace mlir::iree_compiler {

void registerTOSAConversionPassPipeline() {
PassPipelineRegistration<> tosa(
Expand Down Expand Up @@ -89,5 +88,4 @@ void registerTOSAConversionPasses() {
registerTOSAConversionPassPipeline();
}

} // namespace iree_compiler
} // namespace mlir
} // namespace mlir::iree_compiler
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
#include "mlir/IR/BuiltinOps.h"
#include "mlir/Pass/Pass.h"

namespace mlir {
namespace iree_compiler {
namespace mlir::iree_compiler {

//===----------------------------------------------------------------------===//
// Pipelines
Expand Down Expand Up @@ -51,7 +50,6 @@ createVerifyCompilerTOSAInputLegality();

void registerTOSAConversionPasses();

} // namespace iree_compiler
} // namespace mlir
} // namespace mlir::iree_compiler

#endif // TOSA_IREE_INPUTCONVERSION_PASSES_H_
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#include "tosa-iree/InputConversion/PassDetail.h"
#include "tosa-iree/InputConversion/Passes.h"

namespace mlir {
namespace iree_compiler {
namespace mlir::iree_compiler {

namespace {

Expand Down Expand Up @@ -131,5 +130,4 @@ createStripSignednessPass() {
return std::make_unique<StripSignednessPass>();
}

} // namespace iree_compiler
} // namespace mlir
} // namespace mlir::iree_compiler
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
using namespace mlir;
using namespace mlir::tosa;

namespace mlir {
namespace iree_compiler {
namespace mlir::iree_compiler {

// Converts tosa.scatter to the iree_linalg_ext.scatter operation. As the
// LinalgExt version is not batched therefore we materialize the batch index
Expand Down Expand Up @@ -174,5 +173,4 @@ std::unique_ptr<OperationPass<func::FuncOp>> createTosaToLinalgExt() {
return std::make_unique<TosaToLinalgExtPass>();
}

} // namespace iree_compiler
} // namespace mlir
} // namespace mlir::iree_compiler
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
#include "tosa-iree/InputConversion/PassDetail.h"
#include "tosa-iree/InputConversion/Passes.h"

namespace mlir {
namespace iree_compiler {
namespace mlir::iree_compiler {

struct VerifyCompilerTOSAInputLegalityPass
: public VerifyCompilerTOSAInputLegalityBase<
Expand Down Expand Up @@ -69,5 +68,4 @@ createVerifyCompilerTOSAInputLegality() {
return std::make_unique<VerifyCompilerTOSAInputLegalityPass>();
}

} // namespace iree_compiler
} // namespace mlir
} // namespace mlir::iree_compiler
6 changes: 2 additions & 4 deletions compiler/plugins/input/TOSA/tosa-iree/PluginRegistration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@

#include "tosa-iree/InputConversion/Passes.h"

namespace mlir {
namespace iree_compiler {
namespace mlir::iree_compiler {

namespace {

Expand Down Expand Up @@ -70,8 +69,7 @@ struct TOSASession

} // namespace

} // namespace iree_compiler
} // namespace mlir
} // namespace mlir::iree_compiler

extern "C" bool iree_register_compiler_plugin_input_tosa(
mlir::iree_compiler::PluginRegistrar *registrar) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
#include "torch-mlir/Dialect/TorchConversion/IR/TorchConversionOps.h"
#include "torch-mlir/Dialect/TorchConversion/Transforms/Passes.h"

namespace mlir {
namespace iree_compiler {
namespace TorchInput {
namespace mlir::iree_compiler::TorchInput {

namespace {

Expand Down Expand Up @@ -132,6 +130,4 @@ std::unique_ptr<OperationPass<func::FuncOp>> createBitCastQuantTensorPass() {
return std::make_unique<BitCastQuantTensorPass>();
}

} // namespace TorchInput
} // namespace iree_compiler
} // namespace mlir
} // namespace mlir::iree_compiler::TorchInput
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
#include "torch-iree/InputConversion/Passes.h"
#include "torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOps.h"

namespace mlir {
namespace iree_compiler {
namespace TorchInput {
namespace mlir::iree_compiler::TorchInput {

namespace {

Expand Down Expand Up @@ -205,6 +203,4 @@ createConvertTMTensorToLinalgExtPass() {
return std::make_unique<ConvertTMTensorToLinalgExtPass>();
}

} // namespace TorchInput
} // namespace iree_compiler
} // namespace mlir
} // namespace mlir::iree_compiler::TorchInput
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,11 @@
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Pass/Pass.h"

namespace mlir {
namespace iree_compiler {
namespace TorchInput {
namespace mlir::iree_compiler::TorchInput {

#define GEN_PASS_CLASSES
#include "torch-iree/InputConversion/Passes.h.inc"

} // namespace TorchInput
} // namespace iree_compiler
} // namespace mlir
} // namespace mlir::iree_compiler::TorchInput

#endif // TORCH_IREE_INPUTCONVERSION_PASSDETAIL_H_
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
#include "torch-mlir/Dialect/Torch/Transforms/Passes.h"
#include "torch-mlir/Dialect/TorchConversion/Transforms/Passes.h"

namespace mlir {
namespace iree_compiler {
namespace TorchInput {
namespace mlir::iree_compiler::TorchInput {

namespace {
#define GEN_PASS_REGISTRATION
Expand Down Expand Up @@ -84,6 +82,4 @@ void registerTMTensorConversionPasses() {
createTorchToIREEPipeline);
}

} // namespace TorchInput
} // namespace iree_compiler
} // namespace mlir
} // namespace mlir::iree_compiler::TorchInput
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Pass/Pass.h"

namespace mlir {
namespace iree_compiler {
namespace TorchInput {
namespace mlir::iree_compiler::TorchInput {

struct TorchToIREELoweringPipelineOptions
: public PassPipelineOptions<TorchToIREELoweringPipelineOptions> {
Expand Down Expand Up @@ -41,8 +39,6 @@ void createTorchToIREEPipeline(

void registerTMTensorConversionPasses();

} // namespace TorchInput
} // namespace iree_compiler
} // namespace mlir
} // namespace mlir::iree_compiler::TorchInput

#endif // TORCH_IREE_INPUTCONVERSION_PASSES_H_
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
static const llvm::StringLiteral kStrictSymbolsMarker =
"torch.assume_strict_symbolic_shapes";

namespace mlir {
namespace iree_compiler {
namespace TorchInput {
namespace mlir::iree_compiler::TorchInput {

namespace {
struct SetStrictSymbolicShapesPass
Expand All @@ -38,6 +36,4 @@ createSetStrictSymbolicShapesPass() {
return std::make_unique<SetStrictSymbolicShapesPass>();
}

} // namespace TorchInput
} // namespace iree_compiler
} // namespace mlir
} // namespace mlir::iree_compiler::TorchInput
11 changes: 3 additions & 8 deletions compiler/plugins/target/CUDA/CUDATarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@
#include "mlir/Target/LLVMIR/Dialect/NVVM/NVVMToLLVMIRTranslation.h"
#include "mlir/Target/LLVMIR/Export.h"

namespace mlir {
namespace iree_compiler {
namespace IREE {
namespace HAL {
namespace mlir::iree_compiler::IREE::HAL {

namespace {
struct CUDAOptions {
Expand Down Expand Up @@ -709,12 +706,10 @@ struct CUDASession
});
}
};

} // namespace

} // namespace HAL
} // namespace IREE
} // namespace iree_compiler
} // namespace mlir
} // namespace mlir::iree_compiler::IREE::HAL

extern "C" bool iree_register_compiler_plugin_hal_target_cuda(
mlir::iree_compiler::PluginRegistrar *registrar) {
Expand Down
10 changes: 2 additions & 8 deletions compiler/plugins/target/MetalSPIRV/MSLToMetalLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@

#define DEBUG_TYPE "iree-msl-to-metal-lib"

namespace mlir {
namespace iree_compiler {
namespace IREE {
namespace HAL {
namespace mlir::iree_compiler::IREE::HAL {

/// Returns the command to compile the given MSL source file into Metal library.
static std::string getMetalCompileCommand(MetalTargetPlatform platform,
Expand Down Expand Up @@ -95,7 +92,4 @@ compileMSLToMetalLib(MetalTargetPlatform targetPlatform, StringRef mslCode,
return std::move(*fileOrErr);
}

} // namespace HAL
} // namespace IREE
} // namespace iree_compiler
} // namespace mlir
} // namespace mlir::iree_compiler::IREE::HAL
10 changes: 2 additions & 8 deletions compiler/plugins/target/MetalSPIRV/MSLToMetalLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/MemoryBuffer.h"

namespace mlir {
namespace iree_compiler {
namespace IREE {
namespace HAL {
namespace mlir::iree_compiler::IREE::HAL {

// Invokes system commands to compile the given |mslCode| into a Metal library
// and returns the library binary code. |fileName| will be used as a hint for
Expand All @@ -23,9 +20,6 @@ std::unique_ptr<llvm::MemoryBuffer>
compileMSLToMetalLib(MetalTargetPlatform targetPlatform,
llvm::StringRef mslCode, llvm::StringRef fileName);

} // namespace HAL
} // namespace IREE
} // namespace iree_compiler
} // namespace mlir
} // namespace mlir::iree_compiler::IREE::HAL

#endif // IREE_COMPILER_DIALECT_HAL_TARGET_METALSPIRV_MSLTOMETALLIB_H_
10 changes: 2 additions & 8 deletions compiler/plugins/target/MetalSPIRV/MetalSPIRVTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/Target/SPIRV/Serialization.h"

namespace mlir {
namespace iree_compiler {
namespace IREE {
namespace HAL {
namespace mlir::iree_compiler::IREE::HAL {

namespace {
struct MetalSPIRVOptions {
Expand Down Expand Up @@ -328,10 +325,7 @@ struct MetalSPIRVSession
}
};

} // namespace HAL
} // namespace IREE
} // namespace iree_compiler
} // namespace mlir
} // namespace mlir::iree_compiler::IREE::HAL

extern "C" bool iree_register_compiler_plugin_hal_target_metal_spirv(
mlir::iree_compiler::PluginRegistrar *registrar) {
Expand Down
10 changes: 2 additions & 8 deletions compiler/plugins/target/MetalSPIRV/MetalSPIRVTarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,11 @@

#include <functional>

namespace mlir {
namespace iree_compiler {
namespace IREE {
namespace HAL {
namespace mlir::iree_compiler::IREE::HAL {

// Registers the Metal/SPIR-V backends.
void registerMetalSPIRVTargetBackends();

} // namespace HAL
} // namespace IREE
} // namespace iree_compiler
} // namespace mlir
} // namespace mlir::iree_compiler::IREE::HAL

#endif // IREE_COMPILER_DIALECT_HAL_TARGET_METALSPIRV_METALSPIRVTARGET_H_
Loading

0 comments on commit e5f95c2

Please sign in to comment.