Skip to content

Commit

Permalink
More cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jfalcou committed Dec 17, 2023
1 parent ac11610 commit 4576d5b
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 153 deletions.
119 changes: 37 additions & 82 deletions doc/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,28 @@ Installation & Quick Start {#setup}
| g++ | 11 or above |
| clang++ | 13 or above |

<br/>

In term of SIMD extension sets, we actively supports (ie code is optimized and regularly tested) the following:
In term of SIMD extension sets, the supports status are as follows:

- **Intel**
- SSE2, SSSE3, SSE3, SSE4.1, SSE4.2
- AVX, AVX2, FMA3
- AVX512 in SKylake-AVX512 mode (F, CD, VL, DQ, BW)
- **ARM**
- NEON A32 (64 & 128 bits)
- NEON A64 (64 & 128 bits)
- ASIMD
- SVE with fixed sizes of 128, 256 and 512 bits registers.
- Active Support (ie code is optimized and regularly tested)

Partial/In-progress support with minimal checks:
- **PowerPC**
- VMX
- VSX
- **Intel**
- SSE2, SSSE3, SSE3, SSE4.1, SSE4.2
- AVX, AVX2, FMA3
- AVX512 in SKylake-AVX512 mode (F, CD, VL, DQ, BW)
- **ARM**
- NEON A32 (64 & 128 bits)
- NEON A64 (64 & 128 bits)
- ASIMD
- SVE with fixed sizes of 128, 256 and 512 bits registers.

- We **do not support** ARM SVE with dynamic size.
- We **do not support** GPGPU, this is the job for another tool.
The following instructions are tentatively supported (ie code is incomplete and not tested in depth):
- Partial/In-progress support with minimal checks:
- **PowerPC**
- Altivec for Power7 to 9
- VSX for Power9

- **PowerPC**
- Altivec for Power7 to 9
- VSX for Power9
- No Support
- We **do not support** ARM SVE with dynamic size.
- We **do not support** GPGPU, this is the job for another tool.

# Retrieving the source

Expand Down Expand Up @@ -90,34 +86,9 @@ Once installed, you can use **EVE** headers directly from your
yay -S eve-git
```

## Conan

[**Conan Center**](https://conan.io/center/) hosts **EVE** as the
[`jfalcou-eve` package](https://conan.io/center/jfalcou-eve).

To use **EVE**, just add `jfalcou-eve/v2021.10.0` in the `[requires]` section of
your `conanfile.txt`

```cmake
[requires]
jfalcou-eve/v2021.10.0
[generators]
cmake
```

## VCPKG

**EVE** can be fetched from [VCPKG](https://vcpkgx.com/details.html?package=eve). Note that, as of
now, we still don't support MSVC.

```bash
vcpkg install eve
```

# Installation from Source

If you didn't fetched **EVE** from a package manager, you'll need to install it via our CMake
If you didn't fetched **EVE** from a package manager, you'll need to install it via your CMake
system.

## Setting up the Library
Expand Down Expand Up @@ -153,26 +124,13 @@ using the `doxygen` target:
cmake --build build --target doxygen
@endcode

The resulting HTML files will be available in the `docs` folder.

You can also build **EVE** documentation in your build folder by using the `doxygen-local` target:
<br/>

@code
cmake --build build --target doxygen-local
@endcode

The resulting HTML files will be available in the `docs` folder inside your build folder.

# Using the library

## Compilation

Once installed, you can compile the following code to check if everything is alright.

@godbolt{examples/quick-start/sanity-check.cpp}

To do so, use your C++20 aware favorite compiler, for example g++.
To compiel code using **EVE**, use your C++20 aware favorite compiler, for example g++.

@verbatim
$ g++ test.cpp -std=c++20 -march=native -O3 -DNDEBUG -I/path/to/install/include/eve-<version> -o output
Expand All @@ -194,21 +152,17 @@ You can also select a specific instructions set by using the proper option(s) fr
$ g++ test.cpp -std=c++20 -msse4.1 -O3 -DNDEBUG -I/path/to/install/include/eve-<version> -o output
@endverbatim


## Execution

Once done, execute the binary. If you compiled for SSE4.1 for example, you'll end up with the
following results:

@verbatim
$ ./output
x = (1, 2, 3, 4)
2*x = (2, 4, 6, 8)
x^0.5 = (1, 1.41421, 1.73205, 2)
@endverbatim
@godbolt{examples/quick-start/sanity-check.cpp}

That's it, **EVE** is properly installed and ready to use.

## Use in CMake
## Use with CMake

Once installed, **EVE** may be consumed through its config-file **CMake** package. Simply find and
link against **EVE's** **CMake** target, as you would any other **CMake** library, and then
Expand All @@ -220,30 +174,31 @@ find_package(eve CONFIG REQUIRED)
target_link_libraries(use-eve PRIVATE eve::eve)
```

> If a custom installation prefix was used, ensure your **EVE** installation is within **CMake's**
search path with the use of the **CMake** variables **eve_ROOT**, **eve_DIR**, or
**CMAKE_PREFIX_PATH**.
If a custom installation prefix was used, ensure your **EVE** installation is within **CMake's**
search path with the use of the **CMake** variables **eve_ROOT**, **eve_DIR**, or
**CMAKE_PREFIX_PATH**.

# Advanced options

If you want to dig a bit further, you can pass additional options to `cmake` to
activate additional features.

|Option |Effect |Target |
|-------------------------|:--------------------------------------------------------|:-------------|
| `EVE_BUILD_TEST` |Enable unit tests for **EVE** (`ON` by default). | `unit` |
| `EVE_BUILD_BENCHMARKS` |Enable benchmark tests for **EVE** (`OFF` by default). | `benchmarks` |
| `EVE_BUILD_RANDOM` |Enable random tests for **EVE** (`OFF` by default). | `random` |
| `EVE_BUILD_INTEGRATION` |Enable integration tests for **EVE** (`OFF` by default). | `integration`|
|Option |Effect |Target |
|---------------------------|:------------------------------------------------------------|:-------------|
| `EVE_BUILD_TEST` |Enable unit tests for **EVE** (`ON` by default). | `unit` |
| `EVE_BUILD_BENCHMARKS` |Enable benchmark tests for **EVE** (`OFF` by default). | `benchmarks` |
| `EVE_BUILD_RANDOM` |Enable random tests for **EVE** (`OFF` by default). | `random` |
| `EVE_BUILD_DOCUMENTATION` |Enable the generation of the documentation (`ON` by default).| `doxygen`|

There is currently over 2000 tests, so compiling all unit tests may require a large machine or some
time. We recommend compiling in parallel using `-j`.

All available **CMake** targets may be listed via `cmake --build build --target help`, each of which
may be built individually.

Some options are also available to control some other aspects

| Option | Effect | Comments |
|--------|:-------------|:---------------------|
| `EVE_USE_BMI_ON_AVX2` | Enables using bmi instructions on avx2 | on Intel, it's beneficial, on AMD it's a disaster |
| `EVE_USE_PCH` | Enable using precompiled headers for **EVE** tests. | This is `ON` by default |
| Option | Effect | Comments |
|-----------------------|:----------------------------------------------------|:---------------------------------------|
| `EVE_USE_BMI_ON_AVX2` | Enables using bmi instructions on AVX2 | Beneficial on Intel, disastrous on AMD |
| `EVE_USE_PCH` | Enable using precompiled headers for **EVE** tests. | This is `ON` by default |
6 changes: 3 additions & 3 deletions doc/tutorial/interacting-with-native-code.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ To combine this with algorithms, force a specific cardinal. All of algorithms
are designed to not require templated callbacks so that you are able to do this.
(unfortunately views still require you to provide a template).
@snippet tutorial/interacting_with_native_code.cpp interating_with_native_algo
@snippet tutorial/interacting_with_native.cpp interacting_with_native_algo
# What about non-native sizes?
Expand All @@ -27,10 +27,10 @@ still represented as a full register. For example wide<int, eve::fixed<2>>
on x86 is still __m128i. The data is at the first 2 elements, the rest can
be garbage.
If the cradinal is larger than the one natively representable, you can
If the cardinal is larger than the one natively representable, you can
use slice to get to the half the wide size.
@snippet tutorial/interacting_with_native_code.cpp slicing_aggregate
@snippet tutorial/interacting_with_native.cpp slicing_aggregate
If you write something generally useful, maybe consider contributing?
**/
4 changes: 2 additions & 2 deletions examples/tutorial/interacting_with_native.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
//==================================================================================================

//! [interating_with_native_algo]
//! [interacting_with_native_algo]

#include <eve/module/core.hpp>
#include <eve/module/algo.hpp>
Expand Down Expand Up @@ -39,7 +39,7 @@ void remove_spaces(std::string& s)

#endif // __SSSE3__

//! [interating_with_native_algo]
//! [interacting_with_native_algo]

#include "test.hpp"

Expand Down
33 changes: 17 additions & 16 deletions include/eve/arch/cardinals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,9 @@ namespace eve

} // namespace detail

//================================================================================================
//! @brief concept to determine if this is cardinal type of a wide
//!
//! @tparam T
//!
//! only true if T is instance of `eve::fixed`.
//!
//! This concept is needed to define some other concepts, unlikely to be useful on it's own.
//================================================================================================
template <typename T>
concept wide_cardinal = detail::is_wide_cardinal<T>::value;

template<std::ptrdiff_t Cardinal>
inline constexpr fixed<Cardinal> const lane = {};

//================================================================================================
//! @}
//================================================================================================

//================================================================================================
// Constant index template class
//================================================================================================
Expand All @@ -92,11 +76,28 @@ namespace eve
//================================================================================================
template<std::ptrdiff_t N> inline constexpr auto index = index_t<N>{};

//================================================================================================
//! @}
//================================================================================================

//================================================================================================
// Hardware-agnostic cardinal
//================================================================================================
namespace detail
{
template<typename T> using cache_line_cardinal = fixed<64 / sizeof(T)>;
}

//================================================================================================
//! @ingroup simd_concepts
//! @brief concept to determine if this is cardinal type of a wide
//!
//! @tparam T
//!
//! only true if T is instance of `eve::fixed`.
//!
//! This concept is needed to define some other concepts, unlikely to be useful on it's own.
//================================================================================================
template <typename T>
concept wide_cardinal = detail::is_wide_cardinal<T>::value;
}
58 changes: 30 additions & 28 deletions include/eve/module/algo/algo/concepts/ranges_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,57 +15,59 @@ namespace eve::algo
//================================================================================================
//! @addtogroup algo_concepts
//! @{
//! @typedef iterator for a relaxed range
//================================================================================================

//================================================================================================
//! @typedef iterator_t
//! @brief Iterator for a relaxed range
//!
//! @tparam R - relaxed range to process
//! @tparam R - relaxed range to process
//!
//! **Required header:** `#include <eve/module/algo/algo/concepts.hpp>`
//!
//! @code{.cpp}
//! template <relaxed_range R>
//! using iterator_t = decltype(std::declval<R>().begin());
//! @endcode
//! @}
//! @code{.cpp}
//! template <relaxed_range R>
//! using iterator_t = decltype(std::declval<R>().begin());
//! @endcode
//================================================================================================
template <typename R>
using iterator_t = decltype(std::declval<R>().begin());

//================================================================================================
//! @addtogroup algo_concepts
//! @{
//! @typedef sentinel_t
//! @brief Iterator for a relaxed range
//! @typedef sentinel_t
//! @brief Sentinel for a relaxed range
//!
//! @tparam R - relaxed range to process
//! @tparam R - relaxed range to process
//!
//! **Required header:** `#include <eve/module/algo/algo/concepts.hpp>`
//! **Required header:** `#include <eve/module/algo/algo/concepts.hpp>`
//!
//! @code{.cpp}
//! template <relaxed_range R>
//! using sentinel_t = decltype(std::declval<R>().end());
//! @endcode
//! @}
//! @code{.cpp}
//! template <relaxed_range R>
//! using sentinel_t = decltype(std::declval<R>().end());
//! @endcode
//================================================================================================
template <typename R>
using sentinel_t = decltype(std::declval<R>().end());

//================================================================================================
//! @addtogroup algo_concepts
//! @{
//! @typedef unalgined_iterator_t for a relaxed range
//! @typedef unaligned_iterator_t
//! @brief Unaligned iterator for a relaxed range
//!
//! @tparam R - relaxed range to process
//! @tparam R - relaxed range to process
//!
//! @brief an iterator that can represent every position in the range
//! @brief an iterator that can represent every position in the range
//!
//! **Required header:** `#include <eve/module/algo/algo/concepts.hpp>`
//!
//! @code{.cpp}
//! template <typename R>
//! using unaligned_iterator_t = unaligned_t<iterator_t<R>>;
//! @endcode
//! @}
//! @code{.cpp}
//! template <typename R>
//! using unaligned_iterator_t = unaligned_t<iterator_t<R>>;
//! @endcode
//================================================================================================
template <typename R>
using unaligned_iterator_t = unaligned_t<iterator_t<R>>;

//================================================================================================
//! @}
//================================================================================================
}
4 changes: 4 additions & 0 deletions include/eve/module/algo/algo/container/soa_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ namespace eve::algo
size_ = n;
}

//! @brief Resizes the current eve::soa_vector to a new size
void resize(size_type n) { resize(n, value_type{}); }

//! @brief Exchanges the contents of the container with those of `other`.
Expand All @@ -259,6 +260,7 @@ namespace eve::algo
//! @brief Swaps the contents of `lhs` and `rhs` by calling `lhs.swap(rhs)`.
friend EVE_FORCEINLINE void swap(soa_vector &lhs, soa_vector &rhs) noexcept { lhs.swap(rhs); }

//! @brief Retrieves an instance of the current allocator
Allocator get_allocator() { return storage.get_allocator(); }

//==============================================================================================
Expand Down Expand Up @@ -352,12 +354,14 @@ namespace eve::algo
//! @name Comparisons and ordering
//! @{
//==============================================================================================
//! @brief Checks if the contents of lhs and rhs are equal
friend bool operator==(soa_vector const& lhs, soa_vector const& rhs)
{
if( lhs.size() != rhs.size() ) return false;
return eve::algo::equal(lhs, rhs.begin_aligned());
}

//! @brief Checks if the contents of lhs and rhs are not equal
friend bool operator!=(soa_vector const& lhs, soa_vector const& rhs)
{
return !(lhs == rhs);
Expand Down
Loading

0 comments on commit 4576d5b

Please sign in to comment.