Hi,
We would like to add a version number to the bitcode wrapper. This feature would allow easier identification of what compiler produced the bitcode so that known incompatibilities with LTO compilation could be detected. Roughly speaking, this version number would consist of the major, minor and optionally the patch version of the compiler used to produce the bitcode. The version information would be encoded in 4 bytes, with the first byte representing the major version number, the second byte the minor version number, and the third and fourth bytes optionally encoding the patch version or other information. As to where to place this information, we are considering two different possibilities for updating the bitcode wrapper specification.
The first is to simply add a single 32bit wide field at the end of the existing bitcode wrapper format field. This would result in the new structure looking like this:
[Magic_{32}, Version_{32}, Offset_{32}, Size_{32}, CPUType_{32}, BitcodeVersion_{32}]
All of the existing fields would keep their current meanings, and the new field BitcodeVersion is simply appended with the format described in the first paragraph.
A second idea was to use the existing Version field in the bitcode wrapper format to store the bitcode version information. According to the documentation (http://llvm.org/docs/BitCodeFormat.html#bitcode-wrapper-format)
this field is currently always set to 0. This would allow us to make use of what is (presumably) an unused field.
As this is a feature that we feel would be beneficial to the community, we wanted to get feedback on the design for our upcoming patches. Any thoughts or opinions on this would be greatly appreciated.
Thanks!
Douglas Yung
_______________________________________________
LLVM Developers mailing list
LLV...@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Sorry if I was unclear. There are currently no “known incompatibilities” that I am aware of, although I fully admit to not being an expert on the topic. The idea is that we add versioning information to the bitcode so that if an issue were discovered, it could be easily detected and dealt with.
Douglas Yung
Sorry if I was unclear. There are currently no “known incompatibilities” that I am aware of, although I fully admit to not being an expert on the topic. The idea is that we add versioning information to the bitcode so that if an issue were discovered, it could be easily detected and dealt with.
_______________________________________________
cfe-dev mailing list
cfe...@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
How is this use case different from the LTO-supported toolchains shipped by other vendors such as Apple? Do they have this theoretical problem too?If the issue is solely constrained to debug info metadata, then why not use metadata to describe the format/version of the debug info?
I think the "at least for the current major version" part is one thing that concerns us. LLVM 4.0 will promise to read LLVM 3.4 bitcode, but LLVM 4.1 will not, according to my understanding of the current promise. Smoothly identifying that point and being able to provide an intelligent diagnostic seems like goodness. Hard to distinguish "old" bitcode from "broken" bitcode without recording version info of some kind, and the sooner we start recording the version number the more completely we're able to diagnose the situation properly when the time comes.
--paulr
It is a compiler IR but with LTO we need backward compatibility for IR in object files. This is not a new requirement. We have required auto-upgrade support for old bitcode files for as long as I have worked on LLVM for exactly this reason. The testing to enforce that has been pretty minimal, but we’re now making an effort to be more systematic about it.
By all means, I think we're on the same page as far as testing and the
burden of keeping the compatibility, I just didn't remember it being
such a big requirement.
Maybe I'm making a bigger issue than it needs to be... which is
actually quite likely. :)
cheers,
--renato
Except, backward compatibility breaks are allowed at major versions.
See, for example, the type system rewrite.
-eric
Hi –
I realize the thread has drifted a little, but I wanted to get back to my original proposal. I would like to make a change to the bitcode file wrapper to include the version of llvm that produced the bitcode. I would like to write this version into the unused version field that currently exists. Would there be any objections to this change?
Since the original wrapper is only emitted for Darwin targets, I ran an experiment where I took bitcode files produced by the official Apple tools and then modified the version field to be non-zero. From my simple tests, there seemed to be no problems with existing tools when the version field is non-zero.
Douglas Yung
Hi –
I realize the thread has drifted a little, but I wanted to get back to my original proposal. I would like to make a change to the bitcode file wrapper to include the version of llvm that produced the bitcode. I would like to write this version into the unused version field that currently exists. Would there be any objections to this change?
One advantage to including the minor version number is that it allows the IR to evolve in more flexible ways (semantic difference without a syntactic difference) but auto-upgrade stays feasible. That is, it can help *avoid* breakages.
Another advantage would be for cases like debug-info metadata, where IIRC there's no backward compatibility at all; we just throw away old stuff. If we had a minor version in there, it becomes more reasonable to support one-minor-version backward compatibility. (This is a use case that we would be interested in.)
--paulr
One advantage to including the minor version number is that it allows the IR to evolve in more flexible ways (semantic difference without a syntactic difference) but auto-upgrade stays feasible. That is, it can help *avoid* breakages.
Another advantage would be for cases like debug-info metadata, where IIRC there's no backward compatibility at all; we just throw away old stuff. If we had a minor version in there, it becomes more reasonable to support one-minor-version backward compatibility. (This is a use case that we would be interested in.)
This just isn't something we're willing to support now.
-eric