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 @@
// 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 "dialect/dialect.hpp"
......
......@@ -14,6 +14,9 @@
// 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
#include "memory_manager.hpp"
......
......@@ -14,6 +14,9 @@
// 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 "ngraph/check.hpp"
#include "ops.hpp"
......@@ -41,12 +44,12 @@ void NGraphOpsDialect::printType(mlir::Type type, raw_ostream& os) const
case NG_TENSOR_TYPE_ID:
{
os << "tensor<";
auto tensor_ty = type.cast<NGTensorType>();
for (auto dim : tensor_ty.getShape())
auto tensorTy = type.cast<NGTensorType>();
for (auto dim : tensorTy.getShape())
{
os << dim << 'x';
}
os << tensor_ty.getElementType() << '>';
os << tensorTy.getElementType() << '>';
return;
}
case NG_I8_TYPE_ID:
......@@ -58,8 +61,8 @@ void NGraphOpsDialect::printType(mlir::Type type, raw_ostream& os) const
case NG_U32_TYPE_ID:
case NG_U64_TYPE_ID:
{
auto int_ty = type.cast<NGIntegerType>();
os << "i" << int_ty.getWidth();
auto intTy = type.cast<NGIntegerType>();
os << "i" << intTy.getWidth();
return;
}
case NG_BOOL_TYPE_ID:
......
......@@ -13,6 +13,10 @@
// See the License for the specific language governing permissions and
// 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
#include "mlir/IR/Dialect.h"
......@@ -23,6 +27,7 @@
#include "mlir/IR/TypeSupport.h"
#include "mlir/IR/Types.h"
#include "ngraph/check.hpp"
namespace mlir
{
class NGraphOpsDialect : public mlir::Dialect
......
......@@ -13,6 +13,10 @@
// See the License for the specific language governing permissions and
// 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 "assertion.hpp"
#include "llvm/Support/ErrorHandling.h"
......
......@@ -13,6 +13,10 @@
// See the License for the specific language governing permissions and
// 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
#include <cstdarg>
......
......@@ -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"
// nGraph Dialect operations definitions
......
......@@ -12,6 +12,10 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// 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"
......
......@@ -13,6 +13,10 @@
// See the License for the specific language governing permissions and
// 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
#include "mlir/IR/Dialect.h"
......@@ -198,19 +202,19 @@ namespace mlir
return new (storage) NGTensorTypeStorage(eltType, shape);
}
Shape getShape() const { return m_shape; }
int64_t getRank() const { return m_shape.size(); }
EltType getElementType() const { return m_eltType; }
Shape getShape() const { return shape; }
int64_t getRank() const { return shape.size(); }
EltType getElementType() const { return eltType; }
private:
NGTensorTypeStorage(EltType eltType, Shape shape)
: m_eltType(eltType)
, m_shape(shape)
: eltType(eltType)
, shape(shape)
{
}
private:
EltType m_eltType;
Shape m_shape;
EltType eltType;
Shape shape;
};
/// NGraph Tensor Type
......
This diff is collapsed.
......@@ -14,6 +14,9 @@
// 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
#include "contrib/mlir/compiler.hpp"
......
......@@ -14,6 +14,9 @@
// 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>
#include "ngraph/ngraph_visibility.hpp"
......@@ -21,9 +24,9 @@
using namespace ngraph::runtime::ngmlir;
/// 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)
......
......@@ -14,11 +14,15 @@
// 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
#include <stdint.h>
#include <stdlib.h>
#include <vector>
namespace ngraph
{
namespace runtime
......
......@@ -14,6 +14,9 @@
// 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 "ngraph/assertion.hpp"
#include "ngraph/graph_util.hpp"
......
......@@ -14,6 +14,9 @@
// 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
#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