Skip to content

Commit 203cade

Browse files
authored
Upgrading our rustc version. (#2908)
* Upgrading our rustc version. * Fixing the rust tests to proper version. * Clippy everything.
1 parent 46994b3 commit 203cade

File tree

15 files changed

+40
-53
lines changed

15 files changed

+40
-53
lines changed

.github/workflows/tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
with:
3232
# Released on: 02 May, 2024
3333
# https://releases.rs/docs/1.78.0/
34-
toolchain: 1.80.0
34+
toolchain: 1.84.0
3535
override: true
3636
components: rustfmt, clippy
3737
- name: Install Protoc

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Rust builder
2-
FROM lukemathwalker/cargo-chef:latest-rust-1.80.1 AS chef
2+
FROM lukemathwalker/cargo-chef:latest-rust-1.84.0 AS chef
33
WORKDIR /usr/src
44

55
ARG CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse

Dockerfile_amd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Rust builder
2-
FROM lukemathwalker/cargo-chef:latest-rust-1.80.1 AS chef
2+
FROM lukemathwalker/cargo-chef:latest-rust-1.84.0 AS chef
33
WORKDIR /usr/src
44

55
ARG CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse

Dockerfile_intel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG PLATFORM=xpu
22

3-
FROM lukemathwalker/cargo-chef:latest-rust-1.80.1 AS chef
3+
FROM lukemathwalker/cargo-chef:latest-rust-1.84.0 AS chef
44
WORKDIR /usr/src
55

66
ARG CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse

Dockerfile_trtllm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ARG CUDA_ARCH_LIST="75-real;80-real;86-real;89-real;90-real"
22
ARG OMPI_VERSION="4.1.7rc1"
33

44
# Build dependencies resolver stage
5-
FROM lukemathwalker/cargo-chef:latest AS chef
5+
FROM lukemathwalker/cargo-chef:latest-rust-1.84.0 AS chef
66
WORKDIR /usr/src/text-generation-inference/backends/trtllm
77

88
FROM chef AS planner

backends/grpc-metadata/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use tracing_opentelemetry::OpenTelemetrySpanExt;
88
/// Inject context in the metadata of a gRPC request.
99
struct MetadataInjector<'a>(pub &'a mut tonic::metadata::MetadataMap);
1010

11-
impl<'a> Injector for MetadataInjector<'a> {
11+
impl Injector for MetadataInjector<'_> {
1212
/// Set a key and value in the MetadataMap. Does nothing if the key or value are not valid inputs
1313
fn set(&mut self, key: &str, value: String) {
1414
if let Ok(key) = tonic::metadata::MetadataKey::from_bytes(key.as_bytes()) {

backends/v2/src/queue.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,7 @@ impl State {
213213
}
214214

215215
// Pad prefill_token_budget to be a multiple of block size
216-
let prefill_token_budget =
217-
((prefill_token_budget + self.block_size - 1) / self.block_size) * self.block_size;
216+
let prefill_token_budget = prefill_token_budget.div_ceil(self.block_size) * self.block_size;
218217

219218
// Create span for this batch to add context to inference calls
220219
let next_batch_span = info_span!(parent: None, "batch", batch_size = tracing::field::Empty);
@@ -245,9 +244,8 @@ impl State {
245244
prefill_tokens = (batch_requests.len() + 1) as u32 * max_input_length
246245
} else {
247246
// pad to block size
248-
prefill_tokens += ((entry.request.input_length + self.block_size - 1)
249-
/ self.block_size)
250-
* self.block_size;
247+
prefill_tokens +=
248+
entry.request.input_length.div_ceil(self.block_size) * self.block_size;
251249
}
252250

253251
if self.requires_padding {
@@ -262,8 +260,7 @@ impl State {
262260
};
263261

264262
// pad to block size
265-
decode_tokens +=
266-
((max_new_tokens + self.block_size - 1) / self.block_size) * self.block_size;
263+
decode_tokens += max_new_tokens.div_ceil(self.block_size) * self.block_size;
267264
}
268265

269266
if prefill_tokens > prefill_token_budget

backends/v3/src/block_allocator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,13 @@ impl Allocator for SimpleAllocator {
165165
let (tokens, repeats) = match self.window_size {
166166
None => (tokens, 1),
167167
Some(window_size) => {
168-
let repeats = (tokens + window_size - 1) / window_size;
168+
let repeats = tokens.div_ceil(window_size);
169169
let tokens = core::cmp::min(tokens, window_size);
170170
(tokens, repeats as usize)
171171
}
172172
};
173173
// Pad to a multiple of block size
174-
let required_blocks = (tokens + self.block_size - 1) / self.block_size;
174+
let required_blocks = tokens.div_ceil(self.block_size);
175175
(required_blocks, repeats)
176176
};
177177

backends/v3/src/queue.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,7 @@ impl State {
257257
}
258258

259259
// Pad prefill_token_budget to be a multiple of block size
260-
let prefill_token_budget =
261-
((prefill_token_budget + self.block_size - 1) / self.block_size) * self.block_size;
260+
let prefill_token_budget = prefill_token_budget.div_ceil(self.block_size) * self.block_size;
262261

263262
// Create span for this batch to add context to inference calls
264263
let next_batch_span = info_span!(parent: None, "batch", batch_size = tracing::field::Empty);

backends/v3/src/radix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl Allocator for RadixAllocator {
103103
let prefix_len = blocks.len() * self.block_size as usize;
104104
let suffix_len = tokens - prefix_len as u32;
105105

106-
let suffix_blocks = (suffix_len + self.block_size - 1) / self.block_size;
106+
let suffix_blocks = suffix_len.div_ceil(self.block_size);
107107

108108
tracing::info!("Prefix {prefix_len} - Suffix {suffix_len}");
109109

0 commit comments

Comments
 (0)