Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc_codegen_ssa/src/traits/autodiff.rs #2

Closed
ZuseZ4 opened this issue May 5, 2022 · 0 comments
Closed

rustc_codegen_ssa/src/traits/autodiff.rs #2

ZuseZ4 opened this issue May 5, 2022 · 0 comments
Assignees

Comments

@ZuseZ4
Copy link
Member

ZuseZ4 commented May 5, 2022

We can change it later, but still should try to get it right in the first run.
The larger design limitation will anyway be the user-facing ad macro, which limits which information we get.
We can take some inspiration from other traits like CoverageInfo, AsmBuilderMethods, which are implemented in both gcc and llvm.

Motivation:
Allow adding AD support for different codegen backends.
cg_llvm will be the first user, cg_cuda probably next.
We should keep in mind other possible ad tools (e.g. gcc based), as well as a possible MIR based ad tool.
The last one would be feature wise an awesome fallback, even if it can't compete performance-wise with backend based AD tools.

Assumptions:

  • No integer ad
  • Only Forward and Reverse Mode (or combinations), ignore theoretically possible other evaluation orders.
  • Add explicit support for higher orders, allowing ad tools to use possibly more efficient implementations.

Some inspiration: https://jax.readthedocs.io/en/latest/notebooks/autodiff_cookbook.html

There are a few things to keep in mind for the Design:

  • Checkpointing, possibly as a non-exhaustive enum? It should always be safe for a backend to ignore it.
  • Vectorization information (width). Always pass as a NonZeroUnsignedInteger?
  • Custom derivatives.
  • (minor): Don't block parallel fnc generations from Enzyme.
@ZuseZ4 ZuseZ4 closed this as completed Jan 18, 2023
ZuseZ4 pushed a commit that referenced this issue Mar 7, 2023
* add version for llvm info

* Ensure relative paths

* Fix naming scheme
bytesnake pushed a commit that referenced this issue May 27, 2023
…t, r=tmiasko

Encode def span for foreign return-position `impl Trait` in trait

Fixes rust-lang#111031, yet another def-span encoding issue :/

Includes a smaller repro than the issue, but I can confirm it ICEs:

```
query stack during panic:
#0 [def_span] looking up span for `rpitit::Foo::bar::{opaque#0}`
#1 [object_safety_violations] determining object safety of trait `rpitit::Foo`
#2 [check_is_object_safe] checking if trait `rpitit::Foo` is object safe
#3 [typeck] type-checking `main`
#4 [used_trait_imports] finding used_trait_imports `main`
#5 [analysis] running analysis passes on this crate
```

Luckily since this only affects nightly, this desn't need to be backported.
ZuseZ4 pushed a commit that referenced this issue Nov 21, 2024
…t-2, r=nikomatsakis

Reduce false positives of tail-expr-drop-order from consumed values (attempt #2)

r? `@nikomatsakis`

Tracked by rust-lang#123739.

Related to rust-lang#129864 but not replacing, yet.

Related to rust-lang#130836.

This is an implementation of the approach suggested in the [Zulip stream](https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/temporary.20drop.20order.20changes). A new MIR statement `BackwardsIncompatibleDrop` is added to the MIR syntax. The lint now works by inspecting possibly live move paths before at the `BackwardsIncompatibleDrop` location and the actual drop under the current edition, which should be one before Edition 2024 in practice.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants