File tree Expand file tree Collapse file tree 4 files changed +18
-22
lines changed
include/mlir/Bindings/Python Expand file tree Collapse file tree 4 files changed +18
-22
lines changed Original file line number Diff line number Diff line change @@ -38,10 +38,7 @@ class PyGlobals {
3838 ~PyGlobals ();
3939
4040 // / Most code should get the globals via this static accessor.
41- static PyGlobals &get () {
42- assert (instance && " PyGlobals is null" );
43- return *instance;
44- }
41+ static PyGlobals &get ();
4542
4643 // / Get and set the list of parent modules to search for dialect
4744 // / implementation classes.
Original file line number Diff line number Diff line change @@ -39,6 +39,11 @@ PyGlobals::PyGlobals() {
3939
4040PyGlobals::~PyGlobals () { instance = nullptr ; }
4141
42+ PyGlobals &PyGlobals::get () {
43+ assert (instance && " PyGlobals is null" );
44+ return *instance;
45+ }
46+
4247bool PyGlobals::loadDialectModule (llvm::StringRef dialectNamespace) {
4348 {
4449 nb::ft_lock_guard lock (mutex);
Original file line number Diff line number Diff line change @@ -994,17 +994,16 @@ endif()
994994get_property (NB_LIBRARY_TARGET_NAME TARGET MLIRPythonModules.extension._mlir.dso PROPERTY LINK_LIBRARIES )
995995list (GET NB_LIBRARY_TARGET_NAME 0 NB_LIBRARY_TARGET_NAME)
996996add_mlir_library_install(${NB_LIBRARY_TARGET_NAME} )
997- add_mlir_library (MLIRPythonSupport
997+ add_library (MLIRPythonSupport SHARED
998998 ${PYTHON_SOURCE_DIR} /IRCore.cpp
999999 ${PYTHON_SOURCE_DIR} /Globals.cpp
1000- EXCLUDE_FROM_LIBMLIR
1001- SHARED
1002- LINK_COMPONENTS
1003- Support
1004- LINK_LIBS
1005- Python::Module
1006- ${NB_LIBRARY_TARGET_NAME}
1007- MLIRPythonCAPI
1000+ )
1001+ target_link_libraries (MLIRPythonSupport PRIVATE
1002+ LLVMSupport
1003+ Python::Module
1004+ ${NB_LIBRARY_TARGET_NAME}
1005+ MLIRPythonCAPI
1006+
10081007)
10091008if ((CMAKE_SYSTEM_NAME STREQUAL "Linux" ) AND (NOT LLVM_USE_SANITIZER))
10101009 target_link_options (MLIRPythonSupport PRIVATE "-Wl,-z,undefs" )
@@ -1028,6 +1027,7 @@ set_target_properties(${NB_LIBRARY_TARGET_NAME} PROPERTIES
10281027set (eh_rtti_enable)
10291028if (MSVC )
10301029 set (eh_rtti_enable /EHsc /GR)
1030+ set_property (TARGET MLIRPythonSupport PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS ON )
10311031elseif (LLVM_COMPILER_IS_GCC_COMPATIBLE OR CLANG_CL)
10321032 set (eh_rtti_enable -frtti -fexceptions)
10331033endif ()
Original file line number Diff line number Diff line change @@ -613,12 +613,6 @@ def testCustomType():
613613 b = TestType (a )
614614 # Instance custom types should have typeids
615615 assert isinstance (b .typeid , TypeID )
616- # Subclasses of ir.Type should not have a static_typeid
617- # CHECK: 'TestType' object has no attribute 'static_typeid'
618- try :
619- b .static_typeid
620- except AttributeError as e :
621- print (e )
622616
623617 i8 = IntegerType .get_signless (8 )
624618 try :
@@ -633,9 +627,9 @@ def testCustomType():
633627 try :
634628 TestType (42 )
635629 except TypeError as e :
636- assert "Expected an MLIR object (got 42) " in str (e )
637- except ValueError as e :
638- assert "Cannot cast type to TestType (from 42) " in str (e )
630+ assert "__init__(): incompatible function arguments. The following argument types are supported " in str (e )
631+ assert "__init__(self, cast_from_type: mlir._mlir_libs._mlir.ir.Type) -> None" in str ( e )
632+ assert "Invoked with types: mlir._mlir_libs._mlirPythonTestNanobind. TestType, int " in str (e )
639633 else :
640634 raise
641635
You can’t perform that action at this time.
0 commit comments