Skip to content

Commit 1e008dd

Browse files
committed
Auto merge of rust-lang#139396 - Zalathar:rollup-lmoqvru, r=Zalathar
Rollup of 11 pull requests Successful merges: - rust-lang#136457 (Expose algebraic floating point intrinsics) - rust-lang#137880 (Autodiff batching) - rust-lang#137897 (fix pthread-based tls on apple targets) - rust-lang#138024 (Allow optimizing out `panic_bounds_check` in Unicode checks.) - rust-lang#138546 (Add integer to string formatting tests) - rust-lang#138826 (StableMIR: Add `associated_items`.) - rust-lang#138950 (replace extra_filename with strict version hash in metrics file names) - rust-lang#139274 (Rustdoc: typecheck settings.js) - rust-lang#139285 (use lower case to match other error messages) - rust-lang#139341 (Apply `Recovery::Forbidden` when reparsing pasted macro fragments.) - rust-lang#139389 (make `Arguments::as_statically_known_str` doc(hidden)) r? `@ghost` `@rustbot` modify labels: rollup
2 parents bad13a9 + e31ce50 commit 1e008dd

File tree

74 files changed

+2264
-482
lines changed

Some content is hidden

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

74 files changed

+2264
-482
lines changed

compiler/rustc_ast/src/expand/autodiff_attrs.rs

+13
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,17 @@ pub struct AutoDiffAttrs {
7777
/// e.g. in the [JAX
7878
/// Documentation](https://jax.readthedocs.io/en/latest/_tutorials/advanced-autodiff.html#how-it-s-made-two-foundational-autodiff-functions).
7979
pub mode: DiffMode,
80+
/// A user-provided, batching width. If not given, we will default to 1 (no batching).
81+
/// Calling a differentiated, non-batched function through a loop 100 times is equivalent to:
82+
/// - Calling the function 50 times with a batch size of 2
83+
/// - Calling the function 25 times with a batch size of 4,
84+
/// etc. A batched function takes more (or longer) arguments, and might be able to benefit from
85+
/// cache locality, better re-usal of primal values, and other optimizations.
86+
/// We will (before LLVM's vectorizer runs) just generate most LLVM-IR instructions `width`
87+
/// times, so this massively increases code size. As such, values like 1024 are unlikely to
88+
/// work. We should consider limiting this to u8 or u16, but will leave it at u32 for
89+
/// experiments for now and focus on documenting the implications of a large width.
90+
pub width: u32,
8091
pub ret_activity: DiffActivity,
8192
pub input_activity: Vec<DiffActivity>,
8293
}
@@ -222,13 +233,15 @@ impl AutoDiffAttrs {
222233
pub const fn error() -> Self {
223234
AutoDiffAttrs {
224235
mode: DiffMode::Error,
236+
width: 0,
225237
ret_activity: DiffActivity::None,
226238
input_activity: Vec::new(),
227239
}
228240
}
229241
pub fn source() -> Self {
230242
AutoDiffAttrs {
231243
mode: DiffMode::Source,
244+
width: 0,
232245
ret_activity: DiffActivity::None,
233246
input_activity: Vec::new(),
234247
}

compiler/rustc_ast_lowering/src/item.rs

-3
Original file line numberDiff line numberDiff line change
@@ -676,12 +676,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
676676
let ty =
677677
self.lower_ty(ty, ImplTraitContext::Disallowed(ImplTraitPosition::StaticTy));
678678
let safety = self.lower_safety(*safety, hir::Safety::Unsafe);
679-
680-
// njn: where for this?
681679
if define_opaque.is_some() {
682680
self.dcx().span_err(i.span, "foreign statics cannot define opaque types");
683681
}
684-
685682
(ident, hir::ForeignItemKind::Static(ty, *mutability, safety))
686683
}
687684
ForeignItemKind::TyAlias(box TyAlias { ident, .. }) => {

compiler/rustc_builtin_macros/messages.ftl

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ builtin_macros_autodiff_ret_activity = invalid return activity {$act} in {$mode}
7979
builtin_macros_autodiff_ty_activity = {$act} can not be used for this type
8080
builtin_macros_autodiff_unknown_activity = did not recognize Activity: `{$act}`
8181
82+
builtin_macros_autodiff_width = autodiff width must fit u32, but is {$width}
8283
builtin_macros_bad_derive_target = `derive` may only be applied to `struct`s, `enum`s and `union`s
8384
.label = not applicable here
8485
.label2 = not a `struct`, `enum` or `union`

0 commit comments

Comments
 (0)