Skip to content

Commit 19f8e22

Browse files
committed
fix staggered test
1 parent 1825b48 commit 19f8e22

2 files changed

Lines changed: 26 additions & 17 deletions

File tree

qa/L0_torch_aoti/test.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,15 @@ SERVER_ARGS="--model-repository=${BAD_MODELDIR} --exit-on-error=false --log-verb
172172
SERVER_LOG="./torch_aoti_negative-server.log"
173173
run_server_tolive
174174
if [[ "${SERVER_PID}" -eq 0 ]]; then
175-
echo -e "${COLOR_ERROR}\n***\n*** Failed to start ${SERVER} (negative phase)\n***${COLOR_RESET}" &1>2
176-
cat ${SERVER_LOG} &1>2
175+
echo -e "${COLOR_ERROR}\n***\n*** Failed to start ${SERVER} (negative phase)\n***${COLOR_RESET}" 1>&2
176+
cat ${SERVER_LOG} 1>&2
177177
RET=1
178178
else
179179
wait_for_model_stable ${SERVER_TIMEOUT}
180180
for model in "${bad_models[@]}"; do
181181
code=$(curl -s -o /dev/null -w "%{http_code}" localhost:8000/v2/models/${model}/ready)
182182
if [[ "${code}" == "200" ]]; then
183-
echo -e "${COLOR_ERROR}*** Negative model '${model}' unexpectedly loaded (ready)${COLOR_RESET}" &1>2
183+
echo -e "${COLOR_ERROR}*** Negative model '${model}' unexpectedly loaded (ready)${COLOR_RESET}" 1>&2
184184
RET=1
185185
else
186186
echo -e "${COLOR_INFO}*** Negative model '${model}' correctly failed to load${COLOR_RESET}"

qa/L0_torch_aoti/torch_aoti_infer_test.py

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -455,27 +455,36 @@ def test_many_concurrent_sequences(self):
455455
self.assertAlmostEqual(float(out[0, 0]), sums[s] + s, places=3)
456456

457457
def test_staggered_sequences(self):
458-
# Sequences of different lengths that start/end at different steps, so
459-
# batch slots are freed and reused. Each sequence's state is independent
460-
# and resets on its own START.
458+
# Sequences of different lengths begin and end at different ticks on a
459+
# shared timeline, so they overlap: some finish (freeing their batch
460+
# slot) while others stay live and new ones start into the freed slots.
461+
# Each sequence keeps independent state that resets on its own START.
462+
# plan: seq_id -> (first_tick, values)
461463
plans = {
462-
400: [1.0, 2.0], # short
463-
401: [3.0, 4.0, 5.0, 6.0], # long
464-
402: [10.0, 10.0, 10.0],
464+
400: (0, [1.0, 2.0]), # ticks 0-1
465+
401: (0, [3.0, 4.0, 5.0, 6.0]), # ticks 0-3
466+
402: (2, [10.0, 10.0, 10.0]), # ticks 2-4 (starts after 400 ends)
467+
403: (3, [7.0, 8.0]), # ticks 3-4
465468
}
469+
last_tick = max(start + len(values) - 1 for start, values in plans.values())
470+
running = {seq_id: 0.0 for seq_id in plans}
466471
with http.InferenceServerClient("localhost:8000") as client:
467-
for seq_id, steps in plans.items():
468-
running = 0.0
469-
for i, value in enumerate(steps):
470-
running += value
472+
for tick in range(last_tick + 1):
473+
for seq_id, (first_tick, values) in plans.items():
474+
idx = tick - first_tick
475+
if idx < 0 or idx >= len(values):
476+
continue # sequence not live at this tick
477+
running[seq_id] += values[idx]
471478
out = self._infer_step(
472479
client,
473480
seq_id=seq_id,
474-
value=value,
475-
start=(i == 0),
476-
end=(i == len(steps) - 1),
481+
value=values[idx],
482+
start=(idx == 0),
483+
end=(idx == len(values) - 1),
484+
)
485+
self.assertAlmostEqual(
486+
float(out[0, 0]), running[seq_id] + seq_id, places=3
477487
)
478-
self.assertAlmostEqual(float(out[0, 0]), running + seq_id, places=3)
479488

480489
def test_initial_state_sequence(self):
481490
# Model relies on a declared zero initial_state (no START reset). Output

0 commit comments

Comments
 (0)