Skip to content

Commit 8fd2a55

Browse files
authored
Refactor math simd (#2070)
1 parent 695ccc0 commit 8fd2a55

26 files changed

+1281
-1579
lines changed

1k/1kiss.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,7 @@ function setup_cmake($skipOS = $false, $scope = 'local') {
895895
else {
896896
& "$cmake_pkg_path" '--skip-license' '--prefix=/usr/local' 1>$null 2>$null
897897
}
898+
if (!$?) { Remove-Item $cmake_pkg_path -Force }
898899
}
899900

900901
$cmake_prog, $_ = find_prog -name 'cmake' -path $cmake_bin -silent $true

1k/fetch.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,16 @@ function(_1kfetch_init)
2020
set(_1kfetch_manifest "${_1kfetch_manifest}" CACHE STRING "" FORCE)
2121
endif()
2222

23+
if(NOT EXISTS ${PWSH_PROG}) # try again
24+
unset(PWSH_PROG CACHE)
25+
find_program(PWSH_PROG NAMES pwsh powershell NO_PACKAGE_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH NO_CMAKE_FIND_ROOT_PATH)
26+
endif()
27+
2328
execute_process(COMMAND ${PWSH_PROG} ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/resolv-uri.ps1
2429
-name "1kdist"
2530
-manifest ${_1kfetch_manifest}
2631
OUTPUT_VARIABLE _1kdist_url
32+
RESULT_VARIABLE _1kdist_error
2733
)
2834

2935
if(_1kdist_url)
@@ -33,7 +39,7 @@ function(_1kfetch_init)
3339
set(_1kdist_base_url "${_1kdist_base_url}/${_1kdist_ver}" PARENT_SCOPE)
3440
set(_1kdist_ver ${_1kdist_ver} PARENT_SCOPE)
3541
else()
36-
message(WARNING "Resolve 1kdist uri fail, the _1kfetch_dist will not work")
42+
message(WARNING "Resolve 1kdist uri fail, ${_1kdist_error}, the _1kfetch_dist will not work")
3743
endif()
3844
endfunction()
3945

3rdparty/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@
248248

249249
## yasio
250250
- [![Upstream](https://img.shields.io/github/v/release/yasio/yasio?label=Upstream)](https://github.com/yasio/yasio)
251-
- Version: 4.2.3
251+
- Version: 4.2.4
252252
- License: MIT WITH Anti-996
253253

254254
## zlib

3rdparty/yasio/yasio/bindings/yasio_ni.cpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ YASIO_NI_API void yasio_init_globals(void(YASIO_INTEROP_DECL* pfn)(int level, co
6060
YASIO_NI_API void yasio_cleanup_globals() { io_service::cleanup_globals(); }
6161

6262
struct yasio_io_event {
63-
int kind; //
64-
int channel;
65-
void* thandle;
63+
int kind; // event kind
64+
int channel; // channel index
65+
void* thandle; // transport
6666
union {
67-
void* msg;
68-
int status; //
67+
void* hmsg; // io_packet*
68+
int ec; // error code
6969
};
70-
void* user;
70+
void* user; // user data
7171
};
7272

7373
YASIO_NI_API void* yasio_create_service(int channel_count, void(YASIO_INTEROP_DECL* event_cb)(yasio_io_event* event), void* user)
@@ -82,9 +82,9 @@ YASIO_NI_API void* yasio_create_service(int channel_count, void(YASIO_INTEROP_DE
8282
event.thandle = e->transport();
8383
event.user = user;
8484
if (event.kind == yasio::YEK_ON_PACKET)
85-
event.msg = !is_packet_empty(pkt) ? &pkt : nullptr;
85+
event.hmsg = !is_packet_empty(pkt) ? &pkt : nullptr;
8686
else
87-
event.status = e->status();
87+
event.ec = e->status();
8888
event_cb(&event);
8989
});
9090
return service;
@@ -157,8 +157,12 @@ YASIO_NI_API void yasio_set_option(void* service_ptr, int opt, const char* pszAr
157157
std::array<cxx17::string_view, YASIO_MAX_OPTION_ARGC> args;
158158
int argc = 0;
159159
yasio::split_if(&strArgs.front(), ';', [&](char* s, char* e) {
160-
*e = '\0'; // to c style string
161-
args[argc++] = cxx17::string_view(s, e - s);
160+
if (e) {
161+
*e = '\0'; // to c style string
162+
args[argc++] = cxx17::string_view(s, e - s);
163+
} else {
164+
args[argc++] = cxx17::string_view{s};
165+
}
162166
return (argc < YASIO_MAX_OPTION_ARGC);
163167
});
164168

3rdparty/yasio/yasio/config.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ SOFTWARE.
205205
/*
206206
** The yasio version macros
207207
*/
208-
#define YASIO_VERSION_NUM 0x040203
208+
#define YASIO_VERSION_NUM 0x040204
209209

210210
/*
211211
** The macros used by io_service.

3rdparty/yasio/yasio/impl/eventfd_select_interrupter.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
#include <sys/stat.h>
2121
#include <sys/types.h>
2222
#include <fcntl.h>
23-
#if defined(__GLIBC__) && (__GLIBC__ == 2 && __GLIBC_MINOR__ < 8)
24-
# include <asm/unistd.h>
25-
#else // __GLIBC__ == 2 && __GLIBC_MINOR__ < 8
23+
#if defined(__GLIBC__) && (__GLIBC__ == 2 && __GLIBC_MINOR__ < 8) && !defined(__UCLIBC__)
24+
# include <asm/unistd.h> // for syscall without API: eventfd
25+
#else
2626
# include <sys/eventfd.h>
27-
#endif // __GLIBC__ == 2 && __GLIBC_MINOR__ < 8
27+
#endif
2828

2929
#include <unistd.h>
3030

@@ -105,7 +105,7 @@ class eventfd_select_interrupter {
105105
// Open the descriptors. Throws on error.
106106
inline void open_descriptors()
107107
{
108-
#if defined(__GLIBC__) && (__GLIBC__ == 2 && __GLIBC_MINOR__ < 8)
108+
#if defined(__GLIBC__) && (__GLIBC__ == 2 && __GLIBC_MINOR__ < 8) && !defined(__UCLIBC__)
109109
write_descriptor_ = read_descriptor_ = syscall(__NR_eventfd, 0);
110110
if (read_descriptor_ != -1)
111111
{

3rdparty/yasio/yasio/logging.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ inline void yasio__print(std::string&& message) { ::write(::fileno(stdout), mess
4040
# include <android/log.h>
4141
# include <jni.h>
4242
# define YASIO_LOG_TAG(tag, format, ...) __android_log_print(ANDROID_LOG_INFO, "yasio", (tag format), ##__VA_ARGS__)
43+
#elif defined(__OHOS__)
44+
# include <hilog/log.h>
45+
# define YASIO_LOG_TAG(tag, format, ...) OH_LOG_INFO(LOG_APP, (tag format "\n"), ##__VA_ARGS__)
4346
#else
4447
# define YASIO_LOG_TAG(tag, format, ...) printf((tag format "\n"), ##__VA_ARGS__)
4548
#endif

3rdparty/yasio/yasio/xxsocket.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ int xxsocket::pserve(const endpoint& ep)
209209
if (!this->reopen(ep.af()))
210210
return -1;
211211

212-
set_optval(SOL_SOCKET, SO_REUSEADDR, 1);
212+
this->reuse_address(true);
213213

214214
int n = this->bind(ep);
215215
if (n != 0)

CMakeOptions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ default is: `navigator.hardwareConcurrency`
5252
- AX_WASM_SHELL_FILE: specify the wasm shell file, by default use `${_AX_ROOT}/core/platform/wasm/shell_minimal.html`
5353
- AX_WASM_ENABLE_DEVTOOLS: whether enable web devtools aka `pause`, `resume`, `step` buttons in webpage, default: `TRUE`
5454
- AX_WASM_INITIAL_MEMORY: set the wasm initial memory size, default `1024MB`
55+
- AX_WASM_ISA_SIMD: specify the wasm simd intrinsics type, default `none`, supports `sse`, `neon`, note the `wasm-simd` not support by axmol yet
5556

5657
## The options for axmol apps
5758

cmake/Modules/AXConfigDefine.cmake

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,22 +186,21 @@ endfunction()
186186

187187
if(EMSCRIPTEN)
188188
set(AX_WASM_THREADS "4" CACHE STRING "Wasm threads count")
189-
190-
set(_AX_WASM_THREADS_INT 0)
189+
set(_threads_hint "")
191190
if (AX_WASM_THREADS STREQUAL "auto") # not empty string or not 0
192191
# Enable pthread support globally
192+
set(_threads_hint "(auto)")
193193
include(ProcessorCount)
194+
set(_AX_WASM_THREADS_INT 0)
194195
ProcessorCount(_AX_WASM_THREADS_INT)
195-
elseif(AX_WASM_THREADS MATCHES "^([0-9]+)$" OR AX_WASM_THREADS STREQUAL "navigator.hardwareConcurrency")
196-
set(_AX_WASM_THREADS_INT ${AX_WASM_THREADS})
196+
set(AX_WASM_THREADS "${_AX_WASM_THREADS_INT}" CACHE STRING "Wasm threads count" FORCE)
197197
endif()
198198

199-
message(STATUS "AX_WASM_THREADS=${AX_WASM_THREADS}")
200-
message(STATUS "_AX_WASM_THREADS_INT=${_AX_WASM_THREADS_INT}")
199+
message(STATUS "AX_WASM_THREADS=${AX_WASM_THREADS}${_threads_hint}")
201200

202-
if (_AX_WASM_THREADS_INT)
201+
if(AX_WASM_THREADS MATCHES "^([0-9]+)$" OR AX_WASM_THREADS STREQUAL "navigator.hardwareConcurrency")
203202
list(APPEND _ax_compile_options -pthread)
204-
add_link_options(-pthread -sPTHREAD_POOL_SIZE=${_AX_WASM_THREADS_INT})
203+
add_link_options(-pthread -sPTHREAD_POOL_SIZE=${AX_WASM_THREADS})
205204
endif()
206205

207206
set(AX_WASM_INITIAL_MEMORY "1024MB" CACHE STRING "")

0 commit comments

Comments
 (0)