Skip to content

Commit

Permalink
interpreter: (riscv) return raw ptr for dense array inputs (#3707)
Browse files Browse the repository at this point in the history
This isn't yet exercised anywhere apart from this unit test, but it's
incorrect, we operate on RawPtr objects at the riscv level, not
TypedPtr.
  • Loading branch information
superlopuh authored Jan 7, 2025
1 parent c1d6f68 commit a2aa5a0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions tests/interpreters/test_riscv_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,12 @@ def test_values():
interpreter.register_implementations(riscv_functions)
assert interpreter.value_for_attribute(IntegerAttr(1, i32), riscv.Registers.A0) == 1

assert interpreter.value_for_attribute(
DenseIntOrFPElementsAttr.create_dense_int(
TensorType(i32, [2, 3]), list(range(6))
),
riscv.Registers.A0,
) == TypedPtr.new_int32(list(range(6)))
assert (
interpreter.value_for_attribute(
DenseIntOrFPElementsAttr.create_dense_int(
TensorType(i32, [2, 3]), tuple(range(6))
),
riscv.Registers.A0,
)
== TypedPtr.new_int32(tuple(range(6))).raw
)
2 changes: 1 addition & 1 deletion xdsl/interpreters/riscv.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,6 @@ def register_value(
attr.get_element_type(), interpreter.index_bitwidth
),
)
return data_ptr
return data_ptr.raw
case _:
interpreter.raise_error(f"Unknown value type for int register: {attr}")

0 comments on commit a2aa5a0

Please sign in to comment.