-
Notifications
You must be signed in to change notification settings - Fork 13.7k
TypeTree support in autodiff #144197
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
base: master
Are you sure you want to change the base?
TypeTree support in autodiff #144197
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Currently, I have implemented only for |
r? @ZuseZ4 |
Some changes occurred in compiler/rustc_ast/src/expand/autodiff_attrs.rs cc @ZuseZ4 Some changes occurred in compiler/rustc_codegen_llvm/src/builder/autodiff.rs cc @ZuseZ4 Some changes occurred in compiler/rustc_codegen_ssa Some changes occurred in compiler/rustc_monomorphize/src/partitioning/autodiff.rs cc @ZuseZ4 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Some changes occurred in compiler/rustc_codegen_gcc |
This comment has been minimized.
This comment has been minimized.
CI is failing, fixing them! |
Some changes occurred in src/tools/enzyme cc @ZuseZ4 |
This comment has been minimized.
This comment has been minimized.
d3f78d7
to
94aa8bc
Compare
This comment has been minimized.
This comment has been minimized.
- Fix nott-flag test to emit LLVM IR and check enzyme_type attributes - Replace TODO comments with actual TypeTree metadata verification - Test that NoTT flag properly disables TypeTree generation - Test that TypeTree enabled generates proper enzyme_type attributes Signed-off-by: Karan Janthe <karanjanthe@gmail.com>
- Add specific tests for f32, f64, i32, f16, f128 TypeTree generation - Verify correct enzyme_type metadata for each scalar type - Ensure TypeTree metadata matches expected Enzyme format Signed-off-by: Karan Janthe <karanjanthe@gmail.com>
363ee2c
to
9022aab
Compare
This PR was rebased onto a different master 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. |
This comment has been minimized.
This comment has been minimized.
c60c082
to
9176242
Compare
This comment has been minimized.
This comment has been minimized.
9176242
to
42e5fd3
Compare
This comment has been minimized.
This comment has been minimized.
what should i do? |
42e5fd3
to
2af958b
Compare
This comment has been minimized.
This comment has been minimized.
2af958b
to
a6a760a
Compare
This comment has been minimized.
This comment has been minimized.
a6a760a
to
0a9fd48
Compare
This comment has been minimized.
This comment has been minimized.
0a9fd48
to
dad733e
Compare
This comment has been minimized.
This comment has been minimized.
dad733e
to
0b45251
Compare
This comment has been minimized.
This comment has been minimized.
DT_Pointer = 2, | ||
DT_Half = 3, | ||
DT_Float = 4, | ||
DT_Double = 5, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd probably add f128 here on the Enzyme side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0b45251
to
2ed8528
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
b30a1de
to
4d6342e
Compare
typos.toml
Outdated
@@ -34,6 +34,7 @@ targetting = "targetting" | |||
publically = "publically" | |||
clonable = "clonable" | |||
moreso = "moreso" | |||
EnzymeTypeTreeShiftIndiciesEq = "EnzymeTypeTreeShiftIndiciesEq" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/.E2.9C.94.20tidy.20error.3A.20typo.20EnzymeTypeTreeShiftIndiciesEq.20to.20Enzym.2E.2E.2E/near/536350657: default.extend-identifiers block, not default.extend-words
4d6342e
to
5b781e9
Compare
TypeTrees for Autodiff
What are TypeTrees?
Memory layout descriptors for Enzyme. Tell Enzyme exactly how types are structured in memory so it can compute derivatives efficiently.
Structure
Example:
fn compute(x: &f32, data: &[f32]) -> f32
Input 0:
x: &f32
Input 1:
data: &[f32]
Output:
f32
Why Needed?
What Enzyme Does With This Information:
Without TypeTrees (current state):
With TypeTrees (our goal):
TypeTrees - Offset and -1 Explained
Type Structure
Offset Values
Regular Offset (0, 4, 8, etc.)
Specific byte position within a structure
TypeTree for
&Point
:Offset -1 (Special: "Everywhere")
Means "this pattern repeats for ALL elements"
Example 1: Array
[f32; 100]
Instead of listing 100 separate Types with offsets 0,4,8,12...396
Example 2: Slice
&[i32]
Example 3: Mixed Structure