Skip to content

Commit 5315f09

Browse files
authored
[BUILD] Resolve unused variable and uninitialized variable warnings. (#757)
1 parent 406b5e5 commit 5315f09

File tree

10 files changed

+25
-34
lines changed

10 files changed

+25
-34
lines changed

tensorflow/core/framework/embedding/bloom_filter_policy.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,10 @@ class BloomFilterPolicy : public FilterPolicy<K, V, EV> {
226226
value_ptr->SetStep(version_buff[i]);
227227
}
228228
if (!is_filter){
229-
V* v = ev_->LookupOrCreateEmb(value_ptr,
229+
ev_->LookupOrCreateEmb(value_ptr,
230230
value_buff + i * ev_->ValueLen());
231231
} else {
232-
V* v = ev_->LookupOrCreateEmb(value_ptr,
232+
ev_->LookupOrCreateEmb(value_ptr,
233233
ev_->GetDefaultValue(key_buff[i]));
234234
}
235235
}

tensorflow/core/framework/embedding/cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ class LFUCache : public BatchCache<K> {
284284
int64* cached_versions,
285285
int64* cached_freqs) override {
286286
mutex_lock l(mu_);
287-
size_t i;
287+
size_t i = 0;
288288
size_t curr_freq = max_freq;
289289
auto it = freq_table[max_freq - 1].first->begin();
290290
while (i < k_size && curr_freq >= min_freq) {

tensorflow/core/framework/embedding/counter_filter_policy.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ class CounterFilterPolicy : public FilterPolicy<K, V, EV> {
101101
}
102102
if (value_ptr->GetFreq() >= config_.filter_freq) {
103103
if (!is_filter) {
104-
V* v = ev_->LookupOrCreateEmb(value_ptr,
104+
ev_->LookupOrCreateEmb(value_ptr,
105105
value_buff + i * ev_->ValueLen());
106106
} else {
107-
V* v = ev_->LookupOrCreateEmb(value_ptr,
107+
ev_->LookupOrCreateEmb(value_ptr,
108108
ev_->GetDefaultValue(key_buff[i]));
109109
}
110110
}
@@ -149,10 +149,10 @@ class CounterFilterPolicy : public FilterPolicy<K, V, EV> {
149149
}
150150
if (value_ptr->GetFreq() >= config_.filter_freq) {
151151
if (!is_filter) {
152-
V* v = ev_->LookupOrCreateEmb(value_ptr,
152+
ev_->LookupOrCreateEmb(value_ptr,
153153
value_buff + i * ev_->ValueLen(), ev_allocator());
154154
} else {
155-
V* v = ev_->LookupOrCreateEmb(value_ptr,
155+
ev_->LookupOrCreateEmb(value_ptr,
156156
default_values +
157157
(key_buff[i] % config_.default_value_dim)
158158
* ev_->ValueLen(),

tensorflow/core/framework/embedding/gpu_hash_map_kv.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ class GPUHashMapKV : public KVInterface<K, V> {
121121
keys_gpu, size * sizeof(K), cudaMemcpyDeviceToHost);
122122
cudaMemcpyAsync(values, values_gpu, size * value_len_ * sizeof(V),
123123
cudaMemcpyDeviceToHost);
124-
cudaEvent_t is_finish;
125-
cudaEventRecord(is_finish);
126-
cudaEventSynchronize(is_finish);
124+
EventSynchronize(NULL);
127125

128126
TypedAllocator::Deallocate(alloc_, item_idxs, size);
129127
TypedAllocator::Deallocate(alloc_, keys_gpu, size);
@@ -156,9 +154,7 @@ class GPUHashMapKV : public KVInterface<K, V> {
156154
hash_table_->d_bank_ptrs, hash_table_->d_existence_flag_ptrs,
157155
(emb_config.block_num * (1 + emb_config.slot_num)),
158156
hash_table_->initial_bank_size, stream);
159-
cudaEvent_t is_finish;
160-
cudaEventRecord(is_finish, stream);
161-
cudaEventSynchronize(is_finish);
157+
EventSynchronize(stream);
162158
TypedAllocator::Deallocate(alloc_, item_idxs, n);
163159
TypedAllocator::Deallocate(alloc_, value_gpu, value_import.size());
164160
TypedAllocator::Deallocate(alloc_, key_gpu, n);
@@ -274,6 +270,14 @@ class GPUHashMapKV : public KVInterface<K, V> {
274270
num_elements * sizeof(bool*), cudaMemcpyHostToDevice);
275271
}
276272

273+
void EventSynchronize(const cudaStream_t& stream) {
274+
cudaEvent_t is_finish;
275+
cudaEventCreate(&is_finish);
276+
cudaEventRecord(is_finish, stream);
277+
cudaEventSynchronize(is_finish);
278+
cudaEventDestroy(is_finish);
279+
}
280+
277281
private:
278282
EmbeddingConfig config_;
279283
GPUHashTable<K, V>* hash_table_;

tensorflow/core/framework/embedding/hbm_dram_ssd_storage.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,6 @@ class HbmDramSsdStorage : public MultiTierStorage<K, V> {
324324
memcpy((char *)gpu_value_ptr->GetPtr(),
325325
(char *)memcpy_address[j] - sizeof(FixedLengthHeader),
326326
sizeof(FixedLengthHeader));
327-
V* gpu_data_address = gpu_value_ptr->GetValue(0, 0);
328327
gpu_value_ptrs[i] = gpu_value_ptr;
329328
}
330329
}

tensorflow/core/framework/embedding/hbm_dram_storage.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,6 @@ class HbmDramStorage : public MultiTierStorage<K, V> {
286286
memcpy((char *)gpu_value_ptr->GetPtr(),
287287
(char *)memcpy_address[j] - sizeof(FixedLengthHeader),
288288
sizeof(FixedLengthHeader));
289-
V* gpu_data_address = gpu_value_ptr->GetValue(0, 0);
290289
gpu_value_ptrs[i] = gpu_value_ptr;
291290
}
292291
}

tensorflow/core/framework/embedding/hbm_storage_iterator.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,9 @@ class HbmDramIterator: public Iterator {
243243
embedding_buffer_ +
244244
(hbm_ptr_cursor_ - fill_buffer_st_) * value_len_,
245245
dim);
246-
V* tmp = (V*)val;
247246
hbm_ptr_cursor_++;
248247
} else {
249248
memcpy(val, value_list_[cursor_].first, dim);
250-
V* tmp = (V*)val;
251249
}
252250
}
253251

@@ -335,4 +333,4 @@ class HbmDramIterator: public Iterator {
335333
} // tensorflow
336334

337335
#endif // GOOGLE_CUDA
338-
#endif // TENSORFLOW_CORE_FRAMEWORK_EMBEDDING_HBM_STORAGE_ITERATOR_H_
336+
#endif // TENSORFLOW_CORE_FRAMEWORK_EMBEDDING_HBM_STORAGE_ITERATOR_H_

tensorflow/core/framework/embedding/nullable_filter_policy.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ class NullableFilterPolicy : public FilterPolicy<K, V, EV> {
107107
value_ptr->SetStep(version_buff[i]);
108108
}
109109
if (!is_filter) {
110-
V* v = ev_->LookupOrCreateEmb(value_ptr,
110+
ev_->LookupOrCreateEmb(value_ptr,
111111
value_buff + i * ev_->ValueLen());
112112
}else {
113-
V* v = ev_->LookupOrCreateEmb(value_ptr,
113+
ev_->LookupOrCreateEmb(value_ptr,
114114
ev_->GetDefaultValue(key_buff[i]));
115115
}
116116
}
@@ -148,10 +148,10 @@ class NullableFilterPolicy : public FilterPolicy<K, V, EV> {
148148
value_ptr->SetStep(version_buff[i]);
149149
}
150150
if (!is_filter) {
151-
V* v = ev_->LookupOrCreateEmb(value_ptr,
151+
ev_->LookupOrCreateEmb(value_ptr,
152152
value_buff + i * ev_->ValueLen(), ev_allocator());
153-
}else {
154-
V* v = ev_->LookupOrCreateEmb(value_ptr,
153+
} else {
154+
ev_->LookupOrCreateEmb(value_ptr,
155155
default_values +
156156
(key_buff[i] % config_.default_value_dim)
157157
* ev_->ValueLen(),

tensorflow/core/kernels/kv_variable_ops.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ void DumpSsdIndexMeta(
187187
BundleWriter ssd_record_writer(Env::Default(),
188188
ssd_record_path);
189189
typedef EVFreqDumpIterator<int64> Int64DataDumpIterator;
190-
typedef EVFreqDumpIterator<uint8> StringDumpIterator;
191190
size_t bytes_limit = 8 << 20;
192191
char* dump_buffer = new char[bytes_limit];
193192

tensorflow/core/kernels/training_ali_ops.cc

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ class KvSparseApplyFtrlOp : public OpKernel {
529529
T lr_scalar = lr.scalar<T>()();
530530
T l1_scalar = l1.scalar<T>()();
531531
T l2_scalar = l2.scalar<T>()();
532-
T l2_shrinkage_scalar;
532+
T l2_shrinkage_scalar = 0.0;
533533
if (has_l2_shrinkage) {
534534
l2_shrinkage_scalar = l2_shrinkage->scalar<T>()();
535535
}
@@ -741,7 +741,7 @@ class KvSparseApplyFtrlOpGPU : public OpKernel {
741741
T lr_scalar = lr.scalar<T>()();
742742
T l1_scalar = l1.scalar<T>()();
743743
T l2_scalar = l2.scalar<T>()();
744-
T l2_shrinkage_scalar;
744+
T l2_shrinkage_scalar = 0.0;
745745
if (has_l2_shrinkage) {
746746
l2_shrinkage_scalar = l2_shrinkage->scalar<T>()();
747747
}
@@ -1569,11 +1569,6 @@ class KvSparseApplyAdamGPUOp : public OpKernel {
15691569

15701570
int block_size = 128;
15711571
int embedding_dim = var->ValueLen();
1572-
void* args[] = {(void*)&dev_var_ptr, (void*)&dev_m_ptr,
1573-
(void*)&dev_v_ptr, (void*)&grad_base,
1574-
(void*)&alpha, (void*)&beta1, (void*)&beta2,
1575-
(void*)&epsilon, (void*)&embedding_dim,
1576-
(void*)&task_size};
15771572

15781573
functor::KvSparseApplyAdamHbm<GPUDevice, Tindex, T>()(
15791574
block_size, embedding_dim,
@@ -2394,8 +2389,6 @@ class KvSparseApplyAdamAsyncOp : public OpKernel {
23942389
&lr_scalar, &beta1_scalar,
23952390
&beta1_power, &beta2_power,
23962391
&beta2_scalar, &epsilon_scalar, &alpha, &global_step] (int64 start_i, int64 limit_i) {
2397-
auto beta1_power_scalar = beta1_power.scalar<T>();
2398-
auto beta2_power_scalar = beta2_power.scalar<T>();
23992392

24002393
if (inner_dim > 0) {
24012394
auto grad_flat = grad.flat_outer_dims<T>();
@@ -2688,7 +2681,6 @@ class KvSparseApplyAdamAsyncGPUOp : public OpKernel {
26882681

26892682
ValuePtr<T>** value_ptrs = new ValuePtr<T>*[N];
26902683
Tindex* indices_host = new Tindex[N];
2691-
volatile bool is_cpu_indices_ready = false;
26922684
//Copy ids from GPU to CPU for CPU Lookup.
26932685
auto stream = ctx->op_device_context()->stream();
26942686
auto event_mgr = ctx->device()->tensorflow_gpu_device_info()->event_mgr;

0 commit comments

Comments
 (0)