| 774 | } |
| 775 | |
| 776 | void llama_batch_allocr::ubatch_print(const llama_ubatch & ubatch, int debug) { |
| 777 | if (debug > 0) { |
| 778 | LLAMA_LOG_DEBUG("%s: equal_seqs = %d\n", __func__, ubatch.equal_seqs()); |
| 779 | LLAMA_LOG_DEBUG("%s: n_tokens = %d\n", __func__, ubatch.n_tokens); |
| 780 | LLAMA_LOG_DEBUG("%s: n_seq_tokens = %d\n", __func__, ubatch.n_seq_tokens); |
| 781 | LLAMA_LOG_DEBUG("%s: n_seqs = %d\n", __func__, ubatch.n_seqs); |
| 782 | LLAMA_LOG_DEBUG("%s: n_seqs_unq = %d\n", __func__, ubatch.n_seqs_unq); |
| 783 | |
| 784 | std::stringstream ss_seq_id_unq; |
| 785 | std::stringstream ss_seq_idx; |
| 786 | |
| 787 | ss_seq_id_unq << "[ "; |
| 788 | ss_seq_idx << "["; |
| 789 | |
| 790 | for (uint32_t s = 0; s < ubatch.n_seqs_unq; ++s) { |
| 791 | ss_seq_id_unq << ubatch.seq_id_unq[s] << " "; |
| 792 | } |
| 793 | |
| 794 | for (uint32_t s = 0; s < LLAMA_MAX_SEQ; ++s) { |
| 795 | if (ubatch.seq_idx[s] >= 0) { |
| 796 | ss_seq_idx << ubatch.seq_idx[s]%10; |
| 797 | } else { |
| 798 | ss_seq_idx << "."; |
| 799 | } |
| 800 | } |
| 801 | |
| 802 | ss_seq_id_unq << "]"; |
| 803 | ss_seq_idx << "]"; |
| 804 | |
| 805 | LLAMA_LOG_DEBUG("%s: token = %p\n", __func__, (void *) ubatch.token); |
| 806 | LLAMA_LOG_DEBUG("%s: embd = %p\n", __func__, (void *) ubatch.embd); |
| 807 | LLAMA_LOG_DEBUG("%s: pos = %p\n", __func__, (void *) ubatch.pos); |
| 808 | LLAMA_LOG_DEBUG("%s: n_seq_id = %p\n", __func__, (void *) ubatch.n_seq_id); |
| 809 | LLAMA_LOG_DEBUG("%s: seq_id = %p\n", __func__, (void *) ubatch.seq_id); |
| 810 | LLAMA_LOG_DEBUG("%s: seq_id_unq = %s\n", __func__, ss_seq_id_unq.str().c_str()); |
| 811 | LLAMA_LOG_DEBUG("%s: seq_idx = %s\n", __func__, ss_seq_idx.str().c_str()); |
| 812 | LLAMA_LOG_DEBUG("%s: output = %p\n", __func__, (void *) ubatch.output); |
| 813 | LLAMA_LOG_DEBUG("%s: n_outputs = %d\n", __func__, n_outputs); |
| 814 | |
| 815 | if (debug > 1) { |
| 816 | int seq_id_max = 0; |
| 817 | for (uint32_t i = 0; i < ubatch.n_tokens; ++i) { |
| 818 | for (int s = 0; s < ubatch.n_seq_id[i]; ++s) { |
| 819 | for (int s = 0; s < ubatch.n_seq_id[i]; ++s) { |
| 820 | seq_id_max = std::max(seq_id_max, ubatch.seq_id[i][s]); |
| 821 | } |
| 822 | } |
| 823 | } |
| 824 | ++seq_id_max; |
| 825 | |
| 826 | LLAMA_LOG_DEBUG("%s: token = [\n", __func__); |
| 827 | for (uint32_t i = 0; i < ubatch.n_tokens; ++i) { |
| 828 | std::vector<int8_t> seq_id(seq_id_max); |
| 829 | |
| 830 | for (int s = 0; s < ubatch.n_seq_id[i]; ++s) { |
| 831 | seq_id[ubatch.seq_id[i][s]] = 1; |
| 832 | } |
| 833 |
nothing calls this directly
no test coverage detected