Skip to content

Commit 6347eaf

Browse files
authored
Merge pull request rust-lang#4608 from rust-lang/rustup-2025-09-29
Automatic Rustup
2 parents 264162e + 14d02ab commit 6347eaf

File tree

193 files changed

+3358
-1241
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+3358
-1241
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ bootstrapping, the compiler architecture, source code representation, and more.
3131

3232
## [Getting help](https://rustc-dev-guide.rust-lang.org/getting-started.html#asking-questions)
3333

34-
There are many ways you can get help when you're stuck. Rust has many platforms for this:
35-
[internals], [rust-zulip], and [rust-discord]. It is recommended to ask for help on
34+
There are many ways you can get help when you're stuck. Rust has two platforms for this:
35+
[internals] and [rust-zulip]. It is recommended to ask for help on
3636
the [rust-zulip], but any of these platforms are great ways to seek help and even
3737
find a mentor! You can learn more about asking questions and getting help in the
3838
[Asking Questions](https://rustc-dev-guide.rust-lang.org/getting-started.html#asking-questions) chapter of the [rustc-dev-guide].
@@ -47,5 +47,4 @@ refer to [this section][contributing-bug-reports] and [open an issue][issue temp
4747
[contributing-bug-reports]: https://rustc-dev-guide.rust-lang.org/contributing.html#bug-reports
4848
[issue template]: https://github.com/rust-lang/rust/issues/new/choose
4949
[internals]: https://internals.rust-lang.org
50-
[rust-discord]: http://discord.gg/rust-lang
5150
[rust-zulip]: https://rust-lang.zulipchat.com

Cargo.lock

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,10 @@ dependencies = [
334334
"anyhow",
335335
"build_helper",
336336
"curl",
337+
"hex",
337338
"indexmap",
338339
"serde",
340+
"sha2",
339341
"toml 0.8.23",
340342
]
341343

@@ -5239,9 +5241,9 @@ dependencies = [
52395241

52405242
[[package]]
52415243
name = "stringdex"
5242-
version = "0.0.1-alpha9"
5244+
version = "0.0.1-alpha10"
52435245
source = "registry+https://github.com/rust-lang/crates.io-index"
5244-
checksum = "7081029913fd7d591c0112182aba8c98ae886b4f12edb208130496cd17dc3c15"
5246+
checksum = "0fa846a7d509d1828a4f90962dc09810e161abcada7fc6a921e92c168d0811d7"
52455247
dependencies = [
52465248
"stacker",
52475249
]

bootstrap.example.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -768,16 +768,15 @@
768768
# make this default to false.
769769
#rust.lld = false in all cases, except on `x86_64-unknown-linux-gnu` as described above, where it is true
770770

771-
# Indicates whether LLD will be used to link Rust crates during bootstrap on
772-
# supported platforms.
771+
# Indicates if we should override the linker used to link Rust crates during bootstrap to be LLD.
773772
# If set to `true` or `"external"`, a global `lld` binary that has to be in $PATH
774773
# will be used.
775774
# If set to `"self-contained"`, rust-lld from the snapshot compiler will be used.
776775
#
777776
# On MSVC, LLD will not be used if we're cross linking.
778777
#
779778
# Explicitly setting the linker for a target will override this option when targeting MSVC.
780-
#rust.use-lld = false
779+
#rust.bootstrap-override-lld = false
781780

782781
# Indicates whether some LLVM tools, like llvm-objdump, will be made available in the
783782
# sysroot.
@@ -950,7 +949,7 @@
950949
# Linker to be used to bootstrap Rust code. Note that the
951950
# default value is platform specific, and if not specified it may also depend on
952951
# what platform is crossing to what platform.
953-
# Setting this will override the `use-lld` option for Rust code when targeting MSVC.
952+
# Setting this will override the `bootstrap-override-lld` option for Rust code when targeting MSVC.
954953
#linker = "cc" (path)
955954

956955
# Should rustc and the standard library be built with split debuginfo? Default

compiler/rustc_ast/src/expand/autodiff_attrs.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use std::fmt::{self, Display, Formatter};
77
use std::str::FromStr;
88

9+
use crate::expand::typetree::TypeTree;
910
use crate::expand::{Decodable, Encodable, HashStable_Generic};
1011
use crate::{Ty, TyKind};
1112

@@ -84,6 +85,8 @@ pub struct AutoDiffItem {
8485
/// The name of the function being generated
8586
pub target: String,
8687
pub attrs: AutoDiffAttrs,
88+
pub inputs: Vec<TypeTree>,
89+
pub output: TypeTree,
8790
}
8891

8992
#[derive(Clone, Eq, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
@@ -275,14 +278,22 @@ impl AutoDiffAttrs {
275278
!matches!(self.mode, DiffMode::Error | DiffMode::Source)
276279
}
277280

278-
pub fn into_item(self, source: String, target: String) -> AutoDiffItem {
279-
AutoDiffItem { source, target, attrs: self }
281+
pub fn into_item(
282+
self,
283+
source: String,
284+
target: String,
285+
inputs: Vec<TypeTree>,
286+
output: TypeTree,
287+
) -> AutoDiffItem {
288+
AutoDiffItem { source, target, inputs, output, attrs: self }
280289
}
281290
}
282291

283292
impl fmt::Display for AutoDiffItem {
284293
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
285294
write!(f, "Differentiating {} -> {}", self.source, self.target)?;
286-
write!(f, " with attributes: {:?}", self.attrs)
295+
write!(f, " with attributes: {:?}", self.attrs)?;
296+
write!(f, " with inputs: {:?}", self.inputs)?;
297+
write!(f, " with output: {:?}", self.output)
287298
}
288299
}

compiler/rustc_ast/src/expand/typetree.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub enum Kind {
3131
Half,
3232
Float,
3333
Double,
34+
F128,
3435
Unknown,
3536
}
3637

compiler/rustc_codegen_gcc/src/builder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,6 +1383,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
13831383
_src_align: Align,
13841384
size: RValue<'gcc>,
13851385
flags: MemFlags,
1386+
_tt: Option<rustc_ast::expand::typetree::FncTree>, // Autodiff TypeTrees are LLVM-only, ignored in GCC backend
13861387
) {
13871388
assert!(!flags.contains(MemFlags::NONTEMPORAL), "non-temporal memcpy not supported");
13881389
let size = self.intcast(size, self.type_size_t(), false);

compiler/rustc_codegen_gcc/src/intrinsic/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,7 @@ impl<'gcc, 'tcx> ArgAbiExt<'gcc, 'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
770770
scratch_align,
771771
bx.const_usize(self.layout.size.bytes()),
772772
MemFlags::empty(),
773+
None,
773774
);
774775

775776
bx.lifetime_end(scratch, scratch_size);

compiler/rustc_codegen_llvm/src/abi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ impl<'ll, 'tcx> ArgAbiExt<'ll, 'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
246246
scratch_align,
247247
bx.const_usize(copy_bytes),
248248
MemFlags::empty(),
249+
None,
249250
);
250251
bx.lifetime_end(llscratch, scratch_size);
251252
}

compiler/rustc_codegen_llvm/src/back/lto.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,8 @@ fn enable_autodiff_settings(ad: &[config::AutoDiff]) {
563563
config::AutoDiff::Enable => {}
564564
// We handle this below
565565
config::AutoDiff::NoPostopt => {}
566+
// Disables TypeTree generation
567+
config::AutoDiff::NoTT => {}
566568
}
567569
}
568570
// This helps with handling enums for now.

compiler/rustc_codegen_llvm/src/builder.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use std::borrow::{Borrow, Cow};
22
use std::ops::Deref;
33
use std::{iter, ptr};
44

5+
use rustc_ast::expand::typetree::FncTree;
56
pub(crate) mod autodiff;
67
pub(crate) mod gpu_offload;
78

@@ -1107,11 +1108,12 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
11071108
src_align: Align,
11081109
size: &'ll Value,
11091110
flags: MemFlags,
1111+
tt: Option<FncTree>,
11101112
) {
11111113
assert!(!flags.contains(MemFlags::NONTEMPORAL), "non-temporal memcpy not supported");
11121114
let size = self.intcast(size, self.type_isize(), false);
11131115
let is_volatile = flags.contains(MemFlags::VOLATILE);
1114-
unsafe {
1116+
let memcpy = unsafe {
11151117
llvm::LLVMRustBuildMemCpy(
11161118
self.llbuilder,
11171119
dst,
@@ -1120,7 +1122,16 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
11201122
src_align.bytes() as c_uint,
11211123
size,
11221124
is_volatile,
1123-
);
1125+
)
1126+
};
1127+
1128+
// TypeTree metadata for memcpy is especially important: when Enzyme encounters
1129+
// a memcpy during autodiff, it needs to know the structure of the data being
1130+
// copied to properly track derivatives. For example, copying an array of floats
1131+
// vs. copying a struct with mixed types requires different derivative handling.
1132+
// The TypeTree tells Enzyme exactly what memory layout to expect.
1133+
if let Some(tt) = tt {
1134+
crate::typetree::add_tt(self.cx().llmod, self.cx().llcx, memcpy, tt);
11241135
}
11251136
}
11261137

0 commit comments

Comments
 (0)