Skip to content

Commit

Permalink
Rearrange Expression contents to avoid 8 bytes of padding
Browse files Browse the repository at this point in the history
  • Loading branch information
calcmogul committed Apr 5, 2024
1 parent 1ed64b4 commit 80d9e07
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions include/sleipnir/autodiff/Expression.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ struct SLEIPNIR_DLLEXPORT Expression {

/// Tracks the number of instances of this expression yet to be encountered in
/// an expression tree.
int duplications = 0;
uint32_t duplications = 0;

/// This expression's row in wrt for autodiff gradient, Jacobian, or Hessian.
/// This is -1 if the expression isn't in wrt.
int row = -1;
int32_t row = -1;

/// The adjoint of the expression node used during gradient expression tree
/// generation.
Expand All @@ -84,6 +84,9 @@ struct SLEIPNIR_DLLEXPORT Expression {
/// Expression argument type.
ExpressionType type = ExpressionType::kConstant;

/// Reference count for intrusive shared pointer.
uint32_t refCount = 0;

/// Either nullary operator with no arguments, unary operator with one
/// argument, or binary operator with two arguments. This operator is
/// used to update the node's value.
Expand Down Expand Up @@ -124,9 +127,6 @@ struct SLEIPNIR_DLLEXPORT Expression {
/// Expression arguments.
std::array<ExpressionPtr, 2> args{nullptr, nullptr};

/// Reference count for intrusive shared pointer.
uint32_t refCount = 0;

/**
* Constructs a constant expression with a value of zero.
*/
Expand Down

0 comments on commit 80d9e07

Please sign in to comment.