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);
66 void registerAttributeBuilder(
const std::string &attributeKind,
67 nanobind::callable pyFunc,
bool replace =
false,
68 bool allow_existing =
false);
73 void registerTypeCaster(MlirTypeID mlirTypeID, nanobind::callable typeCaster,
74 bool replace =
false);
79 void registerValueCaster(MlirTypeID mlirTypeID,
80 nanobind::callable valueCaster,
81 bool replace =
false);
86 void registerDialectImpl(
const std::string &dialectNamespace,
87 nanobind::object pyClass,
bool replace =
false);
92 void registerOperationImpl(
const std::string &operationName,
93 nanobind::object pyClass,
bool replace =
false);
98 void registerOpAdaptorImpl(
const std::string &operationName,
99 nanobind::object pyClass,
bool replace =
false);
102 std::optional<nanobind::callable>
103 lookupAttributeBuilder(
const std::string &attributeKind);
106 std::optional<nanobind::callable> lookupTypeCaster(MlirTypeID mlirTypeID,
107 MlirDialect dialect);
110 std::optional<nanobind::callable> lookupValueCaster(MlirTypeID mlirTypeID,
111 MlirDialect dialect);
115 std::optional<nanobind::object>
116 lookupDialectClass(
const std::string &dialectNamespace);
121 std::optional<nanobind::object>
122 lookupOperationClass(std::string_view operationName);
127 std::optional<nanobind::object>
128 lookupOpAdaptorClass(std::string_view operationName);
149 nanobind::ft_mutex mutex;
150 bool locTracebackEnabled_ =
false;
151 size_t locTracebackFramesLimit_ = 10;
152 std::unordered_set<std::string> userTracebackIncludeFiles;
153 std::unordered_set<std::string> userTracebackExcludeFiles;
154 std::regex userTracebackIncludeRegex;
155 bool rebuildUserTracebackIncludeRegex =
false;
156 std::regex userTracebackExcludeRegex;
157 bool rebuildUserTracebackExcludeRegex =
false;
158 std::unordered_map<std::string, bool> isUserTracebackFilenameCache;
172 other.allocator.ptr =
nullptr;
175 MlirTypeIDAllocator
get() {
return allocator; }
181 MlirTypeIDAllocator allocator;
189 nanobind::ft_mutex mutex;
192 std::vector<std::string> dialectSearchPrefixes;
194 std::unordered_map<std::string, nanobind::object> dialectClassMap;
196 std::unordered_map<std::string, nanobind::object> operationClassMap;
198 std::unordered_map<std::string, nanobind::object> opAdaptorClassMap;
200 std::unordered_map<std::string, nanobind::callable> attributeBuilderMap;
202 std::unordered_map<MlirTypeID, nanobind::callable,
MlirTypeIDHash,
206 std::unordered_map<MlirTypeID, nanobind::callable,
MlirTypeIDHash,
211 std::unordered_set<std::string> loadedDialectModules;
213 TracebackLoc tracebackLoc;