-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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! |
// For now, we just ignore the TypeTree since gcc backend doesn't support autodiff yet | ||
// When autodiff support is added to gcc backend, this should attach TypeTree information | ||
// as function attributes similar to how LLVM backend does it. | ||
} | ||
// TODO(antoyo): handle aligns and is_volatile. |
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.
Could you please move this comment right above the call to new_call()
?
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.
@KMJ-007 The TODO might be a bit too ambitious, I don't think anyone is currently working on autodiff for GCC,so I would just remove it and the code change. Also, even if they want to add it one day, they should rather do it from scratch to be able to learn some lessons from Enzyme, so I'm not sure if TypeTrees would even be a thing for them.
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.
Oh, I was talking about the existing TODO:
// TODO(antoyo): handle aligns and is_volatile.
I would like it to stay where it was before this change.
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.
@KMJ-007 The TODO might be a bit too ambitious, I don't think anyone is currently working on autodiff for GCC,so I would just remove it and the code change. Also, even if they want to add it one day, they should rather do it from scratch to be able to learn some lessons from Enzyme, so I'm not sure if TypeTrees would even be a thing for them.
I added it for temp, because CI was failing for gcc, i think i shouldn't have changed memcpy for gcc, but somewhere they are sharing the same trait or struct, I don't remember exactly, but will look into it again, and handle the changes so we don't break gcc or change it
Some changes occurred in src/tools/enzyme cc @ZuseZ4 |
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Karan Janthe <[email protected]>
Signed-off-by: Karan Janthe <[email protected]>
Signed-off-by: Karan Janthe <[email protected]>
Signed-off-by: Karan Janthe <[email protected]>
Signed-off-by: Karan Janthe <[email protected]>
Signed-off-by: Karan Janthe <[email protected]>
Signed-off-by: Karan Janthe <[email protected]>
Signed-off-by: Karan Janthe <[email protected]>
Signed-off-by: Karan Janthe <[email protected]>
d3f78d7
to
94aa8bc
Compare
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Karan Janthe <[email protected]>
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Karan Janthe <[email protected]>
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Karan Janthe <[email protected]>
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Karan Janthe <[email protected]>
The job Click to see the possible cause of the failure (guessed by this bot)
|
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