@@ -38,6 +38,11 @@ class StaticKVCache {
38
38
reset ();
39
39
}
40
40
41
+ StaticKVCache (const StaticKVCache& other) = delete;
42
+ StaticKVCache& operator =(const StaticKVCache& other) = delete ;
43
+ StaticKVCache (StaticKVCache&& other) = delete;
44
+ StaticKVCache& operator =(StaticKVCache&& other) = delete ;
45
+
41
46
~StaticKVCache () {
42
47
allocator_.deallocate (data_, data_size_);
43
48
}
@@ -200,6 +205,15 @@ class StaticAttentionMask {
200
205
reset ();
201
206
}
202
207
208
+ StaticAttentionMask (const StaticAttentionMask& other) = delete;
209
+ StaticAttentionMask& operator =(const StaticAttentionMask& other) = delete ;
210
+ StaticAttentionMask (StaticAttentionMask&& other) = delete;
211
+ StaticAttentionMask& operator =(StaticAttentionMask&& other) = delete ;
212
+
213
+ ~StaticAttentionMask () {
214
+ allocator_.deallocate (data_, data_size_);
215
+ }
216
+
203
217
/* *
204
218
* Reset the mask to the state where the cache contains no valid data.
205
219
*/
@@ -315,7 +329,7 @@ class StaticAttentionIOManager {
315
329
input_pos_ += update_len;
316
330
kCaches_ .update (method, k_cache_output_indices, update_len);
317
331
vCaches_.update (method, v_cache_output_indices, update_len);
318
- for (auto it : attentionMasks_) {
332
+ for (auto & it : attentionMasks_) {
319
333
it.second .updateCacheMask (update_len);
320
334
}
321
335
}
@@ -324,7 +338,7 @@ class StaticAttentionIOManager {
324
338
input_pos_ = 0 ;
325
339
kCaches_ .reset ();
326
340
vCaches_.reset ();
327
- for (auto it : attentionMasks_) {
341
+ for (auto & it : attentionMasks_) {
328
342
it.second .reset ();
329
343
}
330
344
}
0 commit comments