[all-commits] [llvm/llvm-project] 2a603d: [mlir][Python] Fix conversion of non-zero offset m...
Felix Schneider via All-commits
all-commits at lists.llvm.org
Tue Sep 5 01:03:22 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2a603deec49cb6a27f3a29480ed8a133eef31cee
https://github.com/llvm/llvm-project/commit/2a603deec49cb6a27f3a29480ed8a133eef31cee
Author: Felix Schneider <fx.schn at gmail.com>
Date: 2023-09-05 (Tue, 05 Sep 2023)
Changed paths:
M mlir/python/mlir/runtime/np_to_memref.py
M mlir/test/python/execution_engine.py
Log Message:
-----------
[mlir][Python] Fix conversion of non-zero offset memrefs to np.arrays
Memref descriptors contain an `offset` field that denotes the start of
the content of the memref relative to the `alignedPtr`. This offset is
not considered when converting a memref descriptor to a np.array in the
Python runtime library, essentially treating all memrefs as if they had
an offset of zero. This patch introduces the necessary pointer arithmetic
to find the actual beginning of the memref contents to the memref->numpy
conversion functions.
There is an ongoing discussion about whether the `offset` field is needed
at all in the memref descriptor.
Until that is decided, the Python runtime and CRunnerUtils should
still correctly implement the offset handling.
Related: https://reviews.llvm.org/D157008
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D158494
More information about the All-commits
mailing list