File tree Expand file tree Collapse file tree 3 files changed +18
-12
lines changed Expand file tree Collapse file tree 3 files changed +18
-12
lines changed Original file line number Diff line number Diff line change 28
28
29
29
- name : Set up QEMU
30
30
uses : docker/setup-qemu-action@v3
31
+ with :
32
+ image : tonistiigi/binfmt:qemu-v7.0.0-28
31
33
32
34
- name : Set up Docker Buildx
33
35
uses : docker/setup-buildx-action@v3
Original file line number Diff line number Diff line change @@ -94,6 +94,10 @@ set_target_properties(whisper PROPERTIES
94
94
target_include_directories (whisper PUBLIC . ../include )
95
95
target_compile_features (whisper PUBLIC cxx_std_11 ) # don't bump
96
96
97
+ if (CMAKE_CXX_BYTE_ORDER STREQUAL "BIG_ENDIAN" )
98
+ set (WHISPER_EXTRA_FLAGS ${WHISPER_EXTRA_FLAGS} -DWHISPER_BIG_ENDIAN )
99
+ endif ()
100
+
97
101
if (WHISPER_EXTRA_FLAGS )
98
102
target_compile_options (whisper PRIVATE ${WHISPER_EXTRA_FLAGS} )
99
103
endif ()
Original file line number Diff line number Diff line change 39
39
#pragma warning(disable: 4244 4267) // possible loss of data
40
40
#endif
41
41
42
- #if defined(GGML_BIG_ENDIAN)
43
- #include < bit>
44
-
42
+ #if defined(WHISPER_BIG_ENDIAN)
45
43
template <typename T>
46
44
static T byteswap (T value) {
47
- return std::byteswap (value);
48
- }
49
-
50
- template <>
51
- float byteswap (float value) {
52
- return std::bit_cast<float >(byteswap (std::bit_cast<std::uint32_t >(value)));
45
+ T value_swapped;
46
+ char * source = reinterpret_cast <char *>(&value);
47
+ char * target = reinterpret_cast <char *>(&value_swapped);
48
+ int size = sizeof (T);
49
+ for (int i = 0 ; i < size; i++) {
50
+ target[size - 1 - i] = source[i];
51
+ }
52
+ return value_swapped;
53
53
}
54
54
55
55
template <typename T>
@@ -85,14 +85,14 @@ static void byteswap_tensor(ggml_tensor * tensor) {
85
85
}
86
86
87
87
#define BYTESWAP_VALUE (d ) d = byteswap(d)
88
- #define BYTESWAP_FILTERS (f ) \
88
+ #define BYTESWAP_FILTERS (f ) \
89
89
do { \
90
90
for (auto & datum : f.data ) { \
91
91
datum = byteswap (datum); \
92
92
} \
93
93
} while (0 )
94
- #define BYTESWAP_TENSOR (t ) \
95
- do { \
94
+ #define BYTESWAP_TENSOR (t ) \
95
+ do { \
96
96
byteswap_tensor (t); \
97
97
} while (0 )
98
98
#else
You can’t perform that action at this time.
0 commit comments