Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API-9702] feat: build vlfeat on arm64 #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ Linux_i386_ARCH := glnx86
Linux_i686_ARCH := glnx86
Linux_unknown_ARCH := glnx86
Linux_x86_64_ARCH := glnxa64
Linux_aarch64_ARCH := armv8

UNAME := $(shell uname -sm)
ARCH ?= $($(shell echo "$(UNAME)" | tr \ _)_ARCH)
Expand Down Expand Up @@ -232,6 +233,12 @@ STD_CFLAGS += -m$(march) -D_GNU_SOURCE -fno-stack-protector
STD_LDFLAGS += -m$(march) -Wl,--rpath,\$$ORIGIN/ -Wl,--as-needed
endif

# Linux ARM64
# Linux
ifeq "$(ARCH)" "$(filter $(ARCH),armv8)"
DISABLE_SSE2:=yes
endif

# Convert back DISALBE_*="no" flags to be empty
ifeq "$(DISABLE_SSE2)" "no"
override DISABLE_SSE2:=
Expand Down
5 changes: 5 additions & 0 deletions docsrc/install-shell.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@
<td><code>glnxa64</code></td>
<td><code>VLFEATROOT/bin/glnxa64/sift</code></td>
</tr>
<tr>
<td>Linux ARM64</td>
<td><code>armv8</code></td>
<td><code>VLFEATROOT/bin/armv8/sift</code></td>
</tr>
</table>
</div>

Expand Down
6 changes: 6 additions & 0 deletions make/dll.mak
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ DLL_SUFFIX := so
DLL_LDFLAGS += -m64
endif

# Linux-arm64
ifeq ($(ARCH),armv8)
DLL_SUFFIX := so
DLL_LDFLAGS += -march=armv8-a
endif

# --------------------------------------------------------------------
# Build
# --------------------------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions make/matlab.mak
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ ifeq ($(ARCH),glnxa64)
MEX_SUFFIX := mexa64
endif

ifeq ($(ARCH),armv8)
MEX_SUFFIX := mexa64
endif

MEX_BINDIR := toolbox/mex/$(MEX_SUFFIX)

# generate the mex-dir target
Expand Down
8 changes: 6 additions & 2 deletions vl/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,9 @@ it supports POSIX threads.
#undef HAS_CPUID
#endif

#if defined(HAS_CPUID) & defined(VL_COMPILER_MSC)
#if defined(HAS_CPUID)

#if defined(VL_COMPILER_MSC)
#include <intrin.h>
VL_INLINE void
_vl_cpuid (vl_int32* info, int function)
Expand All @@ -412,7 +414,7 @@ _vl_cpuid (vl_int32* info, int function)
}
#endif

#if defined(HAS_CPUID) & defined(VL_COMPILER_GNUC)
#if defined(VL_COMPILER_GNUC)
VL_INLINE void
_vl_cpuid (vl_int32* info, int function)
{
Expand Down Expand Up @@ -488,6 +490,8 @@ _vl_x86cpu_info_to_string_copy (VlX86CpuInfo const *self)
return string ;
}

#endif // defined(HAS_CPUID)

/** ------------------------------------------------------------------
** @brief Human readable static library configuration
** @return a new string with the static configuration.
Expand Down
14 changes: 14 additions & 0 deletions vl/host.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,17 @@ defined(__DOXYGEN__)
defined(__DOXYGEN__)
#define VL_ARCH_IA64
#endif

#if defined(_M_ARM64) || \
defined(__aarch64__) || \
defined(__ARM64_ARCH_8__) || \
defined(__ARM_ARCH_8A__) || \
defined(__arm64__) || \
defined(__arm64) || \
defined(__arm64__)
#define VL_ARCH_ARM64
#endif

/** @} */

/** @name Identifying the host data model
Expand Down Expand Up @@ -299,6 +310,7 @@ defined(__DOXYGEN__)
defined(VL_ARCH_IX86) || \
defined(VL_ARCH_IA64) || \
defined(VL_ARCH_X64) || \
defined(VL_ARCH_ARM64) || \
defined(__DOXYGEN__)
#define VL_ARCH_LITTLE_ENDIAN
#endif
Expand Down Expand Up @@ -553,6 +565,7 @@ VL_INLINE void vl_swap_host_big_endianness_2 (void *dst, void* src) ;
/** ------------------------------------------------------------------
** @name Obtaining host info at run time
** @{ */
#if defined(VL_ARCH_IX86) || defined(VL_ARCH_IA64) || defined(VL_ARCH_X64)

typedef struct _VlX86CpuInfo
{
Expand All @@ -572,6 +585,7 @@ typedef struct _VlX86CpuInfo
void _vl_x86cpu_info_init (VlX86CpuInfo *self) ;
char * _vl_x86cpu_info_to_string_copy (VlX86CpuInfo const *self) ;

#endif
/** @} */

/** ------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion vl/kmeans.c
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ VL_XCAT(_vl_kmeans_quantize_, SFX)
#endif

#ifdef _OPENMP
#pragma omp parallel default(none) \
#pragma omp parallel \
shared(self, distances, assignments, numData, distFn, data) \
num_threads(vl_get_max_threads())
#endif
Expand Down