One: Compiler FE: prepare windows SDK release

Created on 10 Jun 2020  ยท  5Comments  ยท  Source: Samsung/ONE

Let's start preparing for compiler windows SDK release.

We have already prepared for it last year, it is expected to go smoothly. But since there have been many changes so far, it may be different from what we thought it would be. To prevent this, prepare in advance:)

These are what I'm gonna do. Please feel free to add what you think we have to do=)

  • [x] Build our compiler on Windows
  • [x] Make sure nnpkg works as expected
  • [x] Decide which compiler module to include in SDK
  • [x] Think about use cases to determine the nnpkg user interfaces

All 5 comments

Build our compiler on Windows

$ ./nnas create-package --prefix install
-- Use '20200508' SDK preset
-- Building for: Visual Studio 16 2019
-- The C compiler identification is MSVC 19.24.28314.0
-- The CXX compiler identification is MSVC 19.24.28314.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Use 'release' configuration
-- Download GTEST from https://github.com/google/googletest/archive/release-1.8.0.tar.gz
-- Download GTEST from https://github.com/google/googletest/archive/release-1.8.0.tar.gz - done
-- Extract GTEST
-- Extract GTEST - done
-- Cleanup GTEST
-- Cleanup GTEST - done
-- Build GTEST from C:/git-sdk-64/ONE/infra/nncc/../../externals/GTEST
CMake Error at C:/git-sdk-64/ONE/infra/cmake/modules/ExternalBuildTools.cmake:78 (message):
  GTEST Package: Installation failed (check
  'C:/Users/sw4670.chae/AppData/Local/Temp/tmp.xsO1Y9Ck3H/nncc/overlay/GTEST.log'
  for details)
Call Stack (most recent call first):
  C:/git-sdk-64/ONE/infra/cmake/packages/GTestConfig.cmake:13 (ExternalBuild_CMake)
  C:/git-sdk-64/ONE/infra/cmake/packages/GTestConfig.cmake:21 (_GTest_build)
  CMakeLists.txt:43 (find_package)
  CMakeLists.txt:105 (nnas_find_package)


-- Configuring incomplete, errors occurred!
See also "C:/Users/sw4670.chae/AppData/Local/Temp/tmp.xsO1Y9Ck3H/nncc/CMakeFiles/CMakeOutput.log".
.NET Frameworkโ–’โ–’ Microsoft (R) Build Engine โ–’โ–’โ–’โ–’ 16.4.0+e901037fe
Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD : error MSB1001: โ–’โ–’ โ–’โ–’ โ–’โ–’โ–’โ–’ โ–’โ–’โ–’โ–’ฤกโ–’ิดฯดโ–’.
โ–’โ–’โ–’โ–’ฤก: -j4

โ–’โ–’โ–’โ–’ฤก โ–’โ–’โ–’โ–’โ–’โ–’ โ–’โ–’โ–’โ–’โ–’โ–’ "MSBuild -help"โ–’โ–’ โ–’ิทโ–’โ–’ฯผโ–’โ–’โ–’.
.NET Frameworkโ–’โ–’ Microsoft (R) Build Engine โ–’โ–’โ–’โ–’ 16.4.0+e901037fe
Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD : error MSB1008: โ–’โ–’โ–’โ–’โ–’โ–’ฦฎโ–’โ–’ โ–’ฯณโ–’โ–’โ–’ โ–’โ–’โ–’โ–’โ–’โ–’ โ–’โ–’ โ–’ึฝโ–’โ–’ฯดโ–’.
โ–’โ–’โ–’โ–’ฤก: install

โ–’โ–’โ–’โ–’ฤก โ–’โ–’โ–’โ–’โ–’โ–’ โ–’โ–’โ–’โ–’โ–’โ–’ "MSBuild -help"โ–’โ–’ โ–’ิทโ–’โ–’ฯผโ–’โ–’โ–’.
Looking in links: c:\Users\SW4670~1.CHA\AppData\Local\Temp\tmpr3qo7kw4
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-19.2.3 setuptools-41.2.0
Collecting pip
  Downloading https://files.pythonhosted.org/packages/43/84/23ed6a1796480a6f1a2d38f2802901d078266bda38388954d01d3f2e821d/pip-20.1.1-py2.py3-none-any.whl (1.5MB)
     |################################| 1.5MB 409kB/s
Collecting setuptools
  Downloading https://files.pythonhosted.org/packages/95/95/f657b6e17f00c3f35b5f68b10e46c3a43af353d8856bd57bfcfb1dbb3e92/setuptools-47.1.1-py3-none-any.whl (583kB)
     |################################| 583kB 1.6MB/s
Installing collected packages: pip, setuptools
  Found existing installation: pip 19.2.3
    Uninstalling pip-19.2.3:
      Successfully uninstalled pip-19.2.3
  Found existing installation: setuptools 41.2.0
    Uninstalling setuptools-41.2.0:
      Successfully uninstalled setuptools-41.2.0
Successfully installed pip-20.1.1 setuptools-47.1.1
ERROR: Could not find a version that satisfies the requirement tensorflow==2.2.0 (from versions: none)
ERROR: No matching distribution found for tensorflow==2.2.0


:unamused:

  1. failed build GTEST -> build off
  2. failed install tensorflow -> native install and copy to mingw
  3. liunx only header file -> change to standard library

nnpkg user interfaces

nnpkg's usage is like below as of now.

Usage: tf2nnpkg --info <path/to/info> --graphdef <path/to/pb> [OPTION] -o <path/to/nnpkg/directory>

Since circle2circle has come in, we need to extend the option argument to pass it to circle2circle.

circle2circle's usage is like below.

Optimization options: 
   --fuse_bcq : Enable FuseBCQ Pass
   --fuse_instnorm : Enable FuseInstanceNormalization Pass
   --resolve_customop_add : Enable ResolveCustomOpAddPass Pass
   --resolve_customop_batchmatmul : Enable ResolveCustomOpBatchMatMulPass Pass
   --quantize_with_minmax : Enable QuantizeWithMinMax Pass
                            Require three following parameters (input_dtype, output_dtype, granularity)
                            Ex: --quantize_with_minmax float32 uint8 layer
   --quantize_dequantize_weights : Enable QuantizeDequantizeWeights Pass
                            Require three following parameters (input_dtype, output_dtype, granularity)
                            Ex: --quantize_dequantize_weights float32 uint8 channel

There are two categories.

  1. optimization : fuse_bcq, fuse_instnorm, resolve_customop_add, resolve_customop_batchmatmul
  2. quantization : quantize_with_minmax, quantize_dequantize_weights

I think users expect the optimization pass to be ON by default. So what I think its interface have to be is like this.

[OPTIONS]
--off_fuse_bcq
--off_fuse_instnorm
--off_resolve_customop_add
--off_resolve_customop_batchmatmul
--quantize_with_minmax input_dtype output_dtype granularity
--quantize_dequantize_weights input_dtype output_dtype granularity

What I think is;

  • (1) in nnpkg, we turn on all the options for default. there is no turn-off option for now.
  • (2) give -O0 for no optimization, -Oc to resolve all possible custom, -Of to fuse all possible fusion
  • (3) give -O0 to turn off all optimization, -O1 to turn on all optimization
  • (4) ...

(1) is not good... :)

And for quantization we there are steps so we may think different for this... need more time for this :)

@seanshpark
I think 1 + 2 looks good.
Turn on all the options for default. If given -O0, no optimization. If given -O1, some optimization and so on. And It doesn't seem necessary to tell the user which pass is turned on for each level.

usage is just simple like this

USAGE: tf2nnpkg --info <path/to/info> --graphdef <path/to/pb> -o <path/to/nnpkg/directory> [-O{opt-level}]

And for quantization we there are steps so we may think different for this... need more time for this :)

I agree:) Maybe we will discuss this after e2e quant module comes in.

@jinevening , can you please describe in simple steps of quantization?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KimDongEon picture KimDongEon  ยท  4Comments

kishcs picture kishcs  ยท  3Comments

wateret picture wateret  ยท  4Comments

dr-venkman picture dr-venkman  ยท  4Comments

lucenticus picture lucenticus  ยท  3Comments