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

Document the most important API functions #495

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Document the most important API functions #495

wants to merge 4 commits into from

Conversation

ZuseZ4
Copy link
Member

@ZuseZ4 ZuseZ4 commented Feb 6, 2022

Just to get started, should be improved further.
Feel free to update this branch directly.

@ZuseZ4 ZuseZ4 changed the title Document the most important functions Document the most important API functions Feb 6, 2022
@ZuseZ4 ZuseZ4 requested a review from wsmoses February 6, 2022 20:40
@@ -117,13 +117,42 @@ typedef enum {
DEM_ForwardModeSplit = 4,
} CDerivativeMode;

/// Generates a new function based on the input, which uses forward-mode AD.
///
Copy link
Member

@wsmoses wsmoses Feb 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to document the formal function: https://enzyme.mit.edu/doxygen/classEnzymeLogic.html#a8e6ba5c54950f1ebcdfcbd7ce2a16083

I'm slightly inclined to have the C API documentation be light, and instead forward one to see the C++ function which it wraps (this applies to all of the functions in the C API)

/// Based on the
/// @param retType: When returning f32/f64 we might use DFT_OUT_DIFF.
/// When returning anything else, one should use DFT_CONSTANT
/// @param width: currently only supporting width=1 here
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't add this as a comment here, and instead describe what width should do.

/// Generates a new function based on the input, which uses reverse-mode AD.
///
/// Based on the
/// @param retType: When returning f32/f64 we might use DFT_OUT_DIFF.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use llvm type names here: float/double. We also would want to state the general rule that out_diff is used when the value being differentiated is being passed as a register (examples being float double, a vector of these, an llvm.struct of these, etc) rather than through memory (e.g. a pointer)

/// @param retType: DFT_DUP_ARG, DFT_CONSTANT
/// @param constant_args: pointing to combinations of DFT_DUP_ARG and
/// DFT_CONSTANT
/// @param forceAnonymousTape: TODO
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per https://enzyme.mit.edu/doxygen/classEnzymeLogic.html#a8e6ba5c54950f1ebcdfcbd7ce2a16083, forceAnonymousTape forces the tape to be an i8* rather than the true tape.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants