platform/adaptation/npu/trix-engine.git
4 years ago[BUG] Fix the wrong encoding for input/output offset when generating a NPU model
Dongju Chae [Thu, 31 Oct 2019 08:17:10 +0000 (17:17 +0900)]
[BUG] Fix the wrong encoding for input/output offset when generating a NPU model

This commit fixes the wrong encoding for input/output offset when generating a NPU model.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
4 years ago[FIX] fix the bug in example_visa apptest when it handles fgetc
Dongju Chae [Thu, 31 Oct 2019 08:14:14 +0000 (17:14 +0900)]
[FIX] fix the bug in example_visa apptest when it handles fgetc

This commit fixes the bug in example_visa apptest.

As fgetc() returns integer type not charactor type, it should be fixed.
Otherwise, the EOF check can be failed.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
4 years ago[BUG] fix srnpu unittests to use valid dmabuf id
Dongju Chae [Wed, 30 Oct 2019 12:47:11 +0000 (21:47 +0900)]
[BUG] fix srnpu unittests to use valid dmabuf id

This commit fixes srnpu unittests to use valid dmabuf ids with cgem/srtlb.
In NE_TEST_MODE=0 (i.e., real mode in FastModel), we need to carefuly set ioctl parameters.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
4 years ago[BUG] Fix the wrong ioctl arguments in srnpu APIs
Dongju Chae [Wed, 30 Oct 2019 12:26:56 +0000 (21:26 +0900)]
[BUG] Fix the wrong ioctl arguments in srnpu APIs

This commit fixes the wrong ioctl arguments in srnpu APIs

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
4 years agoRevert "[BUG/NPU] bug fix in npu_open() for fd return"
채동주/On-Device Lab(SR)/Staff Engineer/삼성전자 [Wed, 30 Oct 2019 10:25:17 +0000 (19:25 +0900)]
Revert "[BUG/NPU] bug fix in npu_open() for fd return"

This reverts commit d273a2553b48f73d29070aadd7725752ae74089e.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
4 years ago[BUG] Fix wrong ioctl argument for dmabuf mapping
Dongju Chae [Wed, 30 Oct 2019 09:44:52 +0000 (18:44 +0900)]
[BUG] Fix wrong ioctl argument for dmabuf mapping

This commit fixes wrong ioctl argument for dmabuf mapping

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
4 years ago[BUG] Fix bugs in the unittest for srtlb APIs
Dongju Chae [Wed, 30 Oct 2019 03:07:09 +0000 (12:07 +0900)]
[BUG] Fix bugs in the unittest for srtlb APIs

This commit fixes bugs in the unittest for srtlb APIs.

When dmabuf fds are mapped to srtlb driver, they should be valid.
So, this patch uses the exsiting APIs providing dmabuf-sharing, cgem APIs in NE.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
4 years ago[BUG/NPU] bug fix in npu_open() for fd return
Dongju Chae [Mon, 28 Oct 2019 11:15:38 +0000 (20:15 +0900)]
[BUG/NPU] bug fix in npu_open() for fd return

This commit fixes the bug in npu_open(), which returns id not fd.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
4 years ago[ASR] Add skeleton for ASR support
MyungJoo Ham [Tue, 3 Sep 2019 07:39:48 +0000 (16:39 +0900)]
[ASR] Add skeleton for ASR support

ASR (Automatic Speech Recognition), which uses SRP for Audio, support is required.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
4 years ago[TLBdrvAPI] sr TLB API driver implementation
Parichay Kapoor [Mon, 14 Oct 2019 07:13:29 +0000 (16:13 +0900)]
[TLBdrvAPI] sr TLB API driver implementation

Added sr TLB driver implementation
Added unittests for TLB api driver
Bug fix for hash table hashing generating constant

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
4 years ago[n4/n3] return buffer in case of error
Parichay Kapoor [Fri, 25 Oct 2019 07:45:47 +0000 (16:45 +0900)]
[n4/n3] return buffer in case of error

Return the buffer in case of error from NPU state to output state
This avoids hung state when error occurs or stop called in between processing the buffer

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
4 years ago[APPTEST] Add the apptest to test example visa binaries
Dongju Chae [Thu, 24 Oct 2019 10:54:02 +0000 (19:54 +0900)]
[APPTEST] Add the apptest to test example visa binaries

This commit adds the apptest to test example visa binaries.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
4 years ago[TEST] Add a script to generete a NPU model with visa data
Dongju Chae [Fri, 25 Oct 2019 05:23:23 +0000 (14:23 +0900)]
[TEST] Add a script to generete a NPU model with visa data

This commit adds a script to generate NPU model with visa data files.
Currently, we don't have compiled binaries, which means we have to generate test models with this.
Also, it adds testdata which contains both visa data and pre-generated binaries.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
4 years ago[DMABUF] Add new APIs for sync features on dmabuf
Dongju Chae [Mon, 14 Oct 2019 05:22:01 +0000 (14:22 +0900)]
[DMABUF] Add new APIs for sync features on dmabuf

This commit adds new APIs for sync features on dmabuf.
Also, its clients (such as ne-mem) should make sure that mmap() for dmabuf is being used for sync.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[mem/npu] Add register of dmabuf when alloc memory
Parichay Kapoor [Fri, 27 Sep 2019 10:57:56 +0000 (19:57 +0900)]
[mem/npu] Add register of dmabuf when alloc memory

Added registration of dmabuf fd when memory is allocated in ne-mem
Correspondingly de-registration is also added
Registration is performed for all hwmem_type allocated by ne-mem

Added TLB user side driver along with interface to register/deregister dmabuf
Using dmabuf id in host input service when calling NPU driver

V2:
Renamed functions in GEMdrvAPI
gem_prime_export() -> gem_prime_handle_to_fd()
gem_prime_import() -> gem_prime_fd_to_handle()
add close(dmabuf_fd) for dmabuf_fd received via gem_prime_handle_to_fd()

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[TLBdrvAPI] Added TLB user-side API skeleton
Parichay Kapoor [Tue, 1 Oct 2019 07:45:55 +0000 (16:45 +0900)]
[TLBdrvAPI] Added TLB user-side API skeleton

Added user side API skeleton for translation lookaside buffer

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[MEM] Resolve the race condition bug in buffer resizing
Dongju Chae [Tue, 1 Oct 2019 08:00:06 +0000 (17:00 +0900)]
[MEM] Resolve the race condition bug in buffer resizing

This commit resolves the race condition bug in buffer resizing.
It introduces reference counters to track of buffer usage.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[MEM] Revise enum hwmem_type for readability
Dongju Chae [Tue, 1 Oct 2019 03:59:34 +0000 (12:59 +0900)]
[MEM] Revise enum hwmem_type for readability

This commit revised `enum hwmem_type` for readability.
Originally, HWMEM_TYPE_BUFFER/MODEL/USER are used but they don't represent their properties.
Instead of them, I add three types

- HWMEM_TYPE_INTERNAL_POOL: hwmem mananged in memory pool
- HWMEM_TYPE_INTERNAL_CMA: hwmem managed in kernel cma
- HWMEM_TYPE_EXTERNAL: external hwmem that cannot be mananged in NE

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[NPUdrvAPI] Updated interface
Parichay Kapoor [Fri, 20 Sep 2019 05:02:13 +0000 (14:02 +0900)]
[NPUdrvAPI] Updated interface

Updated the interface of NPU user side driver based on updated memory interface
and remove the support of icam/other modes

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[MEM] Rename the API 'get_size' to 'get_pool_size'
Dongju Chae [Wed, 25 Sep 2019 06:12:23 +0000 (15:12 +0900)]
[MEM] Rename the API 'get_size' to 'get_pool_size'

This commit renames the API 'get_size', which is an ambiguous name, to 'get_pool_size'.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[GEM] Add an extra argument for cacheable GEM buffer
Dongju Chae [Mon, 23 Sep 2019 06:13:19 +0000 (15:13 +0900)]
[GEM] Add an extra argument for cacheable GEM buffer

This commit adds an extra argument for cacheable GEM buffer.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[AppTest] add AppTest to test dma-buf sharing for I/O buffers
Dongju Chae [Mon, 23 Sep 2019 05:55:34 +0000 (14:55 +0900)]
[AppTest] add AppTest to test dma-buf sharing for I/O buffers

This commit adds new AppTest to test dma-buf sharing for I/O buffers.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[LIBHOST] Add a user-level API to allocate a generic_buffer
Dongju Chae [Fri, 20 Sep 2019 10:12:28 +0000 (19:12 +0900)]
[LIBHOST] Add a user-level API to allocate a generic_buffer

This commit adds a user-level API to allocate a gneneric_buffer for each buffer type
In case of BUFFER_DMABUF, KERNEL_CMA mode should be enabled (i.e., resv_mem_size == 0).

Also, some test codes are modified due to APIs are changed.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[ReadMe] Fix unshown badges in README.md
Wook Song [Thu, 19 Sep 2019 07:40:48 +0000 (16:40 +0900)]
[ReadMe] Fix unshown badges in README.md

After github.sec is upgraded, the badges in README.md has been not shown
anymore. In order to fix this issue (#226), the links pointing the svg
files are changed to another repository in github.sec.
coverage-generator.sh in the CI system used by this project is also
modified to fix this issue.

Signed-off-by: Wook Song <wook16.song@samsung.com>
5 years ago[packaging] Dsiable track-origins for unittests
Parichay Kapoor [Fri, 20 Sep 2019 04:46:40 +0000 (13:46 +0900)]
[packaging] Dsiable track-origins for unittests

Disabling track origins for unittest
ne_core_ip_test_default_conf.registerNPUmodel_large_size ends up consuming more than **30GB**
creating problems when running with track-origins

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[host-input-service] bugfix for base address
Parichay Kapoor [Wed, 18 Sep 2019 06:50:11 +0000 (15:50 +0900)]
[host-input-service] bugfix for base address

Corrected using hwmem_get_offset instead of hwmem_get_data

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[LIBHOST] Fix the linking problem for APIs in CPP applications
Dongju Chae [Tue, 17 Sep 2019 06:20:07 +0000 (15:20 +0900)]
[LIBHOST] Fix the linking problem for APIs in CPP applications

This patch fixes the linking problem in CPP applications by appending cpp check macros.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[BUG FIX] Fix the assertion error of 'DummyInference' on aarch64 using GBS build
Dongju Chae [Tue, 17 Sep 2019 12:37:50 +0000 (21:37 +0900)]
[BUG FIX] Fix the assertion error of 'DummyInference' on aarch64 using GBS build

This commit fixes the bug related to assertion error of 'DummyInference' on aarch64 using GBS build.

The patch includes

1) Change the destructor order between input service and ip plugin.
-- The destructor of input service should be called before that of IP plugin because input service's callback threads still acccess memory allocator's functions.

2) Ensure the callback threads are finished before freeing resources in the destructor of host input service.
-- Otherwise, it can cause the deadlock issue when the destructor frees the resources early.

3) Add check routine in `return_buffer()` whether buffers are valid or not.
-- Actually, it's an ad-hoc patch because the fundamental solution needs the sync feature in `resize_buffers()` to ensure that resizing buffers is safe. This will be updated in later commits.

It resolves #228.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[Test/Utils] Clean code and handle BUFFER_UNDEFINED
Wook Song [Mon, 16 Sep 2019 07:21:14 +0000 (16:21 +0900)]
[Test/Utils] Clean code and handle BUFFER_UNDEFINED

This patch refactors the test utility functions.

Signed-off-by: Wook Song <wook16.song@samsung.com>
5 years ago[Tests/IP] Revise the test case named 'registerNPUmodel_large_size'
Wook Song [Mon, 16 Sep 2019 06:25:30 +0000 (15:25 +0900)]
[Tests/IP] Revise the test case named 'registerNPUmodel_large_size'

This patch revises the test case, 'registerNPUmodel_large_size' in the
'ne_core_ip_test_default_conf' test group.

Signed-off-by: Wook Song <wook16.song@samsung.com>
5 years ago[README] Revise README.md in root dir to add useful info
Dongju Chae [Mon, 16 Sep 2019 12:00:40 +0000 (21:00 +0900)]
[README] Revise README.md in root dir to add useful info

This commit revises README.md in root dir to add useful info.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[MEM/IP] Support dma-buf sharing for I/O buffers
Dongju Chae [Mon, 16 Sep 2019 09:42:09 +0000 (18:42 +0900)]
[MEM/IP] Support dma-buf sharing for I/O buffers

This commit enables dma-buf shring for I/O buffers.
New APIs, buffer_get_dmabuf and bufferget_dmabuf, are added.
It also changes some codes in IP plugin to use these APIs.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[README] Add README.md for user APIs
Dongju Chae [Mon, 16 Sep 2019 06:19:37 +0000 (15:19 +0900)]
[README] Add README.md for user APIs

This commit adds `README.md` which describes how users can build their application with NPU Engine library (i.e., `libhosthost.h`) and the API's detail usage.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[Handler] Minor fix on ne-handler.c
Dongju Chae [Wed, 11 Sep 2019 08:02:44 +0000 (17:02 +0900)]
[Handler] Minor fix on ne-handler.c

This commit applies some minor fix such as removing uncessary lines and adding error checking.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[Mem] Refactor mem_alloc()
Wook Song [Mon, 16 Sep 2019 08:00:40 +0000 (17:00 +0900)]
[Mem] Refactor mem_alloc()

This patch refactors the mem_alloc function to improve readability.

Signed-off-by: Wook Song <wook16.song@samsung.com>
5 years ago[AppTest] add AppTest to test dma-buf sharing for model data
Dongju Chae [Mon, 16 Sep 2019 04:35:56 +0000 (13:35 +0900)]
[AppTest] add AppTest to test dma-buf sharing for model data

This PR adds new AppTest to test dma-buf sharing for model data.
Also, there are minor changes in other unittests due to the updated common API.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[NPU] Fix ioctl() warnings in NPU driver API
Dongju Chae [Wed, 11 Sep 2019 08:18:48 +0000 (17:18 +0900)]
[NPU] Fix ioctl() warnings in NPU driver API

This commit fixes ioctl() warnings in NPU driver API.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[MEM] Revise .get_dmabuf() to support KERNEL_CMA
Dongju Chae [Tue, 10 Sep 2019 05:45:32 +0000 (14:45 +0900)]
[MEM] Revise .get_dmabuf() to support KERNEL_CMA

This commit revise .get_dmabuf() to support KERNEL_CMA mode.
Currently, get_dmabuf() returns the global dmabuf fd for internal memory pool.
As KERNEL_CMA mode handles multiple CMA buffers, it should be revised to support this.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[MEM] Fix error return statements
Dongju Chae [Wed, 11 Sep 2019 07:28:53 +0000 (16:28 +0900)]
[MEM] Fix error return statements

This commit fixes error return statements in some functions to keep the same format.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[CONF] Replace sscanf() to strtoull() for parsing 'resv_mem_size'
Dongju Chae [Wed, 11 Sep 2019 04:52:14 +0000 (13:52 +0900)]
[CONF] Replace sscanf() to strtoull() for parsing 'resv_mem_size'

This commit replaces sscanf() to strtoull() for parsing `resv_mem_size` to avoid unexpected errors.
It resolves #215.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[IP] Change IP-plugin to use dmabuf_register() for BUFFER_DMABUF
Dongju Chae [Tue, 10 Sep 2019 05:36:21 +0000 (14:36 +0900)]
[IP] Change IP-plugin to use dmabuf_register() for BUFFER_DMABUF

This commit changes IP-plugin to use `dmabuf_register()` for BUFFER_DMABUF type.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[CONF] Enable KERNEL_CMA as default in FastModel
Dongju Chae [Fri, 6 Sep 2019 10:39:25 +0000 (19:39 +0900)]
[CONF] Enable KERNEL_CMA as default in FastModel

This commit enables KERNEL_CMA as default in FastModel.
A zero-sized reserved memory indicates that the memory allocator used Kernel's CMA allocation.
In order to accept the zero size, ne-conf.c should be changed.

Also, some minor bugs are fixed

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[MEM] Add new API, register_dmabuf, to register pre-allocated dmabuf as a hwmem
Dongju Chae [Fri, 6 Sep 2019 08:01:04 +0000 (17:01 +0900)]
[MEM] Add new API, register_dmabuf, to register pre-allocated dmabuf as a hwmem

This commit adds new API in memory allocator to register a pre-allocated dmabuf as a hwmem for user-provided mem.

A user has its ownership to allocate and free, and memory allocator may not manage such memory explicitly.
As long as it can be exported as dmabuf fd, any memory source will be fine because it's physically contiguous.
Users can allocate such memory from NPU engine or other third-party libaries.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[BUG] Fix the bug caused by a non-terminated thread in destructor
Dongju Chae [Fri, 6 Sep 2019 03:41:08 +0000 (12:41 +0900)]
[BUG] Fix the bug caused by a non-terminated thread in destructor

This commit fixes the bug in `ne-host-input-service.c`.

Sometimes, `cb_thread` is not terminiated until the destructor is called.
In this case, `pthread_cond_destroy()` generates unexpected bugs because cb_thread is still using this cond (e.g., `pthread_cond_broadcast()` at exit).
So, the destructor needs to make sure that `cb_thread` is terminated or not.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[Handler] Revise APIs in ne-handler
Dongju Chae [Fri, 6 Sep 2019 03:54:07 +0000 (12:54 +0900)]
[Handler] Revise APIs in ne-handler

This commit revises APIs in ne-handler such as

1) remove getAvailableModelMemory()
--> it does not provide useful information because we cannot guarantee the available memory size due to compaction. Also, in Kernel-CMA mode, it's impossible to provide this API.

2) add getSizeModels/getSizeBuffers()
--> it provides memory usage information of model and buffers to users.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[ASR] Add device-type for ASR
MyungJoo Ham [Thu, 5 Sep 2019 10:28:02 +0000 (19:28 +0900)]
[ASR] Add device-type for ASR

1. Rename "npu_type" to "dev_type" support ASR IP.
2. Add ASR types.

This is the prerequisite of #199

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Suggested-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[MEM] Revise N71 to support KERNEL_CMA
Dongju Chae [Wed, 4 Sep 2019 10:13:23 +0000 (19:13 +0900)]
[MEM] Revise N71 to support KERNEL_CMA

This commit revises the impl. of memory allocator to support kernel CMA-based memory allocation.

It adds COMPACT_MODE_KERNEL_CMA selected when the passed memory pool size is zero (in init()).

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[README] add the unittest badge into README.md
Dongju Chae [Thu, 5 Sep 2019 05:57:34 +0000 (14:57 +0900)]
[README] add the unittest badge into README.md

This badge shows the number of unittests (and apptests) which are successfully executed.
To generate the badge, it requires gtest output files (.xml).

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[README] Change the url of coverage badge (http --> https)
Dongju Chae [Wed, 4 Sep 2019 10:31:23 +0000 (19:31 +0900)]
[README] Change the url of coverage badge (http --> https)

This commit changes the url of coverage badge to use https instead of http.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[Bug/Test] Bug fix in ne-handler unittest when obtaining data pointers
Dongju Chae [Tue, 3 Sep 2019 12:11:36 +0000 (21:11 +0900)]
[Bug/Test] Bug fix in ne-handler unittest when obtaining data pointers

This commit fixes bugs in ne-handler unittest, which obtained data pointers without activating their hwmems.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[README] Add the coverage badge in README.md
Dongju Chae [Tue, 3 Sep 2019 03:51:26 +0000 (12:51 +0900)]
[README] Add the coverage badge in README.md

This commit adds the coverage badge in README.md

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[AppTest] Make AppTest, async_callbacks, use ne_test_utils.h
Dongju Chae [Tue, 3 Sep 2019 12:17:08 +0000 (21:17 +0900)]
[AppTest] Make AppTest, async_callbacks, use ne_test_utils.h

This commit changes AppTest, async_callbacks, to use ne_test_utils.h.
Also, alloc_generic_buffer now has an extra argument for a buffer type.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[GEM] Revise GEM APIs to support multiple malloc-ed addrs in test mode
Dongju Chae [Tue, 27 Aug 2019 10:48:46 +0000 (19:48 +0900)]
[GEM] Revise GEM APIs to support multiple malloc-ed addrs in test mode

This commit revises GEM APIs such as
- support multiple virtual malloc-ed addresses used in test mode
- remove uncessary argument in mmap()

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[IP-plugin] Reuse the codes in runNPU_async() for runNPU_sync()
Dongju Chae [Tue, 3 Sep 2019 11:57:14 +0000 (20:57 +0900)]
[IP-plugin] Reuse the codes in runNPU_async() for runNPU_sync()

This commit changes the code flow of runNPU_sync() to be the same with runNPU_async().
runNPU_sync() uses the internal output callback to reuse existing codes in runNPU_async().

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[Bug] Fix deadlock bug in ip plugin to handle async callbacks
Dongju Chae [Thu, 29 Aug 2019 05:57:50 +0000 (14:57 +0900)]
[Bug] Fix deadlock bug in ip plugin to handle async callbacks

This commit fixes the deadlock in ip plugin when handling async callbacks

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[Bug] Replace 'npuengine' in some files to 'npu-engine'
Dongju Chae [Tue, 3 Sep 2019 05:42:01 +0000 (14:42 +0900)]
[Bug] Replace 'npuengine' in some files to 'npu-engine'

This commit replaces 'npuengine' in some files to 'npu-engine'.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[Bug] bug fix in output callback handling
Dongju Chae [Thu, 29 Aug 2019 11:09:18 +0000 (20:09 +0900)]
[Bug] bug fix in output callback handling

This commit fixes minor bugs in output callback handling.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[API] Revise buffer types defined in libnpuhost.h
Dongju Chae [Thu, 29 Aug 2019 07:45:21 +0000 (16:45 +0900)]
[API] Revise buffer types defined in libnpuhost.h

This commit revises the buffer types defined in libnpuhost.h.

1) BUFFER_CONT/BUFFER_NON_CONT --> BUFFER_MAPPED

`BUFFER_CONT` cannot be used for user-provided buffers to avoid memory copies, because there is no way to find out their physical address.
For the purpose of avoiding memory copy, dma-buf sharing would be enough.
Also, `BUFFER_MAPPED` will indicate that the buffer already has a mapped buffer and users just can access this.

2) BUFFER_FD --> BUFFER_DMABUF

`BUFFER_FD` is somewhat ambiguous and confused with `BUFFER_FILE`.
So it's changed to `BUFFER_DMABUF`.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[NPUdrvAPI/test] Bug fix for npu open name
Parichay Kapoor [Thu, 22 Aug 2019 12:29:27 +0000 (21:29 +0900)]
[NPUdrvAPI/test] Bug fix for npu open name

Added bug fix for opening npu device name
Added check for npu test cases based on testmode or not
This fix makes npu dev_open_close work with npu fast model simulator

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[Core/Utils] Make logging utility functions be thread-safe
Wook Song [Fri, 23 Aug 2019 10:18:40 +0000 (19:18 +0900)]
[Core/Utils] Make logging utility functions be thread-safe

This patch makes logging utility functions be thread-safe.

Signed-off-by: Wook Song <wook16.song@samsung.com>
5 years ago[Core/Utils] Replace malloc() for logging
Wook Song [Fri, 23 Aug 2019 08:23:41 +0000 (17:23 +0900)]
[Core/Utils] Replace malloc() for logging

This patch replaces a malloc function for logging with char array.

Signed-off-by: Wook Song <wook16.song@samsung.com>
5 years ago[Tests/IP] Add test cases for registerNPUmodel() with default conf
Wook Song [Fri, 23 Aug 2019 07:28:25 +0000 (16:28 +0900)]
[Tests/IP] Add test cases for registerNPUmodel() with default conf

This patch adds unit test cases for the functions related to
getNPUdevice() and registerNPUmodel() when the default conf is used.

Signed-off-by: Wook Song <wook16.song@samsung.com>
5 years ago[Core/IP] bugfix: Make sure to return negative value for the error case
Wook Song [Fri, 23 Aug 2019 03:46:35 +0000 (12:46 +0900)]
[Core/IP] bugfix: Make sure to return negative value for the error case

In the 'registerNPUmodel' function, there is a case that returns 0
(which means NO ERROR) even if the 'registerNPUmodelmem' function is
failed. This patch fixes this bug.

Signed-off-by: Wook Song <wook16.song@samsung.com>
5 years ago[Core/IP] Refactor the registerNPUmodelmem function
Wook Song [Tue, 20 Aug 2019 04:30:35 +0000 (13:30 +0900)]
[Core/IP] Refactor the registerNPUmodelmem function

This patch refactors the registerNPUmodelmem function including addition
of missing free().

Signed-off-by: Wook Song <wook16.song@samsung.com>
5 years ago[Tests] Separate utilities for creation of dummy model and buffer
Wook Song [Wed, 21 Aug 2019 06:46:31 +0000 (15:46 +0900)]
[Tests] Separate utilities for creation of dummy model and buffer

In order to make unit tests for several modules such as plugin-comm-ip
or app tests, it is required to create dummy models to be provided.
Fortunately, those procedure is already included in the
'dummy_inference' app test. Therefore, this patch separates those utility
functions for creation of dummy model and generic buffer from the
'dummy_inference' apptest. According to this change, dummy_inference
is also modified to use those separated functions.

Signed-off-by: Wook Song <wook16.song@samsung.com>
5 years ago[Core/IP] bugfix: Add a missing parameter to loginfo
Wook Song [Thu, 22 Aug 2019 02:18:04 +0000 (11:18 +0900)]
[Core/IP] bugfix: Add a missing parameter to loginfo

This patch fixes a bug which is that a required parameter is omitted
from loginfo in runNPU_sync().

Signed-off-by: Wook Song <wook16.song@samsung.com>
5 years ago[test/handler] Adding unittest for handler
Parichay Kapoor [Fri, 16 Aug 2019 05:21:34 +0000 (14:21 +0900)]
[test/handler] Adding unittest for handler

Adding unittest for handler and corresponding fixes

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[GEM] Change the base path of GEM driver
Dongju Chae [Wed, 21 Aug 2019 09:35:53 +0000 (18:35 +0900)]
[GEM] Change the base path of GEM driver

This commit changes the base path of GEM driver
: /dev/dri/cardXX --> /dev/cardXX

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[AppTest] Add an example AppTest to test async output callbacks
Dongju Chae [Wed, 21 Aug 2019 09:43:40 +0000 (18:43 +0900)]
[AppTest] Add an example AppTest to test async output callbacks

This commit adds an AppTest to test async output callbacks.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[ip] Added bug fixes for IP
Parichay Kapoor [Tue, 20 Aug 2019 06:11:53 +0000 (15:11 +0900)]
[ip] Added bug fixes for IP

Added bug fixes for IP for the apptest to pass

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[test/inf] Adding unittest for ne-inf
Parichay Kapoor [Tue, 13 Aug 2019 03:44:13 +0000 (12:44 +0900)]
[test/inf] Adding unittest for ne-inf

Adding unittest for ne-inf and corresponding bug fixes
Merged functionality of switch_buffers into get_next_buffer

Code coverage -
ne-inf 4.0 -> 84.8
ne-host-input-service 6.6 -> 70.0

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[NE] Add order in constructor and destructor
Parichay Kapoor [Tue, 13 Aug 2019 03:32:55 +0000 (12:32 +0900)]
[NE] Add order in constructor and destructor

Add order in the calling of constructor and destructor
The order is -
IP->handler->mem,scheduler->n4
inputservices->NPUdrvAPI->conf

The order of IP and inputservices (ip->inputservices) is currently
maintained using priority of constructor and destructor

The order of constructor and destructor is important as the
constructor/destructor of the modules are dependent on each other
and without the order being set, the behavior is randomized

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[Packaging] Append apptest packaging and analyze its test coverage
Dongju Chae [Wed, 14 Aug 2019 07:34:38 +0000 (16:34 +0900)]
[Packaging] Append apptest packaging and analyze its test coverage

This commit changes .spec file to append scripts for apptest packaging and its test coverage.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[NE] Bug fix on ne-handler.c and plugin-comm-ip.c
Dongju Chae [Wed, 14 Aug 2019 04:22:02 +0000 (13:22 +0900)]
[NE] Bug fix on ne-handler.c and plugin-comm-ip.c

This commit fixes minor bugs detected during AppTest execution.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[AppTest] Add example AppTest: dummy inference
Dongju Chae [Wed, 14 Aug 2019 04:21:02 +0000 (13:21 +0900)]
[AppTest] Add example AppTest: dummy inference

This commit adds an example AppTest program, named dummy inference.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[GEM] Increase test coverage in GEM APIs
Dongju Chae [Tue, 13 Aug 2019 07:19:51 +0000 (16:19 +0900)]
[GEM] Increase test coverage in GEM APIs

This commit increases the test coverage in GEM APIs.

Test coverage: 34% --> 75.5%.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[N71] Add extra test cases to increase coverage and fix some bugs
Dongju Chae [Fri, 9 Aug 2019 07:26:07 +0000 (16:26 +0900)]
[N71] Add extra test cases to increase coverage and fix some bugs

This commit adds extra test cases in N71.
And, it fixes the bug for resizing hwmem.

Test coverage is increated from 79.7% to 85.7%.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[NE] Remove submodels heirarchy
Parichay Kapoor [Thu, 8 Aug 2019 08:00:28 +0000 (17:00 +0900)]
[NE] Remove submodels heirarchy

Remove the submodel heirarchy (#119)
Updated the related sections to handle model instead of submodel

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[ip] Add test mode for plugin-comm ip
Parichay Kapoor [Mon, 12 Aug 2019 04:35:21 +0000 (13:35 +0900)]
[ip] Add test mode for plugin-comm ip

Add test mode for plugin-comm ip to enable testing of npu-engine.so
without device

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[mem/N11] Remove double buffering related code
Parichay Kapoor [Thu, 8 Aug 2019 04:49:34 +0000 (13:49 +0900)]
[mem/N11] Remove double buffering related code

Remove double buffering related code as it is not possible
Its not possible for user to allocate memory to be reused in npu-engine.
1. If user allocates just memory for input, then there isnt enough space
for output to be accomodated in it based on output offset from compiled
binary.
2. If user wants to allocates memory big enough for input as well as output
, then user will need access to npubinary with proper interfacing.
So, for now, independent of the format the user provides data in, there
will be a buffer allocated in ne-mem and the input will be copied.

In future, add API where user can request for an input buffer, where it
can directly load the data.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[Utils] Increase test coverage in ne-conf/utils.c
Dongju Chae [Fri, 9 Aug 2019 07:15:55 +0000 (16:15 +0900)]
[Utils] Increase test coverage in ne-conf/utils.c

This commit adds test cases to increase test coverage for ne-conf/utils.c

- ne-conf.c: 51.6% --> 94%
- ne-utils.c: 85.9% --> 92.3%

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[Build/Dir] Reconstruct core source directory
Dongju Chae [Fri, 9 Aug 2019 07:00:19 +0000 (16:00 +0900)]
[Build/Dir] Reconstruct core source directory

This commit reconstructs core source directory.

The below is the summary of what's changed.

1. reconstruct src directory (issue #153), like
+-- src/
|   +-- host/
|   +-- core/
|       +-- ne-*.c/ne-*.h
|       +-- ip/
|       +-- gem/
|       +-- npu/
|   +-- test/
|       +-- unittests/
|       +-- apptests/
2. change meson.build scripts to keep the same style.
3. change source file names to have the same prefix.

It resolves #153.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[GEM] Add test_mode in gem driver API.
Dongju Chae [Thu, 8 Aug 2019 06:01:01 +0000 (15:01 +0900)]
[GEM] Add test_mode in gem driver API.

This commit adds the test mode in gem driver API.
It means that memory allocator can keep the same code semantics regardless the test mode.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[README] Change README.md to add some related links
Dongju Chae [Thu, 8 Aug 2019 05:05:44 +0000 (14:05 +0900)]
[README] Change README.md to add some related links

This commit adds some related links to README.md.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[mem-test] Added unittest for ne-mem for npu async modes
Parichay Kapoor [Thu, 8 Aug 2019 01:35:38 +0000 (10:35 +0900)]
[mem-test] Added unittest for ne-mem for npu async modes

Added unittest for ne-mem for npu async modes and corresponding fixes
Minor bug fixes for unittest of ne-mem

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[N11] Update permission and buffer sequence
Parichay Kapoor [Tue, 6 Aug 2019 12:17:50 +0000 (21:17 +0900)]
[N11] Update permission and buffer sequence

Log skipping of output buffers
Check all buffers/processing is complete before changing modes
Using memory given by user directly has been removed, and added memcpy for all cases
Minor bug fixes

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[N11] Setup sequence number
Parichay Kapoor [Tue, 6 Aug 2019 04:31:55 +0000 (13:31 +0900)]
[N11] Setup sequence number

Setup sequence number for each input and buffer

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[async mode] Handle N11 async mode with buffering
Parichay Kapoor [Mon, 5 Aug 2019 10:19:22 +0000 (19:19 +0900)]
[async mode] Handle N11 async mode with buffering

Add handling of async mode for input with buffering
Add cb check for NULL in runNPU_async

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[N11] Implement generic buffer for input and output
Parichay Kapoor [Fri, 2 Aug 2019 06:09:12 +0000 (15:09 +0900)]
[N11] Implement generic buffer for input and output

Implement generic buffer for input output and models

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[N11] Implement generic buffer for input and output
Parichay Kapoor [Fri, 2 Aug 2019 06:09:12 +0000 (15:09 +0900)]
[N11] Implement generic buffer for input and output

Implement generic buffer for input output and models

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[NPUdrvAPI] Using conf test_mode for testing NPUdrvAPI
Parichay Kapoor [Tue, 6 Aug 2019 04:11:43 +0000 (13:11 +0900)]
[NPUdrvAPI] Using conf test_mode for testing NPUdrvAPI

Using test_mode from conf for testing NPUdrvAPI
Restructuring - add libutils with conf and util files
This allows sharing conf+util files easily with libnpu and libgem

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[N11] Update interface to support for different kinds of buffers
Parichay Kapoor [Thu, 1 Aug 2019 07:55:54 +0000 (16:55 +0900)]
[N11] Update interface to support for different kinds of buffers

Updated interface to support different kinds of buffers

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[Conf] Fix the bug in parsing 'main.test_mode'
Dongju Chae [Mon, 5 Aug 2019 09:27:02 +0000 (18:27 +0900)]
[Conf] Fix the bug in parsing 'main.test_mode'

This commit fixes the parsing bug because 'main.test_mode' can be a string like 'False'.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[BUILD] remove debug packages of npu-engine
Dongju Chae [Fri, 2 Aug 2019 08:09:33 +0000 (17:09 +0900)]
[BUILD] remove debug packages of npu-engine

This commit removes debug packages.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[Packaging] Add example package including UnitTests and AppTests
Dongju Chae [Thu, 1 Aug 2019 11:41:39 +0000 (20:41 +0900)]
[Packaging] Add example package including UnitTests and AppTests

This commit append the packaging script for npu-engine-example.
It will include unit tests and app tests (TBD).

This package will be uploaded and executed in ARM FastModel emulator.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[TAOS-CI/Test] Fix test coverage bug in TAOS-CI system
Dongju Chae [Thu, 1 Aug 2019 06:28:16 +0000 (15:28 +0900)]
[TAOS-CI/Test] Fix test coverage bug in TAOS-CI system

This commit fixes the bug to analyze test coverage in CI system.
This bug results from that gcov/lcov couldn't find a right relative path (e.g., ../)

It resolves issue #141.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[N11] Added N11 prototype implementation
Parichay Kapoor [Wed, 31 Jul 2019 05:08:02 +0000 (14:08 +0900)]
[N11] Added N11 prototype implementation

Added N11 prototype implementation
Updated interface of ne-handler to return id/version on register
Added minor bug fixes

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[Build] Fix type errors to support ARM32 build
Dongju Chae [Wed, 31 Jul 2019 11:01:54 +0000 (20:01 +0900)]
[Build] Fix type errors to support ARM32 build

This commit fixes type castring to support ARM32 build

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[Test/Bug] Apply valgrind bug report in NPU API test
Dongju Chae [Wed, 31 Jul 2019 06:05:42 +0000 (15:05 +0900)]
[Test/Bug] Apply valgrind bug report in NPU API test

This commit fixes a bug in NPU API test, reported by valgrind.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[BUILD] Fix typo in rpm spec file
Dongju Chae [Wed, 31 Jul 2019 05:33:17 +0000 (14:33 +0900)]
[BUILD] Fix typo in rpm spec file

This commit fixes typo in rpm spec file (e.g., core->src)

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>