From b5b7e61f7a28fede56741d790655412a5512a1c2 Mon Sep 17 00:00:00 2001 From: Jacques Pienaar Date: Wed, 16 Jan 2019 06:01:00 -0800 Subject: [PATCH] Update to new sugared form in doc PiperOrigin-RevId: 229544256 --- mlir/g3doc/OpDefinitions.md | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/mlir/g3doc/OpDefinitions.md b/mlir/g3doc/OpDefinitions.md index 03a17ae14565..223577369f03 100644 --- a/mlir/g3doc/OpDefinitions.md +++ b/mlir/g3doc/OpDefinitions.md @@ -99,31 +99,13 @@ def TF_AddOp : Op<"tf.Add", [NoSideEffect]>, The inputs and result must be of the same elemental type. }]; - // FIXME: This is very much not the final form! There is a lot of boilerplate - // that will be removed in future iterations. let reference = [{ - // Different Bindable ivs, one per loop in the loop nest. - auto ivs = makeBindables(shapeA.size()); - Bindable zero, one; - // Same bindable, all equal to `zero`. - SmallVector zeros(ivs.size(), zero); - // Same bindable, all equal to `one`. - SmallVector ones(ivs.size(), one); - Bindable A, B, C; - Stmt scalarA, scalarB, tmp; + auto ivs = makeBindables(lhsShape.size()); block = edsc::Block({ - ForNest(ivs, zeros, shapeA, ones, { - scalarA = load(A, ivs), - scalarB = load(B, ivs), - tmp = scalarA + scalarB, - store(tmp, C, ivs) - }), - }); - emitter.bindConstant(zero, 0) - .bindConstant(one, 1) - .bind(A, memRefA) - .bind(B, memRefB) - .bind(C, memRefC); + ForNest(ivs, 0, lhsShape, 1, { + result[ivs] = lhs[ivs] + rhs[ivs] + })}); + } }]; } ```