Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7ee9ca6
Uncommented some tests
ThomasDuquette May 15, 2026
293d4be
Merge remote-tracking branch 'origin/main' into Thomas/Re-enable-tests
ThomasDuquette May 15, 2026
d6c2fe0
uncommented & fixed test_objmatrix
ThomasDuquette May 15, 2026
f4c3962
Moved rpy <-> rotation matrix test to misc test
ThomasDuquette May 15, 2026
c7ec7fb
Cleaned up manipulators + uncommented Gen3 test
ThomasDuquette May 15, 2026
1b1695c
Merge remote-tracking branch 'origin/main' into Thomas/Re-enable-tests
ThomasDuquette May 15, 2026
86328be
Started UR5e test but bug was found
ThomasDuquette May 15, 2026
998000c
Merge branch 'main' of github.com:Dynamium-Lab/blast into Thomas/Re-e…
Nikos-d Jun 1, 2026
1ac3af3
Fixed UR5e bug from merge
Nikos-d Jun 1, 2026
7dd3b3b
Few cleanups/fixes
Nikos-d Jun 1, 2026
e08ad0d
style: apply clang-format
Nikos-d Jun 1, 2026
e771c9c
Added/modified tests
Nikos-d Jun 3, 2026
d136ce6
style: apply clang-format
Nikos-d Jun 3, 2026
7ac5cc7
removed test_helper
Nikos-d Jun 3, 2026
02e43a2
Merge branch 'Thomas/Re-enable-tests' of github.com:Dynamium-Lab/blas…
Nikos-d Jun 3, 2026
85b3ee1
style: apply clang-format
Nikos-d Jun 3, 2026
cf3e442
Fix + add manip constructor test
Nikos-d Jun 3, 2026
a854872
style: apply clang-format
Nikos-d Jun 3, 2026
90045f8
utilities include fix
Nikos-d Jun 3, 2026
ba8af18
Merge branch 'Thomas/Re-enable-tests' of github.com:Dynamium-Lab/blas…
Nikos-d Jun 3, 2026
c1c55f8
Fix in adding payload + tool
Nikos-d Jun 3, 2026
703b636
minor change
Nikos-d Jun 3, 2026
eb9a888
proposed fix for missing dll in tests
Nikos-d Jun 4, 2026
f026b1e
Make random_int thread-safe with thread_local generator
gallantandre Jun 14, 2026
5333d63
Rename get_random to random_real
gallantandre Jun 14, 2026
f2c5d31
Collapse dev/dev-msvc into one cross-platform preset
gallantandre Jun 14, 2026
ad30fce
Make AVX2+FMA requirement explicit for consumers
gallantandre Jun 14, 2026
2667f5c
Merge origin/main into Thomas/Re-enable-tests
gallantandre Jun 14, 2026
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
49 changes: 17 additions & 32 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,44 +15,25 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
build_type: [Release]
c_compiler: [gcc, clang, cl]
include:
- os: windows-latest
c_compiler: cl
cpp_compiler: cl
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
preset: ci-gcc
- os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
exclude:
- os: windows-latest
c_compiler: gcc
preset: ci-clang
- os: windows-latest
c_compiler: clang
- os: ubuntu-latest
c_compiler: cl
preset: ci

steps:
- uses: actions/checkout@v4

- name: Configure CMake
run: >
cmake -B ${{ github.workspace }}/build
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}
run: cmake --preset ${{ matrix.preset }}

- name: Build
run: cmake --build ${{ github.workspace }}/build --config ${{ matrix.build_type }}
run: cmake --build --preset ${{ matrix.preset }}

- name: Test
working-directory: ${{ github.workspace }}/build
run: ctest --build-config ${{ matrix.build_type }} --output-on-failure
run: ctest --preset ${{ matrix.preset }}

# -------------------------------------------------------------------------
# Install + consumer smoke test
Expand Down Expand Up @@ -92,17 +73,21 @@ jobs:
target_link_libraries(test_consumer PRIVATE Blast::blast)
EOF
cat > "$RUNNER_TEMP/consumer/main.cpp" <<'EOF'
// Minimal consumer — verifies that the installed Blast headers and the
// exported nlopt target are all reachable via find_package(Blast).
// Consumer smoke test — verifies that find_package(Blast) exposes the
// headers/nlopt AND that the AVX2+FMA contract holds: blast::dot uses
// _mm256_fmadd_pd, so this fails to compile unless the installed
// Blast::blast target propagates the required ISA flags (or the
// #error guard fires). No flags are set here on purpose — that is what
// the test checks.
#include <blast>
#include <iostream>

int main() {
// Exercise a type from blast_math.hpp (included transitively via <blast>)
blast::Vec3 v{1.0, 2.0, 3.0};
std::cout << "Blast::Vec3 constructed: "
<< v.x << " " << v.y << " " << v.z << "\n";
return 0;
blast::Array a({1.0, 2.0, 3.0, 4.0});
blast::Array b({4.0, 3.0, 2.0, 1.0});
blast::real d = blast::dot(a, b); // exercises the AVX2/FMA path
std::cout << "Blast::dot = " << d << "\n";
return (d == 20.0) ? 0 : 1; // 1*4 + 2*3 + 3*2 + 4*1 = 20
}
EOF

Expand Down
93 changes: 66 additions & 27 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,101 @@
"version": 6,
"configurePresets": [
{
"name": "dev",
"displayName": "Developer build (Linux/macOS)",
"description": "RelWithDebInfo, native tuning, compile-commands for tooling",
"binaryDir": "${sourceDir}/build/${presetName}",
"condition": {
"type": "notEquals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"name": "base",
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CMAKE_CXX_FLAGS": "-march=native",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
"BUILD_SHARED_LIBS": "OFF"
}
},
{
"name": "dev-msvc",
"displayName": "Developer build (Windows/MSVC)",
"description": "RelWithDebInfo with AVX2, compile-commands for tooling",
"name": "dev",
"inherits": "base",
"displayName": "Developer build",
"description": "RelWithDebInfo with compile-commands for tooling. AVX2/native tuning is applied per dev target (see examples/ and tests/, which pick /arch:AVX2 for MSVC and -march=native otherwise), so this preset is correct for MSVC, GCC, Clang and MinGW on any OS.",
"binaryDir": "${sourceDir}/build/${presetName}",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CMAKE_CXX_FLAGS": "/arch:AVX2",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
}
},
{
"name": "ci",
"displayName": "CI build",
"inherits": "base",
"displayName": "CI build (MSVC/default)",
"description": "Release build without machine-specific tuning",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
}
},
{
"name": "ci-gcc",
"inherits": "ci",
"displayName": "CI build (GCC)",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_C_COMPILER": "gcc",
"CMAKE_CXX_COMPILER": "g++"
}
},
{
"name": "ci-clang",
"inherits": "ci",
"displayName": "CI build (Clang)",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++"
}
}
],
"buildPresets": [
{
"name": "dev",
"configurePreset": "dev"
},
{
"name": "dev-msvc",
"configurePreset": "dev-msvc",
"configurePreset": "dev",
"configuration": "RelWithDebInfo"
},
{
"name": "ci",
"configurePreset": "ci",
"configuration": "Release"
},
{
"name": "ci-gcc",
"configurePreset": "ci-gcc",
"configuration": "Release"
},
{
"name": "ci-clang",
"configurePreset": "ci-clang",
"configuration": "Release"
}
],
"testPresets": [
{
"name": "ci",
"configurePreset": "ci",
"configuration": "Release",
"output": {
"outputOnFailure": true
}
},
{
"name": "ci-gcc",
"configurePreset": "ci-gcc",
"configuration": "Release",
"output": {
"outputOnFailure": true
}
},
{
"name": "ci-clang",
"configurePreset": "ci-clang",
"configuration": "Release",
"output": {
"outputOnFailure": true
}
}
]
}
20 changes: 16 additions & 4 deletions blast/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,22 @@ if(ENABLE_TRACY)
target_link_libraries(blast INTERFACE TracyClient)
endif()

# -march=native / /arch:AVX2 are machine-specific developer flags.
# They must NOT be INTERFACE — that would force them on every downstream
# consumer, breaking cross-compilation and reproducible builds.
# Add them to your personal build via CMakePresets.json (see root preset).
# -march=native is machine-specific *tuning*. It must NOT be INTERFACE — that
# would force it on every downstream consumer, breaking cross-compilation and
# reproducible builds. The dev targets (examples/, tests/) apply it per-target
# as PRIVATE, choosing /arch:AVX2 for MSVC and -march=native otherwise.
#
# AVX2+FMA, by contrast, is a hard *minimum-ISA requirement*: Blast's headers
# call AVX2/FMA intrinsics directly (e.g. _mm256_fmadd_pd), so consumers cannot
# compile without them. Propagate the feature flags so find_package(Blast)
# consumers just work. Feature flags are additive — they never downgrade a
# consumer's -march=native. MSVC is intentionally excluded: its /arch: is a
# single mutually-exclusive level, so forcing /arch:AVX2 would downgrade an
# /arch:AVX512 consumer (warning D9025); MSVC is covered by the #error guard in
# blast/blast instead.
target_compile_options(blast INTERFACE
$<$<CXX_COMPILER_ID:GNU,Clang>:-mavx2;-mfma>
)

# --------------------------------------------------------------------------
# Install rules
Expand Down
25 changes: 25 additions & 0 deletions blast/blast
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,27 @@ using i64 = int64_t;
#define device_fn
#endif

// ---------------------------------------------------------------------------
// Instruction-set requirement
// Blast's math headers use AVX2+FMA intrinsics directly (e.g. _mm256_fmadd_pd
// in math/Array.hpp). Without those features enabled, GCC/Clang fail with a
// cryptic "target specific option mismatch" and MSVC silently degrades. Fail
// early here with an actionable message instead. CUDA builds opt out.
// ---------------------------------------------------------------------------
#if !defined(__NVCC__) && !defined(__CUDACC__)
#if defined(_MSC_VER) && !defined(__clang__)
// MSVC: /arch:AVX2 (and /arch:AVX512) define __AVX2__ and imply FMA.
#if !defined(__AVX2__)
#error "Blast requires AVX2. Compile with /arch:AVX2 (or higher)."
#endif
#else
// GCC, Clang, clang-cl: both macros are set when the features are enabled.
#if !defined(__AVX2__) || !defined(__FMA__)
#error "Blast requires AVX2 and FMA. Compile with -mavx2 -mfma (or -march=native)."
#endif
#endif
#endif

#define VCL_NAMESPACE vcl
#include "vectorclass.h"
#include "vectormath_trig.h"
Expand Down Expand Up @@ -74,3 +95,7 @@ using i64 = int64_t;
#include "blast_manipulator.hpp"
#include "blast_optimization.hpp"
#include "blast_trajectory.hpp"

#include "utilities/file_io.hpp"
#include "utilities/is_close.hpp"
#include "utilities/print.hpp"
2 changes: 1 addition & 1 deletion blast/blast_math.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ inline blast_fn real wrap2pi(real);
inline blast_fn real wrap_to_180(real);
inline blast_fn real deg2rad(real);
inline blast_fn real rad2deg(real);
inline blast_fn real get_random();
inline blast_fn real random_real();
inline blast_fn real clamp(real val, real mini, real maxi);
inline blast_fn real& clamp_inplace(real& val, real mini, real maxi);
inline blast_fn real sign(real v);
Expand Down
Loading
Loading