Skip to content
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

Add support for ARM64 platforms #1

Draft
wants to merge 1 commit into
base: oidn2
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions src/cpu/aarch64/cpu_isa_traits.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright 2018-2022 Intel Corporation
* Copyright 2020-2022 FUJITSU LIMITED
* Copyright 2018-2023 Intel Corporation
* Copyright 2020-2023 FUJITSU LIMITED
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -27,7 +27,9 @@

/* in order to make selinux happy memory that would be marked with X-bit should
* be obtained with mmap */
#if !defined(_WIN32)
#define XBYAK_USE_MMAP_ALLOCATOR
#endif

#include "cpu/aarch64/xbyak_aarch64/xbyak_aarch64/xbyak_aarch64.h"
#include "cpu/aarch64/xbyak_aarch64/xbyak_aarch64/xbyak_aarch64_util.h"
Expand Down Expand Up @@ -181,15 +183,19 @@ static inline bool mayiuse(const cpu_isa_t cpu_isa, bool soft = false) {
if ((cpu_isa_mask & cpu_isa) != cpu_isa) return false;

switch (cpu_isa) {
case asimd: return cpu().has(Cpu::tADVSIMD);
case asimd: return cpu().has(XBYAK_AARCH64_HWCAP_ADVSIMD);
case sve_128:
return cpu().has(Cpu::tSVE) && cpu().getSveLen() >= SVE_128;
return cpu().has(XBYAK_AARCH64_HWCAP_SVE)
&& cpu().getSveLen() >= SVE_128;
case sve_256:
return cpu().has(Cpu::tSVE) && cpu().getSveLen() >= SVE_256;
return cpu().has(XBYAK_AARCH64_HWCAP_SVE)
&& cpu().getSveLen() >= SVE_256;
case sve_384:
return cpu().has(Cpu::tSVE) && cpu().getSveLen() >= SVE_384;
return cpu().has(XBYAK_AARCH64_HWCAP_SVE)
&& cpu().getSveLen() >= SVE_384;
case sve_512:
return cpu().has(Cpu::tSVE) && cpu().getSveLen() >= SVE_512;
return cpu().has(XBYAK_AARCH64_HWCAP_SVE)
&& cpu().getSveLen() >= SVE_512;
case isa_undef: return true;
case isa_all: return false;
}
Expand Down
7 changes: 6 additions & 1 deletion src/cpu/aarch64/jit_generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@

#include "cpu/jit_utils/jit_utils.hpp"

#if defined(_WIN32) && !defined(__GNUC__)
#define STRUCT_ALIGN(al, ...) __declspec(align(al)) __VA_ARGS__
#else
#define STRUCT_ALIGN(al, ...) __VA_ARGS__ __attribute__((__aligned__(al)))
#endif

#define DECLARE_CPU_JIT_AUX_FUNCTIONS(jit_name) \
const char *name() const override { return STRINGIFY(jit_name); } \
Expand All @@ -50,7 +54,8 @@ typedef enum {

// Callee-saved registers
constexpr Xbyak_aarch64::Operand::Code abi_save_gpr_regs[]
= {Xbyak_aarch64::Operand::X19, Xbyak_aarch64::Operand::X20,
= {Xbyak_aarch64::Operand::X16, Xbyak_aarch64::Operand::X17,
Xbyak_aarch64::Operand::X19, Xbyak_aarch64::Operand::X20,
Xbyak_aarch64::Operand::X21, Xbyak_aarch64::Operand::X22,
Xbyak_aarch64::Operand::X23, Xbyak_aarch64::Operand::X24,
Xbyak_aarch64::Operand::X25, Xbyak_aarch64::Operand::X26,
Expand Down
59 changes: 59 additions & 0 deletions src/cpu/aarch64/xbyak_aarch64/src/err_impl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#pragma once
/*******************************************************************************
* Copyright 2018-2023 Intel Corporation
* Copyright 2020-2023 FUJITSU LIMITED
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/

Error::Error(int err) : err_(err), msg_("") {
if (err_ <= 0)
return;
fprintf(stderr, "bad err=%d in Xbyak::Error\n", err_);
static const char *tbl[32] = {
"none",
"code is too big",
"label is redefined",
"label is too far",
"label is not found",
"bad parameter",
"can't protect",
"offset is too big",
"can't alloc",
"label is not set by L()",
"label is already set by L()",
"internal error",
"illegal register index (can not encoding register index)",
"illegal register element index (can not encoding element index)",
"illegal predicate register type",
"illegal immediate parameter (range error)",
"illegal immediate parameter (unavailable value error)",
"illegal immediate parameter (condition error)",
"illegal shift-mode paramater",
"illegal extend-mode parameter",
"illegal condition parameter",
"illegal barrier option",
"illegal const parameter (range error)",
"illegal const parameter (unavailable error)",
"illegal const parameter (condition error)",
"illegal type",
"bad align",
"bad addressing",
"bad scale",
};
if ((size_t)err_ >= sizeof(tbl) / sizeof(tbl[0])) {
msg_ = "bad err num";
} else {
msg_ = tbl[err_];
}
}
Loading