Skip to content

Commit

Permalink
nits: self-review
Browse files Browse the repository at this point in the history
  • Loading branch information
csegarragonz committed Mar 12, 2024
1 parent 731744f commit 1e23e89
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 102 deletions.
1 change: 0 additions & 1 deletion WasiToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ if(FAASM_BUILD_SHARED)
message(STATUS "Faasm building SHARED libraries")

# See note in README about shared libraries targeting Emscripten
# TODO: what happens with shared lirbaries now?
set(WASM_TRIPLE $ENV{FAASM_WASM_HOST_SHARED})
else()
message(STATUS "Faasm building STATIC libraries")
Expand Down
2 changes: 0 additions & 2 deletions docker/cpp-sysroot.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ RUN cd /code/cpp \
libffi --threads \
zlib \
zlib --threads
# clapack \
# clapack --clean --shared \

# CLI setup
WORKDIR /code/cpp
Expand Down
67 changes: 1 addition & 66 deletions faasmtools/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
WASM_LDXX = WASM_CXX

# Host triple
# TODO: remove this?
# TODO(shared-libs): consider removing this
WASM_BUILD = "wasm32"
WASM_HOST = "wasm32-unknown-wasi"
WASM_HOST_STATIC = "wasm32-wasi"
Expand Down Expand Up @@ -71,7 +71,6 @@
# https://reviews.llvm.org/D59281
WASM_CFLAGS = [
"-O3",
# "-mno-atomics",
# TODO: may want to use -mrelaxed-simd instead
"-msimd128",
"--sysroot={}".format(WASM_SYSROOT),
Expand Down Expand Up @@ -246,15 +245,6 @@ def get_faasm_build_env_dict(is_threads=False):
"sign-ext",
"simd128",
]
# TODO: it seems that this import/export here are a requirement of
# the wasi-threads spec (see wasi-sdk/wasi-sdk-pthread.cmake). It
# is still not clear if we need it or not.
# build_env_dicts[
# "FAASM_WASM_EXE_LINKER_FLAGS"
# ] += " -Wl,--import-memory"
# build_env_dicts[
# "FAASM_WASM_EXE_LINKER_FLAGS"
# ] += " -Wl,--export-memory"
else:
wasm_triple = "wasm32-wasi"
build_env_dicts["FAASM_WASM_TRIPLE"] = wasm_triple
Expand Down Expand Up @@ -286,52 +276,6 @@ def get_dict_as_cmake_vars(env_dict):
# Scripts for configure, automake, and autotools
# ----------

# Variables for 'configure' scripts
_BASE_CONFIG_CMD = [
"CC={}".format(WASM_CC),
"CXX={}".format(WASM_CXX),
"CPP={}".format(WASM_CPP),
"AR={}".format(WASM_AR),
"RANLIB={}".format(WASM_RANLIB),
'CFLAGS="{}"'.format(" ".join(WASM_CFLAGS)),
'CPPFLAGS="{}"'.format(" ".join(WASM_CFLAGS)),
'CXXFLAGS="{}"'.format(" ".join(WASM_CXXFLAGS)),
'CCSHARED="{}"'.format(WASM_CCSHARED),
'CXXSHARED="{}"'.format(WASM_CXXSHARED),
]

_BASE_CONFIG_ARGS = [
"--build={}".format(WASM_BUILD),
"--host={}".format(WASM_HOST),
]

_BASE_CONFIG_ARGS_SHARED = [
"--build={}".format(WASM_BUILD),
"--host={}".format(WASM_HOST_SHARED),
]

BASE_CONFIG_CMD = _BASE_CONFIG_CMD + [
"LD={}".format(WASM_LD),
'LDSHARED="{}"'.format(WASM_LDSHARED),
]

BASE_CONFIG_CMDXX = _BASE_CONFIG_CMD + [
"LD={}".format(WASM_LDXX),
'LDSHARED="{}"'.format(WASM_LDXXSHARED),
]

BASE_CONFIG_FLAGS = [
'CFLAGS="{}"'.format(" ".join(WASM_CFLAGS)),
'CPPFLAGS="{}"'.format(" ".join(WASM_CXXFLAGS)),
'LDFLAGS="{}"'.format(" ".join(WASM_LDFLAGS)),
]

BASE_CONFIG_FLAGS_SHARED = [
'CFLAGS="{}"'.format(" ".join(WASM_CFLAGS_SHARED)),
'CPPFLAGS="{}"'.format(" ".join(WASM_CXXFLAGS_SHARED)),
'LDFLAGS="{}"'.format(" ".join(WASM_LDFLAGS_SHARED)),
]


def build_config_cmd(env_vars, cmd, shared=False, cxx=False, conf_args=True):
"""
Expand Down Expand Up @@ -361,7 +305,6 @@ def build_config_cmd(env_vars, cmd, shared=False, cxx=False, conf_args=True):
env_vars["FAASM_WASM_TRIPLE"],
env_vars["FAASM_WASM_STATIC_LINKER_FLAGS"],
),
# 'LDSHARED="{}"'.format(WASM_LDXXSHARED),
]
else:
base_config_cmd += [
Expand All @@ -370,18 +313,10 @@ def build_config_cmd(env_vars, cmd, shared=False, cxx=False, conf_args=True):
env_vars["FAASM_WASM_TRIPLE"],
env_vars["FAASM_WASM_STATIC_LINKER_FLAGS"],
),
# 'LDSHARED="{}"'.format(env_vars["FAASM_WASM_CFLAGS_SHARED"),
]

# result += BASE_CONFIG_FLAGS_SHARED if shared else BASE_CONFIG_FLAGS

base_config_cmd += cmd

if conf_args:
base_config_cmd += (
_BASE_CONFIG_ARGS_SHARED if shared else _BASE_CONFIG_ARGS
)

return base_config_cmd


Expand Down
2 changes: 1 addition & 1 deletion func/demo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "WASI")
demo_func(emscripten_check emscripten_check.cpp)
target_link_libraries(emscripten_check emscripten)

# TODO - fix BLAS check function
# 12/03/2024 - BLAS (and CLAPACK) has been broken for a while
# include_directories(/usr/local/faasm/llvm-sysroot/include/clapack)
# demo_func_c(blas_check blas_check.c)
# target_link_libraries(blas_check ${FAASM_BLAS_LIBS})
Expand Down
3 changes: 0 additions & 3 deletions libfaasmp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ if (CMAKE_SYSTEM_NAME STREQUAL "WASI")

set(LLVM_OMP_SRC_DIR "/opt/llvm-project/openmp/runtime/src")
set(LLVM_OMP_BUILD_SRC_DIR "/opt/llvm-project/build/llvm/projects/openmp/runtime/src")
# set(LIBOMP_ASMFILES "${LLVM_OMP_SRC_DIR}/z_Linux_asm.S")
set(LIBOMP_ASMFILES "z_Linux_asm.S")
set(LIBOMP_HEADERS "${LLVM_OMP_BUILD_SRC_DIR}/omp.h")
set_source_files_properties(${LIBOMP_ASMFILES} PROPERTIES LANGUAGE C)
set(LIB_FILES ${LIBOMP_ASMFILES} ${LIB_FILES})

add_library(faasmp STATIC ${LIB_FILES})
set_target_properties(faasmp PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS}")
# target_include_directories(faasmp PUBLIC ${LLVM_OMP_BUILD_SRC_DIR} ${LLVM_OMP_SRC_DIR})

# Install in WASM sysroot
install(
Expand All @@ -44,7 +42,6 @@ if (CMAKE_SYSTEM_NAME STREQUAL "WASI")
)

# Add omp.h header copied from clang source
# TODO: can we copy it directly from LLVM source, for each LLVM version?
install(
FILES ${LIBOMP_HEADERS}
DESTINATION $ENV{FAASM_WASM_HEADER_INSTALL_DIR}
Expand Down
17 changes: 0 additions & 17 deletions libfaasmp/z_Linux_asm_csg.S

This file was deleted.

10 changes: 0 additions & 10 deletions tasks/libffi.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,3 @@ def build(ctx, clean=False, threads=False):

# Run install
run("make install", shell=True, check=True, cwd=LIBFFI_DIR)

# Move lib into correct install dir
# Copy imports into place
# TODO: do we need these?
"""
src_imports = join(PROJ_ROOT, "sysroot_extras", "libffi.imports")
dest_imports = join(WASM_LIB_INSTALL, "libffi.imports")
print("Copying {} to {}".format(src_imports, dest_imports))
run("cp {} {}".format(src_imports, dest_imports), check=True, shell=True)
"""
1 change: 0 additions & 1 deletion tasks/llvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ def libc(ctx, clean=False, purge=False):
do_llvm_build("libc", clean_args)

# Copy the import files into place
# TODO: do we need this?
copy_cmd = "cp -r sysroot_extras/* {}".format(
get_faasm_build_env_dict()["FAASM_WASM_LIB_INSTALL_DIR"]
)
Expand Down
1 change: 0 additions & 1 deletion tasks/zlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def zlib(ctx, clean=False, threads=False):
"AR={}".format(build_env["FAASM_WASM_AR"]),
"RANLIB={}".format(build_env["FAASM_WASM_RANLIB"]),
"NM={}".format(build_env["FAASM_WASM_NM"]),
# TODO: can we add the target here too so that install just works?
"./configure",
"--includedir={}".format(build_env["FAASM_WASM_HEADER_INSTALL_DIR"]),
"--libdir={}".format(build_env["FAASM_WASM_LIB_INSTALL_DIR"]),
Expand Down

0 comments on commit 1e23e89

Please sign in to comment.