diff --git a/mlir/include/mlir/ExecutionEngine/AsyncRuntime.h b/mlir/include/mlir/ExecutionEngine/AsyncRuntime.h --- a/mlir/include/mlir/ExecutionEngine/AsyncRuntime.h +++ b/mlir/include/mlir/ExecutionEngine/AsyncRuntime.h @@ -32,6 +32,9 @@ #define MLIR_ASYNCRUNTIME_DEFINE_FUNCTIONS #endif // _WIN32 +namespace mlir { +namespace runtime { + //===----------------------------------------------------------------------===// // Async runtime API. //===----------------------------------------------------------------------===// @@ -102,4 +105,7 @@ extern "C" MLIR_ASYNCRUNTIME_EXPORT void mlirAsyncRuntimePrintCurrentThreadId(); +} // namespace runtime +} // namespace mlir + #endif // MLIR_EXECUTIONENGINE_ASYNCRUNTIME_H_ diff --git a/mlir/lib/ExecutionEngine/AsyncRuntime.cpp b/mlir/lib/ExecutionEngine/AsyncRuntime.cpp --- a/mlir/lib/ExecutionEngine/AsyncRuntime.cpp +++ b/mlir/lib/ExecutionEngine/AsyncRuntime.cpp @@ -24,10 +24,14 @@ #include #include +using namespace mlir::runtime; + //===----------------------------------------------------------------------===// // Async runtime API. //===----------------------------------------------------------------------===// +namespace mlir { +namespace runtime { namespace { // Forward declare class defined below. @@ -66,12 +70,6 @@ std::atomic numRefCountedObjects; }; -// Returns the default per-process instance of an async runtime. -AsyncRuntime *getDefaultAsyncRuntimeInstance() { - static auto runtime = std::make_unique(); - return runtime.get(); -} - // -------------------------------------------------------------------------- // // A base class for all reference counted objects created by the async runtime. // -------------------------------------------------------------------------- // @@ -110,6 +108,12 @@ } // namespace +// Returns the default per-process instance of an async runtime. +static AsyncRuntime *getDefaultAsyncRuntimeInstance() { + static auto runtime = std::make_unique(); + return runtime.get(); +} + struct AsyncToken : public RefCounted { // AsyncToken created with a reference count of 2 because it will be returned // to the `async.execute` caller and also will be later on emplaced by the @@ -140,6 +144,9 @@ std::vector> awaiters; }; +} // namespace runtime +} // namespace mlir + // Adds references to reference counted runtime object. extern "C" void mlirAsyncRuntimeAddRef(RefCountedObjPtr ptr, int32_t count) { RefCounted *refCounted = static_cast(ptr);