Fix incompatibility between OpenVino with musl libc
This commit is contained in:
		
							parent
							
								
									23817fc659
								
							
						
					
					
						commit
						8842af88f3
					
				| @ -0,0 +1,32 @@ | |||||||
|  | From 2e6be0606c79f11d0bc7400dc97732431ea42c00 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: He Sun <bochang.sh@antfin.com> | ||||||
|  | Date: Fri, 20 Mar 2020 15:52:08 +0800 | ||||||
|  | Subject: [PATCH] Fix passing pre-increment parameter cpu to CPU_ISSET_S | ||||||
|  | 
 | ||||||
|  | Fix the incompatibility between OpenVINO and musl libc. The problem is | ||||||
|  | that the CPU_ISSET_S macro defined in musl libc is not quite robust: it | ||||||
|  | expands the first argument more than once (Glibc's counterpart does not | ||||||
|  | have this issue). So if the first argument has any side effect, then the | ||||||
|  | macro will have unexpected consequences. Unfortunately, this is exactly | ||||||
|  | what happens in the orignal code of OpenVINO. | ||||||
|  | ---
 | ||||||
|  |  inference-engine/src/mkldnn_plugin/mkldnn_streams.cpp | 3 ++- | ||||||
|  |  1 file changed, 2 insertions(+), 1 deletion(-) | ||||||
|  | 
 | ||||||
|  | diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_streams.cpp b/inference-engine/src/mkldnn_plugin/mkldnn_streams.cpp
 | ||||||
|  | index a0c2159..7a9c3e8 100644
 | ||||||
|  | --- a/inference-engine/src/mkldnn_plugin/mkldnn_streams.cpp
 | ||||||
|  | +++ b/inference-engine/src/mkldnn_plugin/mkldnn_streams.cpp
 | ||||||
|  | @@ -78,7 +78,8 @@ bool pin_thread_to_vacant_core(int thr_idx, int hyperthreads, int ncores, const
 | ||||||
|  |      // Find index of 'cpu_idx'-th bit that equals to 1 | ||||||
|  |      int mapped_idx = -1; | ||||||
|  |      while (cpu_idx >= 0) { | ||||||
|  | -        if (CPU_ISSET_S(++mapped_idx, size, proc_mask))
 | ||||||
|  | +        ++mapped_idx;
 | ||||||
|  | +        if (CPU_ISSET_S(mapped_idx, size, proc_mask))
 | ||||||
|  |              --cpu_idx; | ||||||
|  |      } | ||||||
|  |   | ||||||
|  | -- 
 | ||||||
|  | 2.7.4 | ||||||
|  | 
 | ||||||
| @ -64,6 +64,7 @@ build_openvino() { | |||||||
|     pushd openvino_src |     pushd openvino_src | ||||||
|     git clone https://github.com/opencv/dldt . |     git clone https://github.com/opencv/dldt . | ||||||
|     git checkout tags/2019_R3 -b 2019_R3 |     git checkout tags/2019_R3 -b 2019_R3 | ||||||
|  |     git apply ../0001-Fix-passing-pre-increment-parameter-cpu-to-CPU_ISSET.patch | ||||||
|     cd inference-engine |     cd inference-engine | ||||||
|     git submodule init |     git submodule init | ||||||
|     git submodule update --recursive |     git submodule update --recursive | ||||||
|  | |||||||
| @ -9,8 +9,8 @@ rm -rf occlum_context | |||||||
| mkdir occlum_context | mkdir occlum_context | ||||||
| cd occlum_context | cd occlum_context | ||||||
| occlum init | occlum init | ||||||
| jq '.process.default_mmap_size = "192MB"' Occlum.json > temp_Occlum.json | jq '.vm.user_space_size = "320MB"' Occlum.json > temp_Occlum.json | ||||||
| mv temp_Occlum.json Occlum.json | jq '.process.default_mmap_size = "256MB"' temp_Occlum.json > Occlum.json | ||||||
| 
 | 
 | ||||||
| # 2. Copy files into Occlum Workspace and Build | # 2. Copy files into Occlum Workspace and Build | ||||||
| cp ../$inference_bin/$benchmark image/bin | cp ../$inference_bin/$benchmark image/bin | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user