vit.cpp icon indicating copy to clipboard operation
vit.cpp copied to clipboard

FIX: ggml_time_init() before ggml_time_us()

Open SHsari opened this issue 5 months ago • 0 comments

main.cpp fix

Initialize GGML timer before first use to prevent divide‑by‑zero crash on Windows

ggml_time_us() divides by timer_freq, which is set in ggml_time_init(). When main() called ggml_time_us() before that initialization, timer_freq == 0, causing a STATUS_INTEGER_DIVIDE_BY_ZERO (0xC0000094) crash on Windows/MinGW.

at the very top of main(). The first line safely sets timer_freq; the second keeps behaviour identical by recording the start timestamp.

Result

ViT CLI no longer crashes with exit code –1073741676.

--help, inference, and verbose timing output all work as expected on Windows/MinGW, Linux, and macOS.

No other code paths are affected.

SHsari avatar Jul 28 '25 09:07 SHsari