Skip to content

Commit 8828a0d

Browse files
JYMiracle305kilinchange
authored andcommitted
refactor: enable -Wunused -Wunused-function globally
1 parent de0167e commit 8828a0d

6 files changed

Lines changed: 4 additions & 10 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ set(CMAKE_CXX_EXTENSIONS OFF)
1515
# Generate compile_commands.json
1616
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
1717

18+
add_compile_options(-Wunused -Wunused-function)
19+
1820
# ------------------------------------------------------------------------------
1921
# GoogleTest (submodule)
2022
# ------------------------------------------------------------------------------

example/common/tiny_shakespeare_dataset.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ TinyShakespeareFile ReadTinyShakespeareFile(const std::string &path, size_t sequ
6868
const auto header = ReadSeveralBytesFromIfstream(1024, &ifs);
6969
const int magic = BytesToType<int32_t>(header, 0);
7070
const int version = BytesToType<int32_t>(header, 4);
71+
(void)version; // Read but unused; reserved in binary format specification
7172
const int num_tokens = BytesToType<int32_t>(header, 8);
7273
text_file.type = kTypeMap.at(magic);
7374

example/gpt2/checkpoint_loader.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,8 @@ std::shared_ptr<nn::TransformerModel> LoadFromLLMC(const std::string &filepath)
115115
// calculate xx_size_per_partition
116116
const int64_t vpp = model_vocab_size / tp_size;
117117
const int64_t v_start = static_cast<int64_t>(tp_rank) * vpp;
118-
const int64_t v_end = v_start + vpp;
119118

120119
const int64_t qkv_out = 3 * n_embd;
121-
const int64_t qkv_pp = qkv_out / tp_size;
122-
const int64_t qkv_start = static_cast<int64_t>(tp_rank) * qkv_pp;
123120

124121
const int64_t fc_out = 4 * n_embd;
125122
const int64_t fc_pp = fc_out / tp_size;

example/llama3/checkpoint_loader.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ std::shared_ptr<nn::TransformerModel> LoadFromLLMC(const std::string &filepath)
156156
const int64_t q_local_rows = static_cast<int64_t>(n_embd) / tp_size; // = (n_head/world)*head_dim
157157
const int64_t kv_head_local = static_cast<int64_t>(n_kv_head) / tp_size;
158158
const int64_t kv_local_rows = kv_head_local * head_dim; // for K or V (each)
159-
const int64_t attn_local_rows = q_local_rows + 2 * kv_local_rows;
160159

161160
// RowParallel (proj)
162161
const int64_t in_pp = static_cast<int64_t>(n_embd) / tp_size;

infini_train/src/nn/parallel/ddp/param_and_grad_buffer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ void ParamAndGradBucketGroup::RegisterGradReady(const std::shared_ptr<Tensor> &p
161161
return;
162162
}
163163

164-
const bool inserted = params_with_grad_.insert(parameter.get()).second;
164+
params_with_grad_.insert(parameter.get());
165165
// TODO(zbl): check this if sync is only done in last mircobatch
166166
// if (!inserted) {
167167
// LOG(FATAL) << "ParamAndGradBucketGroup: RegisterGradReady() was called twice for the same parameter in a

infini_train/src/nn/parallel/global.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ int GetEnvAsInt(const std::string &name, int default_value) {
1313
return value ? std::atoi(value) : default_value;
1414
}
1515

16-
std::string GetEnvAsStr(const std::string &name, const std::string &default_value) {
17-
const char *value = std::getenv(name.c_str());
18-
return value ? std::string(value) : default_value;
19-
}
20-
2116
} // namespace
2217

2318
namespace infini_train::nn::parallel::global {

0 commit comments

Comments
 (0)