RISC-V tizen build accepted/tizen_unified_riscv accepted/tizen/unified/20231226.154344 accepted/tizen/unified/20231226.180033 accepted/tizen/unified/riscv/20231221.111528
authorHyeongseok Oh <hseok82.oh@samsung.com>
Wed, 20 Dec 2023 07:06:21 +0000 (16:06 +0900)
committerChunseok Lee <chunseok.lee@samsung.com>
Thu, 21 Dec 2023 04:29:07 +0000 (13:29 +0900)
- enable risc-v 64bit tizen build

Signed-off-by: Chunseok Lee <chunseok.lee@samsung.com>
compiler/pp/include/pp/IndentedStringBuilder.h
infra/cmake/modules/IdentifyPlatform.cmake
infra/cmake/packages/FlatBuffers-2.0/FlatBuffersConfig.cmake
infra/nncc/cmake/options/options_riscv64-tizen.cmake [new file with mode: 0644]
infra/nnfw/cmake/buildtool/config/config_riscv64-tizen.cmake [new file with mode: 0644]
infra/nnfw/cmake/options/options_riscv64-tizen.cmake [new file with mode: 0644]
infra/nnfw/config/gbs.conf
packaging/nnfw.spec

index 0240611..ebaaace 100644 (file)
@@ -45,6 +45,8 @@ elseif("${HOST_ARCH}" STREQUAL "aarch64")
   set(HOST_ARCH_BASE "aarch64")
 elseif("${HOST_ARCH}" STREQUAL "i686")
   set(HOST_ARCH_BASE "i686")
+elseif("${HOST_ARCH}" STREQUAL "riscv64")
+  set(HOST_ARCH_BASE "riscv64")
 else()
   message(FATAL_ERROR "'${HOST_ARCH}' architecture is not supported")
 endif()
@@ -65,6 +67,8 @@ elseif("${TARGET_ARCH}" STREQUAL "aarch64")
   set(TARGET_ARCH_BASE "aarch64")
 elseif("${TARGET_ARCH}" STREQUAL "i686")
   set(TARGET_ARCH_BASE "i686")
+elseif("${TARGET_ARCH}" STREQUAL "riscv64")
+  set(TARGET_ARCH_BASE "riscv64")
 else()
   message(FATAL_ERROR "'${TARGET_ARCH}' architecture is not supported")
 endif()
index b7ae666..99da308 100644 (file)
@@ -22,6 +22,9 @@ function(_FlatBuffers_build)
   if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
     set(ADDITIONAL_CXX_FLAGS "-Wno-error=class-memaccess")
   endif()
+  if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 12.0)
+    set(ADDITIONAL_CXX_FLAGS "-Wno-error=stringop-overflow")
+  endif()
 
   nnas_include(ExternalBuildTools)
   ExternalBuild_CMake(CMAKE_DIR   ${FlatBuffersSource_DIR}
diff --git a/infra/nncc/cmake/options/options_riscv64-tizen.cmake b/infra/nncc/cmake/options/options_riscv64-tizen.cmake
new file mode 100644 (file)
index 0000000..d26d034
--- /dev/null
@@ -0,0 +1,3 @@
+#
+# riscv64 tizen cmake options
+#
diff --git a/infra/nnfw/cmake/buildtool/config/config_riscv64-tizen.cmake b/infra/nnfw/cmake/buildtool/config/config_riscv64-tizen.cmake
new file mode 100644 (file)
index 0000000..2345da4
--- /dev/null
@@ -0,0 +1,17 @@
+#
+# riscv64 tizen compile options
+#
+
+message(STATUS "Building for RISC-V64 Tizen")
+
+# Build flag for tizen
+set(CMAKE_C_FLAGS_DEBUG     "-O -g -DDEBUG")
+set(CMAKE_CXX_FLAGS_DEBUG   "-O -g -DDEBUG")
+
+# TODO : add and use option_tizen if something uncommon comes up
+# include linux common
+include("cmake/buildtool/config/config_linux.cmake")
+
+# addition for riscv64-tizen
+set(FLAGS_COMMON ${FLAGS_COMMON}
+    )
diff --git a/infra/nnfw/cmake/options/options_riscv64-tizen.cmake b/infra/nnfw/cmake/options/options_riscv64-tizen.cmake
new file mode 100644 (file)
index 0000000..c2f8c79
--- /dev/null
@@ -0,0 +1,20 @@
+#
+# riscv64 tizen cmake options
+#
+option(BUILD_ARMCOMPUTE "Build ARM Compute from the downloaded source" OFF)
+option(BUILD_TENSORFLOW_LITE "Build TensorFlow Lite from the downloaded source" OFF)
+option(DOWNLOAD_ARMCOMPUTE "Download ARM Compute source" OFF)
+option(DOWNLOAD_GTEST "Download Google Test source and build Google Test" OFF)
+
+option(BUILD_LOGGING "Build logging runtime" OFF)
+option(GENERATE_RUNTIME_NNAPI_TESTS "Generate NNAPI operation gtest" OFF)
+option(ENVVAR_ONERT_CONFIG "Use environment variable for onert configuration" OFF)
+
+option(BUILD_XNNPACK "Build XNNPACK" OFF)
+option(DOWNLOAD_OPENCL_HEADERS "Download opencl headers" OFF)
+
+option(BUILD_NPUD "Build NPU daemon" OFF)
+# Do not allow to use CONFIG option on Tizen
+option(ENVVAR_NPUD_CONFIG "Use environment variable for npud configuration" OFF)
+
+option(BUILD_MINMAX_H5DUMPER "Build minmax h5dumper" OFF)
index 23278bb..5bb7b0c 100644 (file)
@@ -5,8 +5,35 @@ profile = profile.tizen
 [profile.tizen]
 repos = repo.base, repo.unified
 
+[profile.tizen_8]
+repos = repo.base_8, repo.unified_8
+
+[profile.tizen-dev]
+repos = repo.base-dev, repo.unified-dev
+
+[profile.tizen-riscv]
+repos = repo.base-riscv, repo.unified-riscv
+
 [repo.unified]
 url = http://download.tizen.org/snapshots/TIZEN/Tizen-7.0/Tizen-7.0-Unified/latest/repos/standard/packages/
 
 [repo.base]
 url = http://download.tizen.org/snapshots/TIZEN/Tizen-7.0/Tizen-7.0-Base/latest/repos/standard/packages/
+
+[repo.unified_8]
+url = http://download.tizen.org/snapshots/TIZEN/Tizen-8.0/Tizen-8.0-Unified/latest/repos/standard/packages/
+
+[repo.base_8]
+url = http://download.tizen.org/snapshots/TIZEN/Tizen-8.0/Tizen-8.0-Base/latest/repos/standard/packages/
+
+[repo.unified-dev]
+url = http://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Unified-Dev/latest/repos/standard/packages/
+
+[repo.base-dev]
+url = http://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Base-Dev/latest/repos/standard/packages/
+
+[repo.unified-riscv]
+url = https://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Unified-RISCV/latest/repos/standard/packages/
+
+[repo.base-riscv]
+url = https://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Base-RISCV/latest/repos/standard/packages/
index 2a4eb42..e1e39f2 100644 (file)
@@ -49,6 +49,12 @@ Source3020: NEON2SSE.tar.gz
 %define test_build 1
 %endif
 
+%ifarch riscv64
+# Disable npud on risc-v
+# TODO Enable on risc-v
+%define npud_build 0
+%endif
+
 BuildRequires:  cmake
 
 Requires(post): /sbin/ldconfig
@@ -137,6 +143,9 @@ NPU daemon for optimal management of NPU hardware
 %ifarch %ix86
 %define target_arch i686
 %endif
+%ifarch riscv64
+%define target_arch riscv64
+%endif
 
 %define install_dir %{_prefix}
 %define install_path %{buildroot}%{install_dir}
@@ -206,7 +215,7 @@ tar -xf %{SOURCE3019} -C ./externals
 tar -xf %{SOURCE3020} -C ./externals
 
 %build
-%ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
+%ifarch arm armv7l armv7hl aarch64 x86_64 %ix86 riscv64
 # nncc build
 %if %{odc_build} == 1
 %{nncc_env} ./nncc configure -DBUILD_GTEST=OFF -DENABLE_TEST=OFF -DEXTERNALS_BUILD_THREADS=%{nproc} -DCMAKE_BUILD_TYPE=%{build_type} -DTARGET_ARCH=%{target_arch} -DTARGET_OS=tizen \
@@ -238,7 +247,7 @@ tar -zcf test-suite.tar.gz infra/scripts
 %endif # arm armv7l armv7hl aarch64
 
 %install
-%ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
+%ifarch arm armv7l armv7hl aarch64 x86_64 %ix86 riscv64
 
 mkdir -p %{buildroot}%{_libdir}
 mkdir -p %{buildroot}%{_bindir}
@@ -312,7 +321,7 @@ install -m 755 build/out/npud-gtest/* %{test_install_path}/npud-gtest
 %files
 %manifest %{name}.manifest
 %defattr(-,root,root,-)
-%ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
+%ifarch arm armv7l armv7hl aarch64 x86_64 %ix86 riscv64
 %{_libdir}/*.so
 %exclude %{_includedir}/CL/*
 %endif
@@ -320,7 +329,7 @@ install -m 755 build/out/npud-gtest/* %{test_install_path}/npud-gtest
 %files devel
 %manifest %{name}.manifest
 %defattr(-,root,root,-)
-%ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
+%ifarch arm armv7l armv7hl aarch64 x86_64 %ix86 riscv64
 %dir %{_includedir}/nnfw
 %{_includedir}/nnfw/*
 %{_libdir}/pkgconfig/nnfw.pc
@@ -329,13 +338,13 @@ install -m 755 build/out/npud-gtest/* %{test_install_path}/npud-gtest
 %files plugin-devel
 %manifest %{name}.manifest
 %defattr(-,root,root,-)
-%ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
+%ifarch arm armv7l armv7hl aarch64 x86_64 %ix86 riscv64
 %dir %{_includedir}/onert
 %{_includedir}/onert/*
 %{_libdir}/pkgconfig/nnfw-plugin.pc
 %endif
 
-%ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
+%ifarch arm armv7l armv7hl aarch64 x86_64 %ix86 riscv64
 %files minimal-app
 %manifest %{name}.manifest
 %defattr(-,root,root,-)
@@ -356,7 +365,7 @@ install -m 755 build/out/npud-gtest/* %{test_install_path}/npud-gtest
 %files npud
 %manifest %{name}.manifest
 %defattr(-,root,root,-)
-%ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
+%ifarch arm armv7l armv7hl aarch64 x86_64 %ix86 riscv64
 %{_bindir}/npud
 %endif # arm armv7l armv7hl aarch64 x86_64 %ix86
 %endif # npud_build
@@ -365,7 +374,7 @@ install -m 755 build/out/npud-gtest/* %{test_install_path}/npud-gtest
 %files odc
 %manifest %{name}.manifest
 %defattr(-,root,root,-)
-%ifarch arm armv7l armv7hl aarch64 x86_64 %ix86
+%ifarch arm armv7l armv7hl aarch64 x86_64 %ix86 riscv64
 %dir %{_libdir}/nnfw/odc
 %{_libdir}/nnfw/odc/*
 %endif # arm armv7l armv7hl aarch64 x86_64 %ix86