Skip to content

Commit 317e483

Browse files
authored
[AMD] NFC: Cleanup namespace hierachy (#5246)
Refactored namespace hierarchy by squeezing separate namespace hierarchy together.
1 parent e2dc77b commit 317e483

File tree

10 files changed

+32
-44
lines changed

10 files changed

+32
-44
lines changed

third_party/amd/include/Dialect/TritonAMDGPU/IR/Dialect.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,4 @@
4141
#define GET_OP_CLASSES
4242
#include "amd/include/Dialect/TritonAMDGPU/IR/Ops.h.inc"
4343

44-
namespace mlir {
45-
namespace triton {
46-
namespace amdgpu {} // namespace amdgpu
47-
} // namespace triton
48-
} // namespace mlir
49-
5044
#endif // TRITON_THIRD_PARTY_AMD_INCLUDE_DIALECT_TRITONAMDGPU_IR_DIALECT_H_

third_party/amd/include/TritonAMDGPUToLLVM/GCNAsmFormat.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@
3131
#include <string>
3232

3333
namespace mlir {
34+
3435
class ConversionPatternRewriter;
3536
class Location;
3637

37-
namespace triton {
38+
} // namespace mlir
39+
40+
namespace mlir::triton {
3841
using llvm::StringRef;
3942

4043
class GCNInstr;
@@ -397,7 +400,6 @@ struct GCNMemInstr : public GCNInstrBase<GCNMemInstr> {
397400
}
398401
};
399402

400-
} // namespace triton
401-
} // namespace mlir
403+
} // namespace mlir::triton
402404

403405
#endif // TRITON_THIRD_PARTY_AMD_INCLUDE_TRITONAMDGPUTOLLVM_GCNASMFORMAT_H_

third_party/amd/include/TritonAMDGPUToLLVM/Passes.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,16 @@ namespace mlir {
1313
class ModuleOp;
1414
template <typename T> class OperationPass;
1515

16-
namespace triton {
16+
} // namespace mlir
17+
18+
namespace mlir::triton {
1719

1820
#define GEN_PASS_DECL
1921
#include "TritonAMDGPUToLLVM/Passes.h.inc"
2022

21-
namespace AMD {
23+
} // namespace mlir::triton
24+
25+
namespace mlir::triton::AMD {
2226
std::unique_ptr<OperationPass<ModuleOp>>
2327
createDecomposeUnsupportedConversionsPass(StringRef targetArch);
2428

@@ -29,7 +33,9 @@ createDecomposeUnsupportedConversionsPass(StringRef targetArch);
2933
/// @return created pass
3034
std::unique_ptr<OperationPass<ModuleOp>>
3135
createOptimizeLDSUsagePass(StringRef arch, int32_t customLDSLimit = 0);
32-
} // namespace AMD
36+
} // namespace mlir::triton::AMD
37+
38+
namespace mlir::triton {
3339

3440
std::unique_ptr<OperationPass<ModuleOp>>
3541
createConvertTritonAMDGPUToLLVMPass(StringRef targetArch, bool ftz);
@@ -45,8 +51,6 @@ createTritonAMDGPULowerInstructionSchedHintsPass(StringRef arch,
4551
#define GEN_PASS_REGISTRATION
4652
#include "TritonAMDGPUToLLVM/Passes.h.inc"
4753

48-
} // namespace triton
49-
50-
} // namespace mlir
54+
} // namespace mlir::triton
5155

5256
#endif // TRITON_THIRD_PARTY_AMD_INCLUDE_TRITONAMDGPUTOLLVM_PASSES_H_

third_party/amd/include/TritonAMDGPUToLLVM/PatternTritonAMDGPUToLLVM.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ void populateExtractSliceOpToLLVMPatterns(
99
mlir::LLVMTypeConverter &typeConverter, mlir::RewritePatternSet &patterns,
1010
mlir::PatternBenefit benefit);
1111

12-
}
12+
} // namespace mlir::triton::AMD
1313

1414
#endif // TRITON_THIRD_PARTY_AMD_INCLUDE_TRITONAMDGPUTOLLVM_PATTERNTRITONAMDGPUTOLLVM_H_

third_party/amd/lib/TritonAMDGPUToLLVM/BuiltinFuncToLLVM.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
77
#include "triton/Conversion/TritonGPUToLLVM/Utility.h"
88

9-
namespace mlir {
10-
namespace triton {
9+
namespace mlir::triton {
1110
#define GEN_PASS_DEF_CONVERTBUILTINFUNCTOLLVM
1211
#include "TritonAMDGPUToLLVM/Passes.h.inc"
13-
} // namespace triton
14-
} // namespace mlir
12+
} // namespace mlir::triton
1513

1614
using namespace mlir;
1715

@@ -242,15 +240,13 @@ struct ConvertBuiltinFuncToLLVM
242240
}
243241
};
244242

245-
} // anonymous namespace
243+
} // namespace
246244

247-
namespace mlir {
248-
namespace triton {
245+
namespace mlir::triton {
249246

250247
std::unique_ptr<OperationPass<ModuleOp>>
251248
createConvertBuiltinFuncToLLVMPass(bool ftz) {
252249
return std::make_unique<ConvertBuiltinFuncToLLVM>(ftz);
253250
}
254251

255-
} // namespace triton
256-
} // namespace mlir
252+
} // namespace mlir::triton

third_party/amd/lib/TritonAMDGPUToLLVM/DecomposeUnsupportedConversions.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@
1111
#include <numeric>
1212

1313
using namespace mlir;
14-
namespace mlir {
15-
namespace triton {
14+
namespace mlir::triton {
1615
#define GEN_PASS_DEF_DECOMPOSEUNSUPPORTEDAMDCONVERSIONS
1716
#include "TritonAMDGPUToLLVM/Passes.h.inc"
18-
} // namespace triton
19-
} // namespace mlir
17+
} // namespace mlir::triton
2018

2119
namespace {
2220

third_party/amd/lib/TritonAMDGPUToLLVM/GCNAsmFormat.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
#include "llvm/Support/raw_ostream.h"
66
#include <sstream> // unify to llvm::raw_string_ostream ?
77

8-
namespace mlir {
9-
namespace triton {
8+
namespace mlir::triton {
109

1110
GCNInstr::Operand *
1211
GCNBuilder::newOperand(mlir::Value value, StringRef constraint,
@@ -187,5 +186,4 @@ GCNInstrExecution::getArgList() const {
187186
return args;
188187
}
189188

190-
} // namespace triton
191-
} // namespace mlir
189+
} // namespace mlir::triton

third_party/amd/lib/TritonAMDGPUToLLVM/TritonGPUToLLVM.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@
2424
#include "triton/Dialect/TritonGPU/IR/Dialect.h"
2525
#include "triton/Dialect/TritonNvidiaGPU/IR/Dialect.h"
2626

27-
namespace mlir {
28-
namespace triton {
27+
namespace mlir::triton {
2928
#define GEN_PASS_DEF_CONVERTTRITONAMDGPUTOLLVM
3029
#include "TritonAMDGPUToLLVM/Passes.h.inc"
31-
} // namespace triton
32-
} // namespace mlir
30+
} // namespace mlir::triton
3331

3432
using namespace mlir;
3533

@@ -256,15 +254,13 @@ struct ConvertTritonAMDGPUToLLVM
256254
}
257255
};
258256

259-
} // anonymous namespace
257+
} // namespace
260258

261-
namespace mlir {
262-
namespace triton {
259+
namespace mlir::triton {
263260

264261
std::unique_ptr<OperationPass<ModuleOp>>
265262
createConvertTritonAMDGPUToLLVMPass(StringRef targetArch, bool ftz) {
266263
return std::make_unique<ConvertTritonAMDGPUToLLVM>(targetArch, ftz);
267264
}
268265

269-
} // namespace triton
270-
} // namespace mlir
266+
} // namespace mlir::triton

third_party/amd/lib/TritonAMDGPUToLLVM/UpcastMXFPToLLVM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class UpcastMXFPOpPattern : public ConvertOpToLLVMPattern<UpcastMXFPOp> {
132132
return success();
133133
}
134134
};
135-
} // anonymous namespace
135+
} // namespace
136136

137137
void mlir::triton::AMD::populateUpcastMXFPToLLVMPatterns(
138138
LLVMTypeConverter &typeConverter, RewritePatternSet &patterns,

third_party/amd/lib/TritonAMDGPUTransforms/StreamPipeline.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ struct PipelinePass : public TritonAMDGPUStreamPipelineBase<PipelinePass> {
891891
return numStages;
892892
}
893893
};
894-
} // anonymous namespace
894+
} // namespace
895895

896896
std::unique_ptr<Pass> mlir::createTritonAMDGPUStreamPipelinePass(int numStages,
897897
int prefetch) {

0 commit comments

Comments
 (0)