-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WASM SUpport - Take II #1710
Closed
Closed
WASM SUpport - Take II #1710
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
15bf0ff
Make cpu_ the proper default SIMD API
jfalcou bcb1b76
Fill in WASM arch infos
jfalcou 15e6731
WASM implementation for comparisons
jfalcou 3c02517
WASM make
jfalcou b463460
Add WASM compounds operators
jfalcou 7b626d3
Silly mistakes
jfalcou 5dd2c62
WASM slice
jfalcou cf5a2b0
Fix old concepts names
jfalcou 5989fe1
Add WASM toolchain and runner
jfalcou 466c498
Add WASM runner
jfalcou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
##================================================================================================== | ||
## EVE - Expressive Vector Engine | ||
## Copyright : EVE Project Contributors | ||
## SPDX-License-Identifier: BSL-1.0 | ||
## Copyright : EVE Contributors & Maintainers | ||
## SPDX-License-Identifier: MIT | ||
##================================================================================================== | ||
#!/bin/sh | ||
|
||
node $@ | ||
node --experimental-wasm-simd $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
//================================================================================================== | ||
/* | ||
EVE - Expressive Vector Engine | ||
Copyright : EVE Contributors & Maintainers | ||
SPDX-License-Identifier: MIT | ||
*/ | ||
//================================================================================================== | ||
#pragma once | ||
|
||
#include <eve/arch/wasm/predef.hpp> | ||
|
||
#include <type_traits> | ||
|
||
namespace eve | ||
{ | ||
template<typename T> struct logical; | ||
struct wasm_128_; | ||
} | ||
|
||
#if defined(EVE_HW_WASM) | ||
|
||
namespace eve | ||
{ | ||
// Check the types are fine then return *the* WASM SIMD type: v128_t | ||
template<typename Type, typename Size> struct as_register<Type, Size, eve::wasm_128_> | ||
{ | ||
static constexpr auto find() | ||
{ | ||
constexpr auto width = sizeof(Type) * Size::value; | ||
if constexpr( width <= 16 ) | ||
{ | ||
if constexpr( std::is_same_v<Type, double> ) return v128_t {}; | ||
else if constexpr( std::is_same_v<Type, float> ) return v128_t {}; | ||
else if constexpr( std::is_integral_v<Type> ) return v128_t {}; | ||
} | ||
} | ||
|
||
using type = decltype(find()); | ||
static_assert(!std::is_void_v<type>, "[eve WASM] - Type is not usable in a SIMD register"); | ||
}; | ||
|
||
// logical uses same registers | ||
template<typename T, typename Size> | ||
struct as_logical_register<T, Size, eve::wasm_128_> : as_register<T, Size, eve::wasm_128_> | ||
{}; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//================================================================================================== | ||
/* | ||
EVE - Expressive Vector Engine | ||
Copyright : EVE Contributors & Maintainers | ||
SPDX-License-Identifier: MIT | ||
*/ | ||
//================================================================================================== | ||
#pragma once | ||
|
||
#include <eve/arch/wasm/tags.hpp> | ||
#include <eve/detail/spy.hpp> | ||
|
||
namespace eve | ||
{ | ||
//================================================================================================== | ||
// Runtime detection of CPU support | ||
//================================================================================================== | ||
template<auto Version> | ||
inline bool is_supported(spy::wasm_simd_info<Version> const&) noexcept | ||
{ | ||
#if defined(EVE_HW_WASM) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. current_api >= eve::wasm? |
||
return true; | ||
#else | ||
return false; | ||
#endif | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//================================================================================================== | ||
/* | ||
EVE - Expressive Vector Engine | ||
Copyright : EVE Contributors & Maintainers | ||
SPDX-License-Identifier: MIT | ||
*/ | ||
//================================================================================================== | ||
#pragma once | ||
|
||
#include <eve/detail/spy.hpp> | ||
|
||
// We successfully detected some native SIMD | ||
#if defined(SPY_ARCH_IS_WASM) && !defined(EVE_NO_SIMD) | ||
# define EVE_SUPPORTS_NATIVE_SIMD | ||
# define EVE_HW_WASM | ||
# define EVE_INCLUDE_WASM_HEADER | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
//================================================================================================== | ||
/* | ||
EVE - Expressive Vector Engine | ||
Copyright : EVE Contributors & Maintainers | ||
SPDX-License-Identifier: MIT | ||
*/ | ||
//================================================================================================== | ||
#pragma once | ||
|
||
#include <eve/arch/wasm/predef.hpp> | ||
|
||
#include <cstddef> | ||
#include <cstdint> | ||
|
||
//================================================================================================== | ||
// WASM Info | ||
#if defined(EVE_HW_WASM) | ||
namespace eve | ||
{ | ||
struct register_count | ||
{ | ||
static constexpr std::size_t general = 2 * sizeof(void *); | ||
static constexpr std::size_t simd = 2 * sizeof(void *); | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you remind me what this is? especially * sizeof(void *)? are you being too cute with no comments? |
||
} | ||
|
||
//================================================================================================== | ||
// WASM SIMD API/ABI | ||
# if !defined(EVE_CURRENT_API) && defined(SPY_SIMD_IS_WASM) | ||
# include <wasm_simd128.h> | ||
# define EVE_ABI_DETECTED | ||
# define EVE_CURRENT_ABI ::eve::wasm_128_ | ||
# define EVE_CURRENT_API ::eve::simd128_ | ||
# define EVE_ABI_NAMESPACE wasm128_abi_v0 | ||
# endif | ||
|
||
#endif |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this change?