Closed dbechrd closed 4 years ago
Tracy on Windows is compiled with AVX2 by default, to take advantage of the ISA, where possible. This includes automatic usage of new instructions, or loop vectorization by the compiler. AVX2 is available in CPUs since 2013, so it's pretty safe to use it.
In case of older CPUs you can always change the max allowed ISA and recompile, just as you did.
There is a failsafe in the code to instruct you to that (winmain.cpp
), but it failed to fire up, due to static initialization being executed before WinMain()
is reached. This has been fixed in 21ddd0a820.
Documentation has been expanded in 634b0933.
Excellent work. 💯
tl;dr
Tracy.exe in v0.7 release requires your CPU to support AVX2, which is not documented in the README, nor the User Manual as far as I can tell.
Details about how difficult it was to discover this
When run via double-click, the precompiled binary,
Tracy.exe
, provided in the v0.7 release (note: I have not tested any prior release) silently fails and immediately terminates on my machine.Of course the next thing I tried was running from a command line:
It took me a while to understand that this was referring to a literal assembly instruction rather than a Tracy-specific error, as I had never seen or heard of this before, nor does Windows make it terribly apparent that this is an exception.
I decided to clone the repo and compile the
profiler/build/win32/Tracy.sln
project myself to see if I could repro. Indeed, it immediately threw an illegal instruction exception attracy_xxh3.h:625
which is this line in the xxHash3 source:I did some Googling and found this StackOverflow answer which states (with regard to an unrelated program):
I verified the via the dissasembly that there was indeed a
SHRX
(shift right instead of left) instruction present, causing the exception.As the SO user suggested, I changed the "Enable Enhanced Instruction Set" setting from
Advanced Vector Extensions 2 (/arch:AVX2)
toAdvanced Vector Extensions (/arch:AVX)
and recompiled. I can verify that Tracy.exe now starts and runs as expected.I am running an Intel Core i5 2500K, but I suspect this issue will manifest in a similar way on any machine that does not support AVX2. I'm not certain if xxHash3 is your only dependency on AVX2, or if you're using it elsewhere. Either way, it would be very useful to provide guidance in the documentation about this dependency and how to change the project settings to support slightly older CPUs.
I'm not qualified to do any performance testing to understand exactly how this affects Tracy's performance, but there are likely existing benchmarks for xxHash3 if that is the only reason you're using AVX2.
Thanks for your time. This is a very intriguing project and the User Manual is a most excellent read. -Dan