Hello LLVM-Dev,
Today if a user checks out LLVM, configures with no options specified, and builds the result is non-deterministic. Meaning if you clean and build again the binaries are not identical. This impacts all target platforms equally and is caused by the default value of LLVM_ENABLE_TIMESTAMPS being On.
I believe this is incorrect behavior, and I’m curious what the wider community thinks.
It is my belief that the default LLVM configuration (meaning no options specified) should be deterministic, and that any option in our build/configuration system that can impact determinism should be disabled by default.
I would like to hold this as a central requirement for build system changes.
Thoughts?
-Chris
I don't think that "deterministic" is the right term (i.e. "current time" is an input of the build).
Last month I spent a few hours debugging this (was trying to assert some "NFC" changes), so I definitely agree with you that the "current time" being part of the input of the build by default is not great, and I support disabling this.
Mehdi Amini via llvm-dev <llvm-dev@lists.llvm.org> writes:
Chris Bieneman via llvm-dev <llvm-dev@lists.llvm.org> writes:
It is my belief that the default LLVM configuration (meaning no
options specified) should be deterministic, and that any option in our
build/configuration system that can impact determinism should be
disabled by default.
I don't think that "deterministic" is the right term (i.e. "current
time" is an input of the build).
Last month I spent a few hours debugging this (was trying to assert
some "NFC" changes), so I definitely agree with you that the "current
time" being part of the input of the build by default is not great,
and I support disabling this.
This is especially silly because we don't even use the timestamp for
anything particularly valuable - cl::opt just likes to include it in its
version output.
For this case I'd suggest we just remove the ENABLE_TIMESTAMPS option
entirely and stop using __DATE__ in CommandLine.cpp. If someone *really*
wants a timestamp in the version output of the llvm tools for some
reason they can inject one into LLVM_VERSION_INFO.
(and yes, I agree in general that it'd be nice if building the same
source twice gave the same results by default, so +1 to that)
I agree completely. I eventually found out how to disable timestamps in the build, but this should definitely be the default.
This is especially silly because we don't even use the timestamp for
anything particularly valuable - cl::opt just likes to include it in its
version output.
For this case I'd suggest we just remove the ENABLE_TIMESTAMPS option
entirely and stop using __DATE__ in CommandLine.cpp. If someone *really*
wants a timestamp in the version output of the llvm tools for some
reason they can inject one into LLVM_VERSION_INFO.
+1 for deleting the option.
Cheers,
Rafael
This is especially silly because we don't even use the timestamp for
anything particularly valuable - cl::opt just likes to include it in its
version output.
For this case I'd suggest we just remove the ENABLE_TIMESTAMPS option
entirely and stop using __DATE__ in CommandLine.cpp. If someone *really*
wants a timestamp in the version output of the llvm tools for some
reason they can inject one into LLVM_VERSION_INFO.
+1 for deleting the option.
Agreed. Nuke it from orbit.
The responses here are pretty one-sided.
What I’m going to do is make a commit to LLVM this afternoon to change the default for LLVM_ENABLE_TIMESTAMPS to Off. Separately I will send out a patch for review that removes the flag.
I will let that patch sit out on LLVM-Commits for a day or so to allow anyone who objects to the removal of the option to speak up.
Any objections?
-Chris