- name: Set up QEMU
uses: docker/setup-qemu-action@v3
+ with:
+ image: tonistiigi/binfmt:qemu-v7.0.0-28
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
target_include_directories(whisper PUBLIC . ../include)
target_compile_features (whisper PUBLIC cxx_std_11) # don't bump
+if (CMAKE_CXX_BYTE_ORDER STREQUAL "BIG_ENDIAN")
+ set(WHISPER_EXTRA_FLAGS ${WHISPER_EXTRA_FLAGS} -DWHISPER_BIG_ENDIAN)
+endif()
+
if (WHISPER_EXTRA_FLAGS)
target_compile_options(whisper PRIVATE ${WHISPER_EXTRA_FLAGS})
endif()
#pragma warning(disable: 4244 4267) // possible loss of data
#endif
-#if defined(GGML_BIG_ENDIAN)
-#include <bit>
-
+#if defined(WHISPER_BIG_ENDIAN)
template<typename T>
static T byteswap(T value) {
- return std::byteswap(value);
-}
-
-template<>
-float byteswap(float value) {
- return std::bit_cast<float>(byteswap(std::bit_cast<std::uint32_t>(value)));
+ T value_swapped;
+ char * source = reinterpret_cast<char *>(&value);
+ char * target = reinterpret_cast<char *>(&value_swapped);
+ int size = sizeof(T);
+ for (int i = 0; i < size; i++) {
+ target[size - 1 - i] = source[i];
+ }
+ return value_swapped;
}
template<typename T>
}
#define BYTESWAP_VALUE(d) d = byteswap(d)
-#define BYTESWAP_FILTERS(f) \
+#define BYTESWAP_FILTERS(f) \
do { \
for (auto & datum : f.data) { \
datum = byteswap(datum); \
} \
} while (0)
-#define BYTESWAP_TENSOR(t) \
- do { \
+#define BYTESWAP_TENSOR(t) \
+ do { \
byteswap_tensor(t); \
} while (0)
#else