40 nanobind::ft_lock_guard lock(mutex);
41 return dialectSearchPrefixes;
44 nanobind::ft_lock_guard lock(mutex);
45 dialectSearchPrefixes.swap(newValues);
48 nanobind::ft_lock_guard lock(mutex);
49 dialectSearchPrefixes.push_back(std::move(value));
58 bool loadDialectModule(std::string_view dialectNamespace);
63 void registerAttributeBuilder(
const std::string &attributeKind,
64 nanobind::callable pyFunc,
65 bool replace =
false);
70 void registerTypeCaster(MlirTypeID mlirTypeID, nanobind::callable typeCaster,
71 bool replace =
false);
76 void registerValueCaster(MlirTypeID mlirTypeID,
77 nanobind::callable valueCaster,
78 bool replace =
false);
83 void registerDialectImpl(
const std::string &dialectNamespace,
84 nanobind::object pyClass);
89 void registerOperationImpl(
const std::string &operationName,
90 nanobind::object pyClass,
bool replace =
false);
95 void registerOpAdaptorImpl(
const std::string &operationName,
96 nanobind::object pyClass,
bool replace =
false);
99 std::optional<nanobind::callable>
100 lookupAttributeBuilder(
const std::string &attributeKind);
103 std::optional<nanobind::callable> lookupTypeCaster(MlirTypeID mlirTypeID,
104 MlirDialect dialect);
107 std::optional<nanobind::callable> lookupValueCaster(MlirTypeID mlirTypeID,
108 MlirDialect dialect);
112 std::optional<nanobind::object>
113 lookupDialectClass(
const std::string &dialectNamespace);
118 std::optional<nanobind::object>
119 lookupOperationClass(std::string_view operationName);
124 std::optional<nanobind::object>
125 lookupOpAdaptorClass(std::string_view operationName);
146 nanobind::ft_mutex mutex;
147 bool locTracebackEnabled_ =
false;
148 size_t locTracebackFramesLimit_ = 10;
149 std::unordered_set<std::string> userTracebackIncludeFiles;
150 std::unordered_set<std::string> userTracebackExcludeFiles;
151 std::regex userTracebackIncludeRegex;
152 bool rebuildUserTracebackIncludeRegex =
false;
153 std::regex userTracebackExcludeRegex;
154 bool rebuildUserTracebackExcludeRegex =
false;
155 std::unordered_map<std::string, bool> isUserTracebackFilenameCache;
169 other.allocator.ptr =
nullptr;
172 MlirTypeIDAllocator
get() {
return allocator; }
178 MlirTypeIDAllocator allocator;
186 nanobind::ft_mutex mutex;
189 std::vector<std::string> dialectSearchPrefixes;
191 std::unordered_map<std::string, nanobind::object> dialectClassMap;
193 std::unordered_map<std::string, nanobind::object> operationClassMap;
195 std::unordered_map<std::string, nanobind::object> opAdaptorClassMap;
197 std::unordered_map<std::string, nanobind::callable> attributeBuilderMap;
199 std::unordered_map<MlirTypeID, nanobind::callable,
MlirTypeIDHash,
203 std::unordered_map<MlirTypeID, nanobind::callable,
MlirTypeIDHash,
208 std::unordered_set<std::string> loadedDialectModules;
210 TracebackLoc tracebackLoc;