Skip to content

Commit

Permalink
Merge pull request #54 from xdslproject/mino_edits
Browse files Browse the repository at this point in the history
docs: minor Updates
  • Loading branch information
georgebisbas authored Feb 1, 2024
2 parents 5bb6ffc + 0e1097c commit 3d21a27
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
8 changes: 5 additions & 3 deletions devito/ir/ietxdsl/cluster_to_ssa.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def _visit_math_nodes(self, node: Expr) -> SSAValue:
return cst.result
# Handle Floats
elif isinstance(node, Float):
cst = arith.Constant.from_float_and_width(float(node), builtin.f32)
cst = arith.Constant(builtin.FloatAttr(float(node), builtin.f32))
self.block.add_op(cst)
return cst.result
# Handle Symbols
Expand Down Expand Up @@ -466,8 +466,10 @@ def match_and_rewrite(self, op: iet_ssa.LoadSymbolic, rewriter: PatternRewriter,

if op.result.type in (builtin.f32, builtin.f64):
rewriter.replace_matched_op(
arith.Constant.from_float_and_width(
float(self.known_symbols[symb_name]), op.result.type
arith.Constant(builtin.FloatAttr
(
float(self.known_symbols[symb_name]), op.result.type
)
)
)
return
Expand Down
2 changes: 1 addition & 1 deletion devito/ir/ietxdsl/lowering.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def match_and_rewrite(self, op: iet_ssa.For, rewriter: PatternRewriter, /):
rewriter.replace_matched_op([
cst1 := arith.Constant.from_int_and_width(1, builtin.IndexType()),
new_ub := arith.Addi(op.ub, cst1),
scf_for := scf.For.get(op.lb, new_ub.result, op.step, subindice_vals, body),
scf_for := scf.For(op.lb, new_ub.result, op.step, subindice_vals, body),
], [scf_for.results[0]])

for use in scf_for.results[0].uses:
Expand Down
2 changes: 1 addition & 1 deletion fast/diffusion_2D_wBCs.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
u.data[:] = u2.data[:]
configuration['mpi'] = mpiconf

# Reset data
# Reset our data field and ICs
init_hat(field=u.data[0], dx=dx, dy=dy, value=1.)

if args.xdsl:
Expand Down
4 changes: 2 additions & 2 deletions fast/diffusion_3D_wBCs.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
u = TimeFunction(name='u', grid=grid, space_order=so)
devito_out = TimeFunction(name='u', grid=grid, space_order=so)

a = Constant(name='a')
# Create an equation with second-order derivatives
a = Constant(name='a')
eq = Eq(u.dt, a * u.laplace)
stencil = solve(eq, u.forward)
eq_stencil = Eq(u.forward, stencil)
Expand Down Expand Up @@ -91,4 +91,4 @@
if args.xdsl and args.devito:
assert np.isclose(norm(u), norm(devito_out), rtol=1e-5)
max_error = np.max(np.abs(u.data - devito_out.data))
assert np.isclose(norm(u), norm(devito_out), rtol=1e-5)
print("Max error: ", max_error)

0 comments on commit 3d21a27

Please sign in to comment.