Skip to content

Commit 4111350

Browse files
committed
lint
1 parent dcbb0a1 commit 4111350

File tree

3 files changed

+20
-24
lines changed

3 files changed

+20
-24
lines changed

csrc/fusion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class DynamicTransformConcretizationInfo;
7171

7272
// Set the enum base to `int` so it can be safely serialized as a part of
7373
// serde::InputOutputAlias.
74-
enum class AllocationType : int {
74+
enum class AllocationType : int { // NOLINT(performance-enum-size)
7575
New, // Allocate a new buffer
7676
// Reuse the buffer allocated to `aliased_io`. For example, the tensor storing
7777
// BatchNorm's running mean. The output EMA is updated in place.
@@ -88,7 +88,7 @@ enum class AllocationType : int {
8888

8989
std::ostream& operator<<(std::ostream& os, AllocationType);
9090

91-
enum class OutputVisibility : int {
91+
enum class OutputVisibility : int { // NOLINT(performance-enum-size)
9292
kHidden,
9393
kVisible,
9494
};

csrc/ir/container.cpp

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
// clang-format on
88
#include "ir/container.h"
99

10-
#include "fusion.h"
1110
#include "instrumentation.h"
1211
#include "ir/base_nodes.h"
1312
#include "ir/builder.h"
@@ -19,9 +18,8 @@ namespace nvfuser {
1918
//! Return values in insertion order
2019
const std::deque<Val*> IrContainer::deterministic_vals() const noexcept {
2120
std::deque<Val*> vals_deque;
22-
std::transform(
23-
vals_up_.begin(),
24-
vals_up_.end(),
21+
std::ranges::transform(
22+
vals_up_,
2523
std::back_inserter(vals_deque),
2624
[](const std::unique_ptr<Val>& val_up) { return val_up.get(); });
2725
return vals_deque;
@@ -30,9 +28,8 @@ const std::deque<Val*> IrContainer::deterministic_vals() const noexcept {
3028
//! Return expression in insertion order
3129
const std::deque<Expr*> IrContainer::deterministic_exprs() const noexcept {
3230
std::deque<Expr*> exprs_deque;
33-
std::transform(
34-
exprs_up_.begin(),
35-
exprs_up_.end(),
31+
std::ranges::transform(
32+
exprs_up_,
3633
std::back_inserter(exprs_deque),
3734
[](const std::unique_ptr<Expr>& expr_up) { return expr_up.get(); });
3835
return exprs_deque;
@@ -43,9 +40,8 @@ const std::unordered_map<Val*, int64_t> IrContainer::deterministic_vals_map()
4340
const noexcept {
4441
std::unordered_map<Val*, int64_t> vals_map;
4542
int64_t count = 0;
46-
std::transform(
47-
vals_up_.begin(),
48-
vals_up_.end(),
43+
std::ranges::transform(
44+
vals_up_,
4945
std::inserter(vals_map, vals_map.end()),
5046
[&count](const std::unique_ptr<Val>& val_up) {
5147
return std::make_pair(val_up.get(), count++);
@@ -58,9 +54,8 @@ const std::unordered_map<Expr*, int64_t> IrContainer::deterministic_exprs_map()
5854
const noexcept {
5955
std::unordered_map<Expr*, int64_t> exprs_map;
6056
int64_t count = 0;
61-
std::transform(
62-
exprs_up_.begin(),
63-
exprs_up_.end(),
57+
std::ranges::transform(
58+
exprs_up_,
6459
std::inserter(exprs_map, exprs_map.end()),
6560
[&count](const std::unique_ptr<Expr>& expr_up) {
6661
return std::make_pair(expr_up.get(), count++);
@@ -119,9 +114,8 @@ void IrContainer::removeExpr(Expr* expr) {
119114
NVF_ERROR(
120115
exprs_.find(expr) != exprs_.end(),
121116
"Wanted to remove an expression but it doesn't exist in this container.");
122-
auto expr_in_deque = std::find_if(
123-
exprs_up_.begin(),
124-
exprs_up_.end(),
117+
auto expr_in_deque = std::ranges::find_if(
118+
exprs_up_,
125119
[expr](std::unique_ptr<Expr>& expr_up) { return expr_up.get() == expr; });
126120

127121
NVF_ERROR(
@@ -138,10 +132,9 @@ void IrContainer::removeVal(Val* val) {
138132
NVF_ERROR(
139133
vals_.find(val) != vals_.end(),
140134
"Wanted to remove a value but it doesn't exist in this container.");
141-
auto val_in_deque = std::find_if(
142-
vals_up_.begin(), vals_up_.end(), [val](std::unique_ptr<Val>& val_up) {
143-
return val_up.get() == val;
144-
});
135+
auto val_in_deque = std::ranges::find_if(
136+
vals_up_,
137+
[val](std::unique_ptr<Val>& val_up) { return val_up.get() == val; });
145138

146139
NVF_ERROR(
147140
val_in_deque != vals_up_.end(),

csrc/ir/utils.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ std::vector<int64_t> normalizeNew2Old(
4646
const std::vector<int64_t>& new2old_in,
4747
int64_t ndims) {
4848
NVF_CHECK(
49-
(int64_t)new2old_in.size() == ndims,
49+
std::cmp_equal(new2old_in.size(), ndims),
5050
"There must be a transpose mapping for each dimension in domain");
5151

5252
// Canonicalize dimensions by wrapping each dim for the given ndims
@@ -74,7 +74,8 @@ std::vector<int64_t> normalizeNew2Old(
7474

7575
// Error out if duplicate values are found.
7676
NVF_CHECK(
77-
(int64_t)new2old.size() == ndims && old_pos_set.size() == new2old.size(),
77+
std::cmp_equal(new2old.size(), ndims) &&
78+
old_pos_set.size() == new2old.size(),
7879
"Duplicate entries in transformation map.");
7980

8081
// END VALIDATION CHECKS
@@ -534,6 +535,7 @@ class ValReplacementMutator : public OptOutMutator {
534535
expr->outputs().begin(),
535536
expr->outputs().end());
536537
}
538+
// NOLINTNEXTLINE(bugprone-nondeterministic-pointer-iteration-order)
537539
for (auto input : inputs) {
538540
outputs.erase(input);
539541
}
@@ -1057,6 +1059,7 @@ CompareDomainResult compareDomains(
10571059
return v->as<IterDomain>()->getIterType() == IterType::Symbolic;
10581060
};
10591061
std::vector<Val*> ids_to_remove;
1062+
// NOLINTNEXTLINE(bugprone-nondeterministic-pointer-iteration-order)
10601063
for (Val* id : frontier) {
10611064
if (is_symb(id) && dom1_set.count(id)) {
10621065
ids_to_remove.push_back(id);

0 commit comments

Comments
 (0)