Skip to content

Commit

Permalink
build: fix int/size_t implicit cast
Browse files Browse the repository at this point in the history
  • Loading branch information
mgouicem committed Oct 11, 2024
1 parent 0613385 commit 926e54a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/common/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,13 @@ constexpr bool any_null(Args... ptrs) {
return one_of(nullptr, ptrs...);
}

// Workaround on macos/gcc14.2 build error for static arrays
template <typename T, size_t ndims>
inline void array_copy(T dst[ndims], const T src[ndims], size_t size) {
assert(size < ndims);
for (size_t i = 0; i < size; ++i)
dst[i] = src[i];
}
template <typename T>
inline void array_copy(T *dst, const T *src, size_t size) {
for (size_t i = 0; i < size; ++i)
Expand Down
2 changes: 1 addition & 1 deletion src/cpu/reorder/simple_reorder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ inline dim_t get_quant_off(const dims_t &input_idx, const int ndims,
const int quant_mask, const dim_t g0, const dim_t g1,
const memory_desc_t &quant_md) {
dims_t quant_idx {};
utils::array_copy(quant_idx, input_idx, ndims);
utils::array_copy<dim_t, DNNL_MAX_NDIMS>(quant_idx, input_idx, ndims);
utils::apply_mask_on_dims(quant_idx, ndims, quant_mask);
// Note: an `idx` must divide by a group value as grouped quantization
// applies to consecutive points.
Expand Down

0 comments on commit 926e54a

Please sign in to comment.