bootstrap: Enable rustdoc mergeable CCI for std and internal docs - #160098
bootstrap: Enable rustdoc mergeable CCI for std and internal docs#160098camelid wants to merge 5 commits into
Conversation
|
|
This comment has been minimized.
This comment has been minimized.
|
Let's try the main x64 Linux dist job, I will compare the docs build time before/after. Btw, it would be nice to add a comment on top of the added argument, which explains why is it there. @bors try jobs=dist-x86_64-linux |
This comment has been minimized.
This comment has been minimized.
bootstrap: Enable rustdoc mergeable CCI for std and internal docs try-job: dist-x86_64-linux
1696dc7 to
23a03ba
Compare
This comment has been minimized.
This comment has been minimized.
|
@GuillaumeGomez @notriddle do you think this failure is due to a bug in mergeable CCI? It's a little weird because it seems to pass on LLVM 22.2 but not 22.1 -- so could be spurious? But it's suspicious that it's related to the search index. |
|
I kinda doubt it is spurious. However, bootstrap does a lot of weird crimes related to the created and removal of various doc things being built in the |
|
Yes, I suspect it's a bug in rustdoc. It looks like the LLVM 22.2 CI disables js-std tests. |
|
Looks like it's actually a cargo bug, where cargo isn't passing the |
|
💔 Test for bf99269 failed: CI. Failed job:
|
This comment has been minimized.
This comment has been minimized.
|
The try build failure looks like it might be some different error, maybe related to some cursedness when documenting the standard library? |
This is an unresolved question. See rust-lang/cargo#17269 (comment) |
|
Came across another issue. Currently, when building compiler/tool docs, we do separate cargo invocations but have them all end up in the same output directory. So that rustc, rustdoc, cargo, clippy, etc. all share one docs site (/nightly/nightly-rustc). This works out of the box with legacy shared CCI because rustdoc updates the finalized artifacts with each build. However, with shared CCI, we run one finalize per docs target (i.e. one for rustc, one for rustdoc, one for clippy, etc.), which causes the CCI (crates.js, search-index, etc.) to be overwritten. I'm not sure what the best fix for this is. Ideally, we would probably have bootstrap tell Cargo to not run finalize for the intermediate targets and just do one finalize at the end. It also suggests that enabling mergeable CCI by default in Cargo is a moderately breaking change for workflows that depend on separate |
|
@notriddle @weihanglo do you have any thoughts about the above issue? |
There was a problem hiding this comment.
Came across another issue. Currently, when building compiler/tool docs, we do separate cargo invocations but have them all end up in the same output directory. So that rustc, rustdoc, cargo, clippy, etc. all share one docs site (/nightly/nightly-rustc). This works out of the box with legacy shared CCI because rustdoc updates the finalized artifacts with each build. However, with shared CCI, we run one finalize per docs target (i.e. one for rustc, one for rustdoc, one for clippy, etc.), which causes the CCI (crates.js, search-index, etc.) to be overwritten.
I'm not sure what the best fix for this is. Ideally, we would probably have bootstrap tell Cargo to not run finalize for the intermediate targets and just do one finalize at the end. It also suggests that enabling mergeable CCI by default in Cargo is a moderately breaking change for workflows that depend on separate
cargo docinvocations working well together.
Haven't checked how bootstrap builds docs, though I think it should just work, as cargo doc is additive (in order to follow how rustdoc works and keep backward-compat): https://github.com/rust-lang/cargo/blob/9c930d9f8d5ec08afd4bd69dbdcba2a336fbefe3/tests/testsuite/doc.rs#L3773-L3913
It might be possible that bootstrap is using -Zskip-rustdoc-fingerprint. See also rust-lang/cargo#9404
There was a problem hiding this comment.
Bootstrap is in fact using -Zskip-rustdoc-fingerprint. However, I think the issue is more fundamental than that because rustdoc assumes that finalize is always run exactly once per doc site. If you run finalize for rustc and then for a tool, it will just overwrite the shared files for rustc with ones specific to the tool.
There was a problem hiding this comment.
Not sure. I thought the feature was additive hence the test in Cargo (it ran cargo doc -p foo then -p dep and then -p bar sequentially).
If it were not they Cargo probably can't ship it as a default for backward compatibility reasons.
What are those shared files being overwritten? Were they safe-from-overwrite previously without -Zrustdoc-mergeable-info?
There was a problem hiding this comment.
The cargo test doesn't actually check the contents of the shared files as far as I can tell. Rustdoc is still additive for the crate docs (e.g. foo/struct.Bar.html will not be overwritten). But with mergeable CCI, sequential cargo doc invocations will clobber the shared files like the search index.
The shared files were deserialized, updated, and reserialized on every single rustdoc invocation before. With mergeable CCI, each crate's contribution to the CCI is serialized separately and the merge step combines them all into the final shared files. One possible fix for this backcompat issue is that the merge step could check for any existing shared files in the output directory and use those as the basis for its merge step. It would be nice to avoid that if we can though and have the merge be authoritative rather than being invoked any number of times.
As long as the same Cargo build directory is used for all three of these builds, that isn’t supposed to be a problem. The feature implements Did you try the feature and have it not work? |
|
Yes, I tried this branch locally with e.g. |
|
The specific problem is that merging assumes it is given all meta-dir inputs and does not import existing finalized outputs. Since bootstrap invokes |
That may be due to skipping rustdoc-fingeprint. The fingerprint file tracks previous rustdoc run in order to collect all mergeable info across multiple |
|
Hmm, so what is in rustdoc-fingerprint? Does it include all the meta dirs that were generated along the way? |
|
@weihanglo the index.html, settings.html, and some other root pages were not generated when doc merge finalize was run as a separate step. So that PR fixes it. |
This feature is unstable but will be stabilized soon, and this is a good way of dogfooding it to make sure it works properly. It should have no effect on the generated docs, but it provides a significant speedup. For example, I measure a 3x speedup locally (3m 11s -> 1m 1s) for `x doc src/tools` -- note that this is with the latest rustdoc perf improvements (PR 159854).
23a03ba to
a34d83a
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
Will start a try job once CI passes. Or if you get to it before me, please run |
|
@bors try |
This comment has been minimized.
This comment has been minimized.
bootstrap: Enable rustdoc mergeable CCI for std and internal docs
|
@Kobzol isn't that the wrong try job? |
|
It is 😆 Thanks. @bors try jobs=dist-x86_64-linux |
This comment has been minimized.
This comment has been minimized.
bootstrap: Enable rustdoc mergeable CCI for std and internal docs try-job: dist-x86_64-linux
|
💔 Test for 7d8ef04 failed: CI. Failed job:
|
|
Good ol' GitHub Actions... seems like there's some 500s. |
This comment has been minimized.
This comment has been minimized.
|
Oh, wait, I guess we still need to fix the issue caused by bootstrap's weird symlinking of different doc directories. @notriddle is working on a patch. |
We never run `x check` on RustcDoc. We only use it for docs.
|
@bors try jobs=dist-x86_64-linux |
This comment has been minimized.
This comment has been minimized.
bootstrap: Enable rustdoc mergeable CCI for std and internal docs try-job: dist-x86_64-linux
This comment has been minimized.
This comment has been minimized.
|
💔 Test for 661fd6f failed: CI. Failed job:
|
This comment has been minimized.
This comment has been minimized.
|
I wonder if it makes sense to split off another PR that enables the feature just for std -- that way we can start dogfooding it before the whole bootstrap mess is fixed? |
|
I tend to prefer incremental over "all at once" but up to you. |
I know that this change causes `doc` to build compiler stuff before building docs for bootstrap. This just reduces the combinatorics that we have to deal with.
|
The job Click to see the possible cause of the failure (guessed by this bot) |
View all comments
This feature is unstable but will be stabilized soon, and this is a good way of dogfooding it to make sure it works properly. It should have no effect on the generated docs, but it provides a significant speedup. For example, I measure a 3x speedup locally (3m 11s -> 1m 1s) for
x doc src/tools-- note that this is with the latest rustdoc perf improvements (#159854).r? @Kobzol