41 nanobind::ft_lock_guard lock(mutex);
42 return dialectSearchPrefixes;
45 nanobind::ft_lock_guard lock(mutex);
46 dialectSearchPrefixes.swap(newValues);
49 nanobind::ft_lock_guard lock(mutex);
50 dialectSearchPrefixes.push_back(std::move(value));
59 bool loadDialectModule(std::string_view dialectNamespace);
64 void registerAttributeBuilder(
const std::string &attributeKind,
65 nanobind::callable pyFunc,
66 bool replace =
false);
71 void registerTypeCaster(MlirTypeID mlirTypeID, nanobind::callable typeCaster,
72 bool replace =
false);
77 void registerValueCaster(MlirTypeID mlirTypeID,
78 nanobind::callable valueCaster,
79 bool replace =
false);
84 void registerDialectImpl(
const std::string &dialectNamespace,
85 nanobind::object pyClass);
90 void registerOperationImpl(
const std::string &operationName,
91 nanobind::object pyClass,
bool replace =
false);
96 void registerOpAdaptorImpl(
const std::string &operationName,
97 nanobind::object pyClass,
bool replace =
false);
100 std::optional<nanobind::callable>
101 lookupAttributeBuilder(
const std::string &attributeKind);
104 std::optional<nanobind::callable> lookupTypeCaster(MlirTypeID mlirTypeID,
105 MlirDialect dialect);
108 std::optional<nanobind::callable> lookupValueCaster(MlirTypeID mlirTypeID,
109 MlirDialect dialect);
113 std::optional<nanobind::object>
114 lookupDialectClass(
const std::string &dialectNamespace);
119 std::optional<nanobind::object>
120 lookupOperationClass(std::string_view operationName);
125 std::optional<nanobind::object>
126 lookupOpAdaptorClass(std::string_view operationName);
147 nanobind::ft_mutex mutex;
148 bool locTracebackEnabled_ =
false;
149 size_t locTracebackFramesLimit_ = 10;
150 std::unordered_set<std::string> userTracebackIncludeFiles;
151 std::unordered_set<std::string> userTracebackExcludeFiles;
152 std::regex userTracebackIncludeRegex;
153 bool rebuildUserTracebackIncludeRegex =
false;
154 std::regex userTracebackExcludeRegex;
155 bool rebuildUserTracebackExcludeRegex =
false;
156 std::unordered_map<std::string, bool> isUserTracebackFilenameCache;
170 other.allocator.ptr =
nullptr;
173 MlirTypeIDAllocator
get() {
return allocator; }
179 MlirTypeIDAllocator allocator;
187 nanobind::ft_mutex mutex;
190 std::vector<std::string> dialectSearchPrefixes;
192 std::unordered_map<std::string, nanobind::object> dialectClassMap;
194 std::unordered_map<std::string, nanobind::object> operationClassMap;
196 std::unordered_map<std::string, nanobind::object> opAdaptorClassMap;
198 std::unordered_map<std::string, nanobind::callable> attributeBuilderMap;
200 std::unordered_map<MlirTypeID, nanobind::callable,
MlirTypeIDHash,
204 std::unordered_map<MlirTypeID, nanobind::callable,
MlirTypeIDHash,
209 std::unordered_set<std::string> loadedDialectModules;
211 TracebackLoc tracebackLoc;