commit 4800a0e20d6e193a33c7a410256c078c6cae3ba3
parent 582ce7ea40b16295be5fae1f3a546f89288bf987
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 7 May 2025 14:56:34 +0200
Update the way SIMD is activated
Define the SIMD instruction set directly, instead of letting the project
define it automatically.
Diffstat:
6 files changed, 47 insertions(+), 21 deletions(-)
diff --git a/Makefile b/Makefile
@@ -51,7 +51,7 @@ makefile: cache
build="$${PWD}/$(BUILD)"; \
cd src; \
PATH=$${PATH} \
- USE_SIMD=$(USE_SIMD) \
+ SIMD_WIDTH=$(SIMD_WIDTH) \
MAKE=$(MAKE) \
$(SHELL) "$${build}"; \
} > "$(MK)"
diff --git a/config.mk b/config.mk
@@ -23,9 +23,6 @@ BUILD = src/dev-libs/star-engine_0.15.sh
# Installation path
PREFIX = ./local
-# Are SIMD instruction sets enabled?
-USE_SIMD = 0
-
# How to build programs and libraries, typically in RELEASE or in DEBUG
BUILD_TYPE = RELEASE
@@ -58,6 +55,11 @@ NETWORK = ONLINE
# build of the project (see the NETWORK macro)
MIRROR = ./mirror
+# Which SIMD instruction sets are used?
+SIMD_WIDTH = NONE
+#SIMD_WIDTH = 128
+#SIMD_WIDTH = 256
+
# Option passed to git when cloning a repository to make it a local
# mirror
MIRROR_GIT_OPT = --depth 1
diff --git a/src/dev-libs/star-engine_0.15.sh b/src/dev-libs/star-engine_0.15.sh
@@ -22,14 +22,12 @@ set -e
version="0.15"
if [ -n "${STAR_ENGINE_SH}" ]; then
- check_conflict "Star-Engine" "0.15" "${STAR_ENGINE_SH}"
+ check_conflict "Star-Engine" "${version}" "${STAR_ENGINE_SH}"
return
fi
export STAR_ENGINE_SH="${version}"
-[ -z "${USE_SIMD}" ] && USE_SIMD="0"
-
. "cad-libs/aw_2.1.sh"
. "cad-libs/star-3dut_0.4.sh"
. "cad-libs/star-stl_0.5.1.sh"
@@ -43,6 +41,9 @@ export STAR_ENGINE_SH="${version}"
. "sci-libs/star-uvm_0.3.1.sh"
. "sci-libs/star-vx_0.3.sh"
-[ "${USE_SIMD}" != "0" ] && . "sci-libs/rsimd_0.5.sh"
+# shellcheck disable=SC2310
+if use_simd; then
+ . "sci-libs/rsimd_0.5.sh"
+fi
profile star-engine.profile
diff --git a/src/misc/build.sh b/src/misc/build.sh
@@ -20,6 +20,23 @@ set -e
[ -n "${BUILD_SH}" ] && return
export BUILD_SH=1
+# Check for use of SIMD instruction set
+# Returns 0 if SIMD is enabled and >0 otherwise
+use_simd()
+{
+ if [ -z "${SIMD_WIDTH}" ]; then
+ >&2 echo "HOP"
+ return 1
+ fi
+
+ if [ "${SIMD_WIDTH}" -eq 128 ] \
+ || [ "${SIMD_WIDTH}" -eq 256 ]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
# Check for conflicts between script versions of the same build
# Return 0 if version do not conflicts, and >0 otherwise
check_conflict() # name, version0, version 1
diff --git a/src/rad-libs/atrstm_0.1.1.sh b/src/rad-libs/atrstm_0.1.1.sh
@@ -26,9 +26,11 @@ set -e
. "sci-libs/star-vx_0.3.sh"
. "sys-libs/rsys_0.15.sh"
-[ -z "${USE_SIMD}" ] && USE_SIMD="0"
-
-[ "${USE_SIMD}" != 0 ] && . "sci-libs/rsimd_0.5.sh"
+# shellcheck disable=SC2310
+if use_simd; then
+ exit 1
+ . "sci-libs/rsimd_0.5.sh"
+fi
name="atrstm"
tag="0.1.1"
@@ -38,10 +40,14 @@ if [ -n "${ATRSTM_SH}" ]; then
else
export ATRSTM_SH="${tag}"
- [ "${USE_SIMD}" != "0" ] && dep="${dep} rsimd"
-
url="$\(REPO\)/atrstm.git"
- dep="${dep} atrri atrtp rsys star-mesh star-uvm star-vx"
+ dep="atrri atrtp rsys star-mesh star-uvm star-vx"
opt="BUILD_TYPE=$\(BUILD_TYPE\) LIB_TYPE=$\(LIB_TYPE\)"
+
+ # shellcheck disable=SC2310
+ if use_simd; then
+ dep="${dep} rsimd"
+ fi
+
git_repo
fi
diff --git a/src/rad-libs/star-sf_0.9.sh b/src/rad-libs/star-sf_0.9.sh
@@ -21,9 +21,10 @@ set -e
. "sci-libs/star-sp_0.14.sh"
. "sys-libs/rsys_0.15.sh"
-[ -z "${USE_SIMD}" ] && USE_SIMD="0"
-
-[ "${USE_SIMD}" != 0 ] && . "sci-libs/rsimd_0.5.sh"
+# shellcheck disable=SC2310
+if use_simd; then
+ "sci-libs/rsimd_0.5.sh"
+fi
name="star-sf"
tag="0.9"
@@ -35,11 +36,10 @@ else
url="$\(REPO\)/star-sf.git"
dep="rsys star-sp"
- opt="BUILD_TYPE=$\(BUILD_TYPE\) LIB_TYPE=$\(LIB_TYPE\)"
+ opt="BUILD_TYPE=$\(BUILD_TYPE\) LIB_TYPE=$\(LIB_TYPE\) SIMD_WIDTH=${SIMD_WIDTH}"
- if [ "${USE_SIMD}" = "0" ]; then
- opt="${opt} SIMD_WIDTH=NONE"
- else
+ # shellcheck disable=SC2310
+ if use_simd; then
dep="${dep} rsimd"
fi