[compiler-rt] [llvm] [InstrFDO]Allow indexed profile reader to parse compatible future versions and returns errors for incompatible ones. (PR #88212)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 7 13:29:31 PDT 2024


================
@@ -1172,7 +1173,19 @@ enum ProfVersion {
   Version11 = 11,
   // VTable profiling,
   Version12 = 12,
-  // The current version is 12.
+  // Additional fields for profile reader to have limited forward compatibility.
+  // 1. Records the byte size of the profile header. This allows profile reader
+  // to skip unknown new header fields (introduced in newer versions of
+  // profiles) and correctly locate the start of payload sections.
+  // 2. Records the minimum compatible version required from profile reader to
+  // parse the profiles in the correct semantic. Indexed profile reader compares
+  // the latest version it can parse with the minimum version required
+  // by the profile to decide if it can reasonably interpret the payload. If
+  // yes, it proceeds to parse known sections and skip new unknown sections;
+  // otherwise it stops reading and throws error. In the latter case, users
+  // should update the compilers or tools binary to support newer versions.
----------------
kazutakahirata wrote:

I'm not sure if this is the right place to document the benefits brought by your change.  I might just say something like:

```suggestion
  // Added limited forward compatibility.  See XYZ for details.
```

where `XYZ` needs to be replaced with a proper pointer.


https://github.com/llvm/llvm-project/pull/88212


More information about the llvm-commits mailing list