Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/enzyme_ad/jax/Passes/EnzymeHLOOpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include "llvm/ADT/SmallSet.h"

#include "llvm/ADT/MapVector.h"
#include <cassert>
#include <cstddef>
#include <iterator>
#include <numeric>
Expand Down Expand Up @@ -13045,6 +13046,12 @@ struct BroadcastInDimOpCanon final
// Eliminate redundant nested BroadcastInDim.
if (auto definingOp =
operand.getDefiningOp<stablehlo::BroadcastInDimOp>()) {
DenseElementsAttr denseAttr;
if (matchPattern(definingOp.getOperand(), m_Constant(&denseAttr)) &&
!denseAttr.isSplat()) {
// TODO: investigate why this leads to incorrect results
return failure();
}
auto newIndices = llvm::to_vector(
llvm::map_range(definingOp.getBroadcastDimensions(),
[&dims](int64_t dim) { return dims[dim]; }));
Expand Down
3 changes: 0 additions & 3 deletions test/neuralgcm_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ def forward(initial_state, all_forcings):
self.atol = 5e-2
self.rtol = 1e-2

# TODO: we should fix this at some point
self.skip_test_assert = True


if __name__ == "__main__":
from test_utils import fix_paths
Expand Down
6 changes: 3 additions & 3 deletions test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def fix_paths():
# https://github.com/jax-ml/jax/blob/af36ae2cd783aea9eaa7979170df760a52542fcd/jax/_src/lib/__init__.py#L185
os.environ["PYTHON_RUNFILES"] = runfiles
# https://jax.readthedocs.io/en/latest/gpu_memory_allocation.html
os.environ["XLA_PYTHON_CLIENT_MEM_FRACTION"] = "0.95"
# os.environ["XLA_PYTHON_CLIENT_MEM_FRACTION"] = "0.9"

cuda_version = 12
cuda_postfix = "_cu12"
Expand Down Expand Up @@ -419,11 +419,11 @@ def pipelines():
setup_backends()

return [
get_pipeline("JaxPipe"),
get_pipeline("Jax"),
get_pipeline("HLOOpt"),
get_pipeline("JaxPipe"),
get_pipeline("PartOpt"),
get_pipeline("IPartOpt"),
get_pipeline("HLOOpt"),
get_pipeline("DefOpt"),
get_pipeline("IDefOpt"),
]
Expand Down
Loading