Permalink
Browse files

Merge pull request #127 from ONNC/NV16fp

Nv16fp
  • Loading branch information...
poyenc committed Jan 22, 2019
2 parents 264d6b6 + 715a517 commit 93cbca85c005ad53d9dbd6ea64e93a80a71c0873
Showing with 10,633 additions and 112 deletions.
  1. +3 −0 include/onnc/Config/Config.h.cmake.in
  2. +8 −0 include/onnc/IR/Quadruple.h
  3. +7 −5 include/onnc/Target/TargetBackend.h
  4. +1 −0 lib/IR/CMakeLists.txt
  5. +27 −0 lib/IR/Quadruple.cpp
  6. +1 −1 lib/Makefile.am
  7. +0 −2 lib/Target/NVDLA/Makefile.am
  8. +0 −48 lib/Target/NVDLA/NVDLABackend.cpp
  9. +0 −33 lib/Target/NVDLA/NVDLABackend.h
  10. +17 −0 lib/Target/NvDla/CMakeLists.txt
  11. +1,363 −0 lib/Target/NvDla/CodeEmitVisitor.cpp
  12. +60 −0 lib/Target/NvDla/CodeEmitVisitor.h
  13. +848 −0 lib/Target/NvDla/Loadable.cpp
  14. +14 −0 lib/Target/NvDla/Makefile.am
  15. +167 −0 lib/Target/NvDla/NvDlaBackend.cpp
  16. +42 −0 lib/Target/NvDla/NvDlaBackend.h
  17. +52 −0 lib/Target/NvDla/NvDlaFileGenPass.cpp
  18. +42 −0 lib/Target/NvDla/NvDlaFileGenPass.h
  19. +219 −0 lib/Target/NvDla/NvDlaMemInfoPass.cpp
  20. +47 −0 lib/Target/NvDla/NvDlaMemInfoPass.h
  21. +199 −0 lib/Target/NvDla/NvDlaMeta.cpp
  22. +161 −0 lib/Target/NvDla/NvDlaMeta.h
  23. +361 −0 lib/Target/NvDla/NvDlaTaskSubmitPass.cpp
  24. +44 −0 lib/Target/NvDla/NvDlaTaskSubmitPass.h
  25. +4 −0 lib/Target/NvDla/TargetInfo/CMakeLists.txt
  26. +45 −0 lib/Target/NvDla/TargetInfo/NvDlaTargetInfo.cpp
  27. +18 −0 lib/Target/NvDla/TargetInfo/NvDlaTargetInfo.h
  28. +49 −0 lib/Target/NvDla/TargetInfo/NvDlaTargetMemInfo.cpp
  29. +22 −0 lib/Target/NvDla/TargetInfo/NvDlaTargetMemInfo.h
  30. BIN lib/Target/NvDla/docs/umd.dia
  31. +189 −0 lib/Target/NvDla/fp16.c
  32. +16 −0 lib/Target/NvDla/fp16.h
  33. +451 −0 lib/Target/NvDla/include/ErrorMacros.h
  34. +885 −0 lib/Target/NvDla/include/dla_interface.h
  35. +76 −0 lib/Target/NvDla/include/dlaerror.h
  36. +53 −0 lib/Target/NvDla/include/dlatypes.h
  37. +142 −0 lib/Target/NvDla/include/emu_interface.h
  38. +1,852 −0 lib/Target/NvDla/include/flatbuffers/flatbuffers.h
  39. +308 −0 lib/Target/NvDla/include/nvdla/ILoadable.h
  40. +167 −0 lib/Target/NvDla/include/nvdla/IRuntime.h
  41. +452 −0 lib/Target/NvDla/include/nvdla/IType.h
  42. +167 −0 lib/Target/NvDla/include/nvdla/c/NvDlaLoadable.h
  43. +168 −0 lib/Target/NvDla/include/nvdla/c/NvDlaType.h
  44. +167 −0 lib/Target/NvDla/include/priv/Loadable.h
  45. +126 −0 lib/Target/NvDla/include/priv/Type.h
  46. +1,576 −0 lib/Target/NvDla/include/priv/loadable_generated.h
  47. +1 −1 lib/Target/Sophon/BM188x/BM188xBackend.cpp
  48. +2 −6 lib/Target/Vanilla/VanillaBackend.cpp
  49. +1 −1 lib/Target/Vanilla/VanillaBackend.h
  50. +4 −6 lib/Target/X86/X86Backend.cpp
  51. +1 −1 lib/Target/X86/X86Backend.h
  52. +4 −4 m4/onnc-target.m4
  53. +4 −4 tools/unittests/MemAllocTest.cpp
@@ -24,6 +24,9 @@
/* define x86_64 target */
#cmakedefine ENABLE_X86_TARGET 1

/* define nvdla target */
#cmakedefine ENABLE_NVDLA_TARGET 1

/* Enable clock_gettime */
#cmakedefine ENABLE_CLOCK_GETTIME 1

@@ -66,6 +66,7 @@ class Quadruple
x86_64, // X86-64: amd64, x86_64
xcore, // XCore: xcore
mblaze, // MBlaze: mblaze
nvdla, // NvDla
nvptx, // NVPTX: 32-bit
nvptx64, // NVPTX: 64-bit
le32, // le32: generic little-endian 32-bit CPU (PNaCl / Emscripten)
@@ -90,6 +91,10 @@ class Quadruple
ARMSubArch_v5,
ARMSubArch_v5te,
ARMSubArch_v4t,
NvDlaSubArch_fp32,
NvDlaSubArch_fp16,
NvDlaSubArch_int16,
NvDlaSubArch_int8,
SophonSubArch_vBM1680,
SophonSubArch_vBM1682,
SophonSubArch_vBM1880,
@@ -375,6 +380,9 @@ class Quadruple
/// Test whether the data-path width is 16-bit
bool isArch16Bit() const;

/// Test whether the data-path width is 8-bit
bool isArch8Bit() const;

/// \brief Test whether the pointer width is 64-bit
/// Note that some 64-bit architecture remains 32-bit pointer width, for
/// example, Intel X32 is 64-bit architecture, but its pointer is 32-bit.
@@ -8,12 +8,14 @@
#ifndef ONNC_TARGET_TARGET_BACKEND_H
#define ONNC_TARGET_TARGET_BACKEND_H
#include <onnc/Core/PassManager.h>
#include <onnc/Target/TargetMemInfo.h>
#include <onnc/Target/TargetOptions.h>
#include <onnc/Support/Path.h>

#include <memory>

namespace onnc {

class TargetMemInfo;
class TargetOptions;
class TargetTransformInfo;
class LowerRegistry;
@@ -22,7 +24,7 @@ class TargetBackend
{
public:
TargetBackend(const TargetOptions& pOptions)
: m_pMemInfo(nullptr), m_TargetOptions(pOptions) {
: m_TargetOptions(pOptions) {
}

virtual ~TargetBackend() { }
@@ -44,12 +46,12 @@ class TargetBackend

/// This is not a constant function. Because there in case memory emulator
/// must change its internal state.
TargetMemInfo* getMemInfo() { return m_pMemInfo; }
TargetMemInfo* getMemInfo() { return m_pMemInfo.get(); }

const TargetMemInfo* getMemInfo() const { return m_pMemInfo; }
const TargetMemInfo* getMemInfo() const { return m_pMemInfo.get(); }

protected:
TargetMemInfo* m_pMemInfo;
std::unique_ptr<TargetMemInfo> m_pMemInfo;

private:
const TargetOptions& m_TargetOptions;
@@ -1,5 +1,6 @@

add_libonnc_src(
CodeEmit.cpp
ComputeGraph.cpp
ComputeMemOperand.cpp
ComputeOperand.cpp
@@ -44,6 +44,7 @@ Quadruple::ArchType onnc::ParseArch(StringRef pArchName)
.Case("sparcv9", Quadruple::sparcv9)
.Case("tce", Quadruple::tce)
.Case("xcore", Quadruple::xcore)
.Case("nvdla", Quadruple::nvdla)
.Case("nvptx", Quadruple::nvptx)
.Case("nvptx64", Quadruple::nvptx64)
.Case("le32", Quadruple::le32)
@@ -76,6 +77,10 @@ Quadruple::SubArchType onnc::ParseSubArch(StringRef pSubArchName)
.EndsWith("v5t", Quadruple::ARMSubArch_v5)
.EndsWith("v5te", Quadruple::ARMSubArch_v5te)
.EndsWith("v4t", Quadruple::ARMSubArch_v4t)
.EndsWith("fp32", Quadruple::NvDlaSubArch_fp32)
.EndsWith("fp16", Quadruple::NvDlaSubArch_fp16)
.EndsWith("i16", Quadruple::NvDlaSubArch_int16)
.EndsWith("i8", Quadruple::NvDlaSubArch_int8)
.EndsWith("v1680", Quadruple::SophonSubArch_vBM1680)
.EndsWith("v1682", Quadruple::SophonSubArch_vBM1682)
.EndsWith("v1880", Quadruple::SophonSubArch_vBM1880)
@@ -327,6 +332,15 @@ onnc::ArchToName(Quadruple::ArchType pType, Quadruple::SubArchType pSubType)
case Quadruple::x86_64: return "x86_64";
case Quadruple::xcore: return "xcore";
case Quadruple::mblaze: return "mblaze";
case Quadruple::nvdla: {
switch(pSubType) {
case Quadruple::NvDlaSubArch_fp32: return "nvdlafp32";
case Quadruple::NvDlaSubArch_fp16: return "nvdlafp16";
case Quadruple::NvDlaSubArch_int16: return "nvdlai16";
case Quadruple::NvDlaSubArch_int8: return "nvdlai8";
default: return "nvdla";
}
}
case Quadruple::nvptx: return "nvptx";
case Quadruple::nvptx64: return "nvptx64";
case Quadruple::le32: return "le32";
@@ -528,6 +542,7 @@ static unsigned getArchBitWidth(Quadruple::ArchType pArch)
case Quadruple::mblaze:
case Quadruple::mips:
case Quadruple::mipsel:
case Quadruple::nvdla:
case Quadruple::nvptx:
case Quadruple::ppc:
case Quadruple::r600:
@@ -573,6 +588,7 @@ static unsigned getPointerBitWidth(Quadruple::ArchType pArch)
case Quadruple::mblaze:
case Quadruple::mips:
case Quadruple::mipsel:
case Quadruple::nvdla:
case Quadruple::nvptx:
case Quadruple::ppc:
case Quadruple::r600:
@@ -863,21 +879,32 @@ bool Quadruple::isArch32Bit() const

bool Quadruple::isArch16Bit() const
{
if (Quadruple::NvDlaSubArch_int16 == getSubArch())
return true;
return (16 == getArchBitWidth(getArch()));
}

bool Quadruple::isArch8Bit() const
{
return (Quadruple::NvDlaSubArch_int8 == getSubArch());
}

bool Quadruple::isPointer64Bit() const
{
return (64 == getPointerBitWidth(getArch()));
}

bool Quadruple::isPointer32Bit() const
{
if (Quadruple::NvDlaSubArch_fp32 == getSubArch())
return true;
return (32 == getPointerBitWidth(getArch()));
}

bool Quadruple::isPointer16Bit() const
{
if (Quadruple::NvDlaSubArch_fp16 == getSubArch())
return true;
return (16 == getPointerBitWidth(getArch()));
}

@@ -504,7 +504,7 @@ include $(srcdir)/Target/X86/Makefile.am
endif

if ENABLE_NVDLA_TARGET
include $(srcdir)/Target/NVDLA/Makefile.am
include $(srcdir)/Target/NvDla/Makefile.am
endif

# FIXME: embraced by flag?

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
@@ -0,0 +1,17 @@
set(NVDLA_BACKEND_ROOT ${CMAKE_CURRENT_SOURCE_DIR})

include_directories(${NVDLA_BACKEND_ROOT})
include_directories(SYSTEM ${NVDLA_BACKEND_ROOT}/include)

add_libonnc_src(
CodeEmitVisitor.cpp
fp16.c
Loadable.cpp
NvDlaBackend.cpp
NvDlaFileGenPass.cpp
NvDlaMemInfoPass.cpp
NvDlaMeta.cpp
NvDlaTaskSubmitPass.cpp
)

add_subdirectory(TargetInfo)
Oops, something went wrong.

0 comments on commit 93cbca8

Please sign in to comment.