Skip to content

Commit bdc5ecb

Browse files
authored
Cast bounds type in tests to func def: latency, interToken, and timeToFirst (to int) (#163)
* Cast bounds type in tests to func def: latency, interToken, and timeToFirst (to int) Signed-off-by: Qifan Deng <[email protected]> * Use float 32 Signed-off-by: Qifan Deng <[email protected]> --------- Signed-off-by: Qifan Deng <[email protected]>
1 parent 1cdd97e commit bdc5ecb

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

pkg/llm-d-inference-sim/simulator_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -761,8 +761,8 @@ var _ = Describe("Simulator", func() {
761761
simulator.config.InterTokenLatency = interTokenLatency
762762
simulator.config.InterTokenLatencyStdDev = stddev
763763
interToken := simulator.getInterTokenLatency()
764-
Expect(interToken).To(BeNumerically(">=", float32(interTokenLatency)*0.3))
765-
Expect(interToken).To(BeNumerically("<=", float32(interTokenLatency)*1.7))
764+
Expect(interToken).To(BeNumerically(">=", int(float32(interTokenLatency)*0.3)))
765+
Expect(interToken).To(BeNumerically("<=", int(float32(interTokenLatency)*1.7)))
766766
},
767767
func(interTokenLatency int, stddev int) string {
768768
return fmt.Sprintf("interTokenLatency: %d stddev: %d", interTokenLatency, stddev)
@@ -778,8 +778,8 @@ var _ = Describe("Simulator", func() {
778778
simulator.config.InterTokenLatency = interTokenLatency
779779
simulator.config.InterTokenLatencyStdDev = stddev
780780
latency := simulator.getTotalInterTokenLatency(numberOfTokens)
781-
Expect(latency).To(BeNumerically(">=", float32(interTokenLatency)*0.3*float32(numberOfTokens)))
782-
Expect(latency).To(BeNumerically("<=", float32(interTokenLatency)*1.7*float32(numberOfTokens)))
781+
Expect(latency).To(BeNumerically(">=", int(float32(interTokenLatency)*0.3*float32(numberOfTokens))))
782+
Expect(latency).To(BeNumerically("<=", int(float32(interTokenLatency)*1.7*float32(numberOfTokens))))
783783
},
784784
func(interTokenLatency int, stddev int, numberOfTokens int) string {
785785
return fmt.Sprintf("interTokenLatency: %d stddev: %d, numberOfTokens: %d", interTokenLatency,
@@ -800,11 +800,11 @@ var _ = Describe("Simulator", func() {
800800
simulator.config.KVCacheTransferLatencyStdDev = kvCacheLatencyStdDev
801801
timeToFirst := simulator.getTimeToFirstToken(doREmotePrefill)
802802
if doREmotePrefill {
803-
Expect(timeToFirst).To(BeNumerically(">=", float32(kvCacheLatency)*0.3))
804-
Expect(timeToFirst).To(BeNumerically("<=", float32(kvCacheLatency)*1.7))
803+
Expect(timeToFirst).To(BeNumerically(">=", int(float32(kvCacheLatency)*0.3)))
804+
Expect(timeToFirst).To(BeNumerically("<=", int(float32(kvCacheLatency)*1.7)))
805805
} else {
806-
Expect(timeToFirst).To(BeNumerically(">=", float32(timeToFirstToken)*0.3))
807-
Expect(timeToFirst).To(BeNumerically("<=", float32(timeToFirstToken)*1.7))
806+
Expect(timeToFirst).To(BeNumerically(">=", int(float32(timeToFirstToken)*0.3)))
807+
Expect(timeToFirst).To(BeNumerically("<=", int(float32(timeToFirstToken)*1.7)))
808808
}
809809
},
810810
func(timeToFirstToken int, timeToFirstTokenStdDev int,

0 commit comments

Comments
 (0)