Skip to content

Commit 222c5ad

Browse files
committed
Cleanup code
1 parent 9818779 commit 222c5ad

File tree

8 files changed

+55
-67
lines changed

8 files changed

+55
-67
lines changed

src/llama-graph.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <cassert>
1414
#include <cmath>
1515
#include <cstring>
16-
#include <iostream>
1716

1817
void llm_graph_input_embd::set_input(const llama_ubatch * ubatch) {
1918
if (ubatch->token) {

src/llama-hparams.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "llama-hparams.h"
22

33
#include "ggml.h"
4-
#include <iostream>
54

65
void llama_hparams::set_swa_pattern(uint32_t n_pattern) {
76
for (uint32_t il = 0; il < n_layer; ++il) {

src/llama-kv-cache-unified.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <limits>
1212
#include <map>
1313
#include <stdexcept>
14-
#include <iostream>
1514

1615
//
1716
// llama_kv_cache_unified
@@ -1744,7 +1743,7 @@ bool llama_kv_cache_unified::state_read_data(llama_io_read_i & io, uint32_t cell
17441743
llama_kv_cache_unified_context::llama_kv_cache_unified_context(llama_memory_status status) : status(status) {}
17451744

17461745
llama_kv_cache_unified_context::llama_kv_cache_unified_context(
1747-
llama_kv_cache_unified * kv) : kv(kv), status(LLAMA_MEMORY_STATUS_SUCCESS) {
1746+
llama_kv_cache_unified * kv) : status(LLAMA_MEMORY_STATUS_SUCCESS), kv(kv) {
17481747
n_kv = kv->get_size();
17491748
head = 0;
17501749
}
@@ -1753,7 +1752,7 @@ llama_kv_cache_unified_context::llama_kv_cache_unified_context(
17531752
llama_kv_cache_unified * kv,
17541753
llama_context * lctx,
17551754
bool do_shift,
1756-
defrag_info dinfo) : kv(kv), status(LLAMA_MEMORY_STATUS_SUCCESS), lctx(lctx), do_shift(do_shift), dinfo(std::move(dinfo)) {
1755+
defrag_info dinfo) : status(LLAMA_MEMORY_STATUS_SUCCESS), kv(kv), lctx(lctx), do_shift(do_shift), dinfo(std::move(dinfo)) {
17571756
if (!do_shift && this->dinfo.empty()) {
17581757
status = LLAMA_MEMORY_STATUS_NO_UPDATE;
17591758
}
@@ -1762,7 +1761,7 @@ llama_kv_cache_unified_context::llama_kv_cache_unified_context(
17621761
llama_kv_cache_unified_context::llama_kv_cache_unified_context(
17631762
llama_kv_cache_unified * kv,
17641763
llama_kv_cache_unified::ubatch_heads heads,
1765-
std::vector<llama_ubatch> ubatches) : kv(kv), status(LLAMA_MEMORY_STATUS_SUCCESS), heads(std::move(heads)), ubatches(std::move(ubatches)) {
1764+
std::vector<llama_ubatch> ubatches) : status(LLAMA_MEMORY_STATUS_SUCCESS), kv(kv), heads(std::move(heads)), ubatches(std::move(ubatches)) {
17661765
}
17671766

17681767
llama_kv_cache_unified_context::~llama_kv_cache_unified_context() = default;

src/llama-kv-cache-unified.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ class llama_kv_cache_unified_context : public llama_memory_context_i {
239239
// Delete copy constructor and copy assignment to prevent shallow copies
240240
llama_kv_cache_unified_context(const llama_kv_cache_unified_context&) = delete;
241241
llama_kv_cache_unified_context& operator=(const llama_kv_cache_unified_context&) = delete;
242-
242+
243243
// Delete move constructor and move assignment to prevent issues
244244
llama_kv_cache_unified_context(llama_kv_cache_unified_context&&) = delete;
245245
llama_kv_cache_unified_context& operator=(llama_kv_cache_unified_context&&) = delete;
@@ -273,12 +273,10 @@ class llama_kv_cache_unified_context : public llama_memory_context_i {
273273
void set_input_kq_mask (ggml_tensor * dst, const llama_ubatch * ubatch, bool causal_attn) const;
274274
void set_input_pos_bucket(ggml_tensor * dst, const llama_ubatch * ubatch) const;
275275

276-
llama_kv_cache_unified * kv;
277-
// the beginning of the current slot in which the ubatch will be inserted
278-
int32_t head;
279276
private:
280277
llama_memory_status status;
281278

279+
llama_kv_cache_unified * kv;
282280
llama_context * lctx;
283281

284282
//
@@ -307,4 +305,7 @@ class llama_kv_cache_unified_context : public llama_memory_context_i {
307305
// a heuristic, to avoid attending the full cache if it is not yet utilized
308306
// as the cache gets filled, the benefit from this heuristic disappears
309307
int32_t n_kv;
308+
309+
// the beginning of the current slot in which the ubatch will be inserted
310+
int32_t head;
310311
};

src/llama-memory-hybrid.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
#include "llama-model.h"
55
#include "llama-context.h"
66

7-
#include <iostream>
8-
97
//
108
// llama_memory_hybrid
119
//

src/llama-model-loader.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,10 +1059,6 @@ bool llama_model_loader::load_all_data(
10591059
mmap_used.first = std::min(mmap_used.first, weight->offs);
10601060
mmap_used.second = std::max(mmap_used.second, weight->offs + n_size);
10611061
} else {
1062-
// Check if tensor has a buffer before calling ggml_backend_tensor_set
1063-
if (cur->buffer == nullptr) {
1064-
throw std::runtime_error(format("tensor '%s' has no buffer allocated", ggml_get_name(cur)));
1065-
}
10661062
ggml_backend_tensor_set(cur, data, 0, n_size);
10671063
}
10681064
} else {

src/llama-model.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include "ggml.h"
44
#include "llama-arch.h"
55
#include "llama-impl.h"
6-
#include "llama-mmap.h"
76
#include "llama-batch.h"
87
#include "llama-cparams.h"
98
#include "llama-model-loader.h"
@@ -23,9 +22,7 @@
2322
#include <functional>
2423
#include <map>
2524
#include <regex>
26-
#include <sstream>
2725
#include <stdexcept>
28-
#include <iostream>
2926

3027
const char * llm_type_name(llm_type type) {
3128
switch (type) {

0 commit comments

Comments
 (0)