Skip to content

Commit 9866dc8

Browse files
nlutsenkometa-codesync[bot]
authored andcommitted
clang-format | Format fbsource with clang-format 21.
Reviewed By: ChristianK275 Differential Revision: D85317706 fbshipit-source-id: b399c5c4b75252999442b7d7d2778e7a241b0025
1 parent b84978e commit 9866dc8

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed

packages/adsim/src/cpp2/server/DataObjects.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ class AdSimBaseObjs {
9999
shared_obj_map.withWLock([&](auto& objs) {
100100
auto iter = objs.find(key);
101101
if (objs.end() == iter) {
102-
iter = objs.insert(std::pair<std::string, std::shared_ptr<T>>(
103-
key.c_str(), f()))
102+
iter = objs.insert(
103+
std::pair<std::string, std::shared_ptr<T>>(
104+
key.c_str(), f()))
104105
.first;
105106
}
106107
ret = std::static_pointer_cast<T>(iter->second);

packages/adsim/src/cpp2/server/dwarfs/Embedding.cc

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -96,27 +96,28 @@ void EmbeddingTable::fill_random_weights() {
9696
break;
9797
}
9898

99-
futures.emplace_back(std::async(
100-
std::launch::async, [this, start_row, end_row, weights_size]() {
101-
std::minstd_rand fast_gen(42 + start_row);
102-
std::uniform_int_distribution<uint8_t> byte_dist(0, 255);
103-
104-
for (int i = start_row; i < end_row; ++i) {
105-
uint8_t* row_ptr =
106-
fused_embedding_table_.data() + i * fused_embedding_dim_;
107-
108-
// Fill quantized weights with random bytes
109-
for (size_t j = 0; j < weights_size; ++j) {
110-
row_ptr[j] = byte_dist(fast_gen);
111-
}
112-
113-
// Set scale and bias for quantized weights
114-
float* scale_bias =
115-
reinterpret_cast<float*>(row_ptr + weights_size);
116-
scale_bias[0] = 2.0f; // scale
117-
scale_bias[1] = 1.0f; // bias
118-
}
119-
}));
99+
futures.emplace_back(
100+
std::async(
101+
std::launch::async, [this, start_row, end_row, weights_size]() {
102+
std::minstd_rand fast_gen(42 + start_row);
103+
std::uniform_int_distribution<uint8_t> byte_dist(0, 255);
104+
105+
for (int i = start_row; i < end_row; ++i) {
106+
uint8_t* row_ptr =
107+
fused_embedding_table_.data() + i * fused_embedding_dim_;
108+
109+
// Fill quantized weights with random bytes
110+
for (size_t j = 0; j < weights_size; ++j) {
111+
row_ptr[j] = byte_dist(fast_gen);
112+
}
113+
114+
// Set scale and bias for quantized weights
115+
float* scale_bias =
116+
reinterpret_cast<float*>(row_ptr + weights_size);
117+
scale_bias[0] = 2.0f; // scale
118+
scale_bias[1] = 1.0f; // bias
119+
}
120+
}));
120121
}
121122

122123
for (auto& future : futures) {

0 commit comments

Comments
 (0)