Commit a095c587 authored by Diego Caballero's avatar Diego Caballero Committed by Scott Cyphers

[MLIR] Fix naming convention in MLIR files (#3292)

* [MLIR] Fix naming convention in MLIR files

Add naming convention note per file to state which files should use
nGraph naming convention and which MLIR naming convention and align
naming convention in those files with such a note.

* Remove m-prefix
parent ddc261b9
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
// limitations under the License. // limitations under the License.
//***************************************************************************** //*****************************************************************************
// NOTE: This file follows nGraph format style and naming convention since it
// exposes a public API to the rest of nGraph codebase.
#include "compiler.hpp" #include "compiler.hpp"
#include "dialect/dialect.hpp" #include "dialect/dialect.hpp"
......
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
// limitations under the License. // limitations under the License.
//***************************************************************************** //*****************************************************************************
// NOTE: This file follows nGraph format style and naming convention since it
// exposes a public API to the rest of nGraph codebase.
#pragma once #pragma once
#include "memory_manager.hpp" #include "memory_manager.hpp"
......
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
// limitations under the License. // limitations under the License.
//***************************************************************************** //*****************************************************************************
// NOTE: This file follows nGraph format style and MLIR naming convention since it does
// not expose public API to the rest of nGraph codebase and heavily depends on MLIR API.
#include "dialect.hpp" #include "dialect.hpp"
#include "ngraph/check.hpp" #include "ngraph/check.hpp"
#include "ops.hpp" #include "ops.hpp"
...@@ -41,12 +44,12 @@ void NGraphOpsDialect::printType(mlir::Type type, raw_ostream& os) const ...@@ -41,12 +44,12 @@ void NGraphOpsDialect::printType(mlir::Type type, raw_ostream& os) const
case NG_TENSOR_TYPE_ID: case NG_TENSOR_TYPE_ID:
{ {
os << "tensor<"; os << "tensor<";
auto tensor_ty = type.cast<NGTensorType>(); auto tensorTy = type.cast<NGTensorType>();
for (auto dim : tensor_ty.getShape()) for (auto dim : tensorTy.getShape())
{ {
os << dim << 'x'; os << dim << 'x';
} }
os << tensor_ty.getElementType() << '>'; os << tensorTy.getElementType() << '>';
return; return;
} }
case NG_I8_TYPE_ID: case NG_I8_TYPE_ID:
...@@ -58,8 +61,8 @@ void NGraphOpsDialect::printType(mlir::Type type, raw_ostream& os) const ...@@ -58,8 +61,8 @@ void NGraphOpsDialect::printType(mlir::Type type, raw_ostream& os) const
case NG_U32_TYPE_ID: case NG_U32_TYPE_ID:
case NG_U64_TYPE_ID: case NG_U64_TYPE_ID:
{ {
auto int_ty = type.cast<NGIntegerType>(); auto intTy = type.cast<NGIntegerType>();
os << "i" << int_ty.getWidth(); os << "i" << intTy.getWidth();
return; return;
} }
case NG_BOOL_TYPE_ID: case NG_BOOL_TYPE_ID:
......
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
//***************************************************************************** //*****************************************************************************
// NOTE: This file follows nGraph format style and MLIR naming convention since it does
// not expose public API to the rest of nGraph codebase and heavily depends on MLIR API.
#pragma once #pragma once
#include "mlir/IR/Dialect.h" #include "mlir/IR/Dialect.h"
...@@ -23,6 +27,7 @@ ...@@ -23,6 +27,7 @@
#include "mlir/IR/TypeSupport.h" #include "mlir/IR/TypeSupport.h"
#include "mlir/IR/Types.h" #include "mlir/IR/Types.h"
#include "ngraph/check.hpp" #include "ngraph/check.hpp"
namespace mlir namespace mlir
{ {
class NGraphOpsDialect : public mlir::Dialect class NGraphOpsDialect : public mlir::Dialect
......
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
//***************************************************************************** //*****************************************************************************
// NOTE: This file follows nGraph format style and MLIR naming convention since it does
// not expose public API to the rest of nGraph codebase and heavily depends on MLIR API.
#include "ops.hpp" #include "ops.hpp"
#include "assertion.hpp" #include "assertion.hpp"
#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ErrorHandling.h"
......
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
//***************************************************************************** //*****************************************************************************
// NOTE: This file follows nGraph format style and MLIR naming convention since it does
// not expose public API to the rest of nGraph codebase and heavily depends on MLIR API.
#pragma once #pragma once
#include <cstdarg> #include <cstdarg>
......
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// NOTE: This file follows nGraph format style and MLIR naming convention since it does
// not expose public API to the rest of nGraph codebase and heavily depends on MLIR API.
include "mlir/IR/OpBase.td" include "mlir/IR/OpBase.td"
// nGraph Dialect operations definitions // nGraph Dialect operations definitions
......
...@@ -12,6 +12,10 @@ ...@@ -12,6 +12,10 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
//*****************************************************************************
// NOTE: This file follows nGraph format style and MLIR naming convention since it does
// not expose public API to the rest of nGraph codebase and heavily depends on MLIR API.
#include "type.hpp" #include "type.hpp"
......
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
//***************************************************************************** //*****************************************************************************
// NOTE: This file follows nGraph format style and MLIR naming convention since it does
// not expose public API to the rest of nGraph codebase and heavily depends on MLIR API.
#pragma once #pragma once
#include "mlir/IR/Dialect.h" #include "mlir/IR/Dialect.h"
...@@ -198,19 +202,19 @@ namespace mlir ...@@ -198,19 +202,19 @@ namespace mlir
return new (storage) NGTensorTypeStorage(eltType, shape); return new (storage) NGTensorTypeStorage(eltType, shape);
} }
Shape getShape() const { return m_shape; } Shape getShape() const { return shape; }
int64_t getRank() const { return m_shape.size(); } int64_t getRank() const { return shape.size(); }
EltType getElementType() const { return m_eltType; } EltType getElementType() const { return eltType; }
private: private:
NGTensorTypeStorage(EltType eltType, Shape shape) NGTensorTypeStorage(EltType eltType, Shape shape)
: m_eltType(eltType) : eltType(eltType)
, m_shape(shape) , shape(shape)
{ {
} }
private: private:
EltType m_eltType; EltType eltType;
Shape m_shape; Shape shape;
}; };
/// NGraph Tensor Type /// NGraph Tensor Type
......
This diff is collapsed.
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
// limitations under the License. // limitations under the License.
//***************************************************************************** //*****************************************************************************
// NOTE: This file follows nGraph format style and MLIR naming convention since it does
// not expose public API to the rest of nGraph codebase and heavily depends on MLIR API.
#pragma once #pragma once
#include "contrib/mlir/compiler.hpp" #include "contrib/mlir/compiler.hpp"
......
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
// limitations under the License. // limitations under the License.
//***************************************************************************** //*****************************************************************************
// NOTE: This file follows nGraph format style and MLIR naming convention since it does
// not expose public API to the rest of nGraph codebase and heavily depends on MLIR API.
#include "memory_manager.hpp" #include "memory_manager.hpp"
#include <memory> #include <memory>
#include "ngraph/ngraph_visibility.hpp" #include "ngraph/ngraph_visibility.hpp"
...@@ -21,9 +24,9 @@ ...@@ -21,9 +24,9 @@
using namespace ngraph::runtime::ngmlir; using namespace ngraph::runtime::ngmlir;
/// Call back to allocate memory for temps from JIT'ed code /// Call back to allocate memory for temps from JIT'ed code
extern "C" NGRAPH_API void* __mlir_allocate(MLIRMemMgr* mem_mgr, size_t size) extern "C" NGRAPH_API void* __mlir_allocate(MLIRMemMgr* memMgr, size_t size)
{ {
return mem_mgr->allocate(size); return memMgr->allocate(size);
} }
void* MLIRMemMgr::allocate(size_t size) void* MLIRMemMgr::allocate(size_t size)
......
...@@ -14,11 +14,15 @@ ...@@ -14,11 +14,15 @@
// limitations under the License. // limitations under the License.
//***************************************************************************** //*****************************************************************************
// NOTE: This file follows nGraph format style and MLIR naming convention since it does
// not expose public API to the rest of nGraph codebase and heavily depends on MLIR API.
#pragma once #pragma once
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <vector> #include <vector>
namespace ngraph namespace ngraph
{ {
namespace runtime namespace runtime
......
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
// limitations under the License. // limitations under the License.
//***************************************************************************** //*****************************************************************************
// NOTE: This file follows nGraph format style and naming convention since it
// exposes a public API to the rest of nGraph codebase.
#include "mlir_subgraph_extraction.hpp" #include "mlir_subgraph_extraction.hpp"
#include "ngraph/assertion.hpp" #include "ngraph/assertion.hpp"
#include "ngraph/graph_util.hpp" #include "ngraph/graph_util.hpp"
......
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
// limitations under the License. // limitations under the License.
//***************************************************************************** //*****************************************************************************
// NOTE: This file follows nGraph format style and naming convention since it
// exposes a public API to the rest of nGraph codebase.
#pragma once #pragma once
#include <mutex> #include <mutex>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment