Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: EnzymeAD/Enzyme
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.0.171
Choose a base ref
...
head repository: EnzymeAD/Enzyme
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.0.172
Choose a head ref
  • 5 commits
  • 21 files changed
  • 5 contributors

Commits on Dec 27, 2024

  1. Configuration menu
    Copy the full SHA
    8e79483 View commit details
    Browse the repository at this point in the history
  2. Batched autodiff (#2181)

    * add type conversions for width != 1.
    
    This still requires changes in the tblgenerated derivative files. For example, createForwardModeTangent in MulFOpFwdDerivative could be altered like this:
    ```
      LogicalResult createForwardModeTangent(Operation *op0, OpBuilder &builder, MGradientUtils *gutils) const
      {
        auto op = cast<arith::MulFOp>(op0);
        if (gutils->width != 1) {
          auto newop = gutils->getNewFromOriginal(op0);
          for (auto res : newop->getResults()) {
            res.setType(mlir::RankedTensorType::get({gutils->width}, res.getType()));
          }
        }
        gutils->eraseIfUnused(op);
        if (gutils->isConstantInstruction(op))
          return success();
        mlir::Value res = nullptr;
        if (!gutils->isConstantValue(op->getOperand(0)))
        {
          auto dif = gutils->invertPointerM(op->getOperand(0), builder);
          {
            mlir::Value itmp = ({
              // Computing MulFOp
              auto fwdarg_0 = dif;
              dif.dump();
              // TODO: gutils->makeBatched(...)
              auto fwdarg_1 = gutils->getNewFromOriginal(op->getOperand(1));
              builder.create<arith::MulFOp>(op.getLoc(), fwdarg_0, fwdarg_1);
            });
            itmp.dump();
            if (!res)
              res = itmp;
            else
            {
              auto operandType = cast<AutoDiffTypeInterface>(res.getType());
              res = operandType.createAddOp(builder, op.getLoc(), res, itmp);
            }
          }
        }
        if (!gutils->isConstantValue(op->getOperand(1)))
        {
          auto dif = gutils->invertPointerM(op->getOperand(1), builder);
          {
            mlir::Value itmp = ({
              // Computing MulFOp
              auto fwdarg_0 = dif;
              dif.dump();
              auto fwdarg_1 = gutils->getNewFromOriginal(op->getOperand(0));
              builder.create<arith::MulFOp>(op.getLoc(), fwdarg_0, fwdarg_1);
            });
            if (!res)
              res = itmp;
            else
            {
              auto operandType = cast<AutoDiffTypeInterface>(res.getType());
              res = operandType.createAddOp(builder, op.getLoc(), res, itmp);
            }
          }
        }
        assert(res);
        gutils->setDiffe(op->getResult(0), res, builder);
        return success();
      }
    ```
    
    * add code to tblgen generator, this eventually needs to be a single function call.
    
    * a test and formatting
    
    * use tensor splatop
    
    * remove stale enzyme-tblgen changes
    
    * do the simple batching in enzyme-tblgen
    
    * include tensor in all AutoDiffOpInterfaceImpls
    
    * add enzyme broadcastop
    
    * getShadowType for TensorTypeInterface
    
    * create broadcastop in enzyme-tblgen
    
    * Revert "include tensor in all AutoDiffOpInterfaceImpls"
    
    This reverts commit c06ed01.
    
    * test
    
    * DenseI64ArrayAttr for shape instead of scalar width
    
    * `llvm::SmallVector` --> `ArrayRef`
    
    * formatting
    
    * use getShadowType in BroadcastOp builder
    
    Co-authored-by: Billy Moses <[email protected]>
    
    * unstructured control flow test
    
    * scf.for
    
    * formatting
    
    * support `scf.if` test
    
    * formatting
    
    * forgotten includes
    
    ---------
    
    Co-authored-by: Jules Merckx <[email protected]>
    Co-authored-by: Billy Moses <[email protected]>
    3 people authored Dec 27, 2024
    Configuration menu
    Copy the full SHA
    eeb6200 View commit details
    Browse the repository at this point in the history

Commits on Dec 29, 2024

  1. Configuration menu
    Copy the full SHA
    29fe86b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    bdda0ce View commit details
    Browse the repository at this point in the history
  3. Fix copyslice v2 (#2211)

    * Fix copyslice v2
    
    * fix
    wsmoses authored Dec 29, 2024
    Configuration menu
    Copy the full SHA
    7cf9e90 View commit details
    Browse the repository at this point in the history
Loading