Commit bacb277
fix: address CodeRabbit review — stop-sequence, format specifiers, race condition, token counts
- Stop-sequence sliding window (llamacpp_backend.cpp): port the
Utf8State/stop_window approach from generate_stream to the timing
variant generate_stream_with_timing, matching the non-timing variant's
behavior exactly.
- PRId32 format (rac_benchmark_log.cpp): change %d to PRId32 for all
int32_t fields to match the PRId64 convention for int64_t fields.
- Mutex guard (rac_benchmark_metrics.cpp): add static std::mutex around
the double-buffer write path in rac_benchmark_set_metrics_provider to
prevent torn fn/user_data pairs. Reader side remains lock-free.
- Actual token counts (llamacpp_backend.cpp + llm_component.cpp): write
tokens_generated to timing_out->output_tokens in the backend; read
backend-populated prompt_tokens/output_tokens in the component layer
instead of overwriting with estimate_tokens() heuristics.1 parent c2acc46 commit bacb277
4 files changed
Lines changed: 85 additions & 38 deletions
File tree
- sdk/runanywhere-commons/src
- backends/llamacpp
- core
- features/llm
Lines changed: 64 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
900 | 900 | | |
901 | 901 | | |
902 | 902 | | |
903 | | - | |
904 | | - | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
905 | 921 | | |
906 | 922 | | |
| 923 | + | |
907 | 924 | | |
908 | 925 | | |
909 | 926 | | |
| |||
915 | 932 | | |
916 | 933 | | |
917 | 934 | | |
918 | | - | |
919 | | - | |
920 | | - | |
921 | | - | |
922 | | - | |
923 | | - | |
924 | | - | |
925 | | - | |
926 | | - | |
927 | | - | |
928 | | - | |
929 | | - | |
930 | | - | |
| 935 | + | |
| 936 | + | |
931 | 937 | | |
932 | | - | |
933 | | - | |
934 | | - | |
935 | | - | |
936 | | - | |
937 | | - | |
938 | | - | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
939 | 946 | | |
940 | 947 | | |
941 | 948 | | |
942 | | - | |
943 | | - | |
944 | | - | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
945 | 953 | | |
946 | | - | |
947 | | - | |
948 | | - | |
949 | | - | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
950 | 972 | | |
951 | 973 | | |
952 | | - | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
953 | 984 | | |
954 | 985 | | |
955 | 986 | | |
| |||
967 | 998 | | |
968 | 999 | | |
969 | 1000 | | |
| 1001 | + | |
970 | 1002 | | |
971 | 1003 | | |
972 | | - | |
973 | | - | |
| 1004 | + | |
| 1005 | + | |
974 | 1006 | | |
975 | 1007 | | |
976 | 1008 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| 49 | + | |
| 50 | + | |
48 | 51 | | |
49 | 52 | | |
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
53 | | - | |
| 56 | + | |
| 57 | + | |
54 | 58 | | |
55 | 59 | | |
56 | 60 | | |
| |||
Lines changed: 15 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
947 | 947 | | |
948 | 948 | | |
949 | 949 | | |
950 | | - | |
951 | | - | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
952 | 964 | | |
953 | 965 | | |
954 | 966 | | |
| |||
972 | 984 | | |
973 | 985 | | |
974 | 986 | | |
975 | | - | |
976 | | - | |
| 987 | + | |
977 | 988 | | |
978 | 989 | | |
979 | 990 | | |
| |||
0 commit comments