[mlir] Improve debug flag management in Python bindings
authorAlex Zinenko <zinenko@google.com>
Mon, 19 Apr 2021 11:37:01 +0000 (13:37 +0200)
committerAlex Zinenko <zinenko@google.com>
Mon, 19 Apr 2021 12:45:43 +0000 (14:45 +0200)
commit4acd8457d8737e47db022076c6f8bd48171f4f49
treef3ba4f113c9bc23b9c7f6451b2c324ccfb33984b
parent0a92e09c078527b46e37e31dc8c2615a207c7639
[mlir] Improve debug flag management in Python bindings

Expose the debug flag as a readable and assignable property of a
dedicated class instead of a write-only function. Actually test the fact
of setting the flag. Move test to a dedicated file, it has zero relation
to context_managers.py where it was added.

Arguably, it should be promoted from mlir.ir to mlir module, but we are
not re-exporting the latter and this functionality is purposefully
hidden so can stay in IR for now. Drop unnecessary export code.

Refactor C API and put Debug into a separate library, fix it to actually
set the flag to the given value.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D100757
mlir/include/mlir-c/Debug.h [new file with mode: 0644]
mlir/include/mlir-c/IR.h
mlir/lib/Bindings/Python/IRCore.cpp
mlir/lib/Bindings/Python/mlir/ir.py
mlir/lib/CAPI/CMakeLists.txt
mlir/lib/CAPI/Debug/CMakeLists.txt [new file with mode: 0644]
mlir/lib/CAPI/Debug/Debug.cpp [new file with mode: 0644]
mlir/lib/CAPI/IR/IR.cpp
mlir/test/Bindings/Python/context_managers.py
mlir/test/Bindings/Python/debug.py [new file with mode: 0644]