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);
146 bool locTracebacksEnabled();
148 void setLocTracebacksEnabled(
bool value);
150 size_t locTracebackFramesLimit();
152 void setLocTracebackFramesLimit(
size_t value);
154 void registerTracebackFileInclusion(
const std::string &file);
156 void registerTracebackFileExclusion(
const std::string &file);
158 bool isUserTracebackFilename(std::string_view file);
160 OnExplicitAction tracebackActionOnExplicitLoc();
162 void setTracebackActionOnExplicitLoc(OnExplicitAction action);
164 CurrentLocAction tracebackActionOnCurrentLoc();
166 void setTracebackActionOnCurrentLoc(CurrentLocAction action);
171 nanobind::ft_mutex mutex;
172 bool locTracebackEnabled_ =
false;
173 size_t locTracebackFramesLimit_ = 10;
176 std::unordered_set<std::string> userTracebackIncludeFiles;
177 std::unordered_set<std::string> userTracebackExcludeFiles;
178 std::regex userTracebackIncludeRegex;
179 bool rebuildUserTracebackIncludeRegex =
false;
180 std::regex userTracebackExcludeRegex;
181 bool rebuildUserTracebackExcludeRegex =
false;
182 std::unordered_map<std::string, bool> isUserTracebackFilenameCache;
196 other.allocator.ptr =
nullptr;
199 MlirTypeIDAllocator
get() {
return allocator; }
205 MlirTypeIDAllocator allocator;
213 nanobind::ft_mutex mutex;
216 std::vector<std::string> dialectSearchPrefixes;
218 std::unordered_map<std::string, nanobind::object> dialectClassMap;
220 std::unordered_map<std::string, nanobind::object> operationClassMap;
222 std::unordered_map<std::string, nanobind::object> opAdaptorClassMap;
224 std::unordered_map<std::string, nanobind::callable> attributeBuilderMap;
226 std::unordered_map<MlirTypeID, nanobind::callable,
MlirTypeIDHash,
230 std::unordered_map<MlirTypeID, nanobind::callable,
MlirTypeIDHash,
235 std::unordered_set<std::string> loadedDialectModules;
237 TracebackLoc tracebackLoc;