Comments (4)
Collaborating with @gordonmcshane, found an improvement to simdpp_multiarch() that avoids the need for a work-around. Will PR soon.
from libsimdpp.
@JoshBlake Does your fix involve add_custom_command
and IMPLICIT_DEPENDS
by chance?
from libsimdpp.
@p12tic our fix was a bit more brute force.
In SimdppMultiarch.cmake, we just add the current source path to the current directory's INCLUDE_DIRECTORIES property via include_directories(). This works because INCLUDE_DIRECTORIES is inherited by subdirectories, and the generated code is placed in a child directory of the current source directory.
# add current path to include paths so generated simd variations are
# able to reference the same includes found in base version
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/${SRC_PATH}")
foreach(ARCH ${ARCHS})
simdpp_get_arch_info(CXX_FLAGS DEFINES_LIST SUFFIX ${ARCH})
if(NOT "${SUFFIX}" STREQUAL "")
# Copy the source file and add the required flags
set(DST_ABS_FILE "${CMAKE_CURRENT_BINARY_DIR}/${SRC_PATH}/${SRC_NAME}_simdpp_${SUFFIX}${SRC_EXT}")
set(SRC_ABS_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FILE}")
configure_file("${SRC_ABS_FILE}" "${DST_ABS_FILE}" COPYONLY)
list(APPEND FILE_LIST "${DST_ABS_FILE}")
# let CMake know that this file is created at build time
set_source_files_properties("${DST_ABS_FILE}" PROPERTIES GENERATED TRUE)
if (NOT "${CXX_FLAGS}" STREQUAL "")
set_source_files_properties("${DST_ABS_FILE}" PROPERTIES COMPILE_FLAGS ${CXX_FLAGS})
endif()
# For the first file that is being processed, set it to emit
# dispatcher code. The required flags will be added later
if("${DISPATCHER_FILE}" STREQUAL "")
set(DISPATCHER_FILE "${DST_ABS_FILE}")
endif()
# Add required dispatcher predefined macros for this architecture
set(DISPATCHER_CXX_FLAGS "${DISPATCHER_CXX_FLAGS} -DSIMDPP_DISPATCH_ARCH${DISPATCH_ARCH_IDX}=${DEFINES_LIST}")
math(EXPR DISPATCH_ARCH_IDX "${DISPATCH_ARCH_IDX}+1")
endif()
endforeach()
Beyond the include_directories()
statement, the only other changes are the setting of GENERATED
to TRUE
on DST_ABS_FILE
in the foreach()
and the removal of the explicit -I
arguments to CXX_FLAGS
from libsimdpp.
This could lead to issues, because include_directories()
does not modify the include directories of source files. It sets the include directory for all targets defined in the current CMakeLists file and in CMakeLists files in children directories. These targets would end up with lots of extra include paths, which could cause problems if headers with same names are present.
I've committed the add_custom_command and IMPLICIT_DEPENDS fix at db8f68b. Thanks for all the help.
from libsimdpp.
Related Issues (20)
- Compiler error with -std=c++17 on clang HOT 1
- to_uint32() unexpected behavior
- Compiler error with -std=c++17 on gcc HOT 2
- Docs issue: Dynamic Dispatch Example + CMake HOT 1
- loads and stores with vectors can read/write more than the vector size HOT 2
- possible comma misuse warning in shuffle2x2.h HOT 1
- Slowdown on several vector variations HOT 2
- Why not overload operator += ?
- For a store_first(ptr, vec, 1) with SSE2, it could result into a _mm_store_ss() ?
- Would you consider adding store_first_u?
- Horizontal add
- NEON64 implementation of floor(float64x2) incorrect
- sign(float64<N>) generates incorrect code on NEON64 using gcc 9.3.0 with -ffast-math
- Fused multiply-add/sub not emulated
- How to Use This Library? HOT 2
- How can we combine with Intel® SSE2 (Streaming SIMD Extensions 2)? HOT 4
- Are there any bench test for libsimdpp?
- SIGSEGV while running the program that checks runnability for ARM64_NEON
- Assessment of the difficulty in porting CPU architecture for libsimdpp
- WebAssembly direct instructions support?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libsimdpp.