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

MLIR Reverse Mode #37

Merged
merged 17 commits into from
Mar 9, 2024
Prev Previous commit
Next Next commit
fix
wsmoses committed Mar 8, 2024
commit a3512d56152412a78884d9acf43fcfd5c3df792e
6 changes: 4 additions & 2 deletions src/enzyme_ad/jax/primitives.py
Original file line number Diff line number Diff line change
@@ -613,6 +613,7 @@ def zero(ty):
else:
z = zero(orig_types[v])
results2.append(z)

results = tuple(results2)
else:
identifier, tmpBuf = enzyme_call.create_enzyme_cpu_kernel(
@@ -1087,10 +1088,11 @@ def primal_partial_eval(trace, *args, **kwargs):
else:
pipeline_options = NewXLAPipeline(newpasses, pipeline_options.mlir_ad())

(in_tree, in_idx_map, mfunc) = kwargs["source"]
(in_tree, in_idx_map, out_idx_map, mfunc) = kwargs["source"]

avals = {k//2: v for k, v in in_idx_map.items() if k % 2 == 0}
source = (in_tree, avals, mfunc)
outmap2 = {k//2: v for k, v in out_idx_map.items() if k % 2 == 0}
source = (in_tree, avals, outmap2, mfunc)

primalret = trace.default_process_primitive(_enzyme_primal_p, primals, {'out_shapes':out_shapes2, 'source':source, 'fn':kwargs['fn'], 'argv':kwargs['argv'], 'lang':kwargs['lang'], 'pipeline_options':pipeline_options})
return primalret + shadows_known