-
Notifications
You must be signed in to change notification settings - Fork 22
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
[AArch64] NEON, SVE2 and SME2 instruction support with tests #439
base: dev
Are you sure you want to change the base?
Conversation
ec02455
to
e7d34e1
Compare
f9a759f
to
f2b86fa
Compare
f2b86fa
to
796b99e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only a few comments
796b99e
to
5ff6446
Compare
@@ -548,7 +549,7 @@ void Instruction::decode() { | |||
} else if (metadata_.operands[0].is_vreg) { | |||
setInstructionType(InsnType::isVectorData); | |||
} else if ((metadata_.operands[0].reg >= AARCH64_REG_ZAB0 && | |||
metadata_.operands[0].reg <= AARCH64_REG_ZT0) || | |||
metadata_.operands[0].reg < AARCH64_REG_ZT0) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can ZT0
be used in a SVE context?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ZT0
is enabled / disabled in the same way as Z0
but has a fixed width of 512-bits, with the logic for detecting whether a ZT0
related instruction can / can't be executed done in instruction_execute
as with all other SME instructions.
Regarding where in a core/implementation ZT0
based instructions are executed, there is no fixed rule in the spec as far as I can tell.... Given its fixed width, to me it seems more SVE-like than SME hence the grouping seen here. And given we don't have co-processor SME support, theres no offload / seperate chip logic to come into play yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I follow the answer given here. I was just wondering if the ZT0 is used in SVE instructions, as it seems to be solely used in SME instructions when looking at the spec. If this is the case, would we not want to identify it as an SME instruction? May have missed something though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having gone through the spec more and how ZT0 is used, you're right - it should be SME not SVE ---- Overthinked this a bit previously I think...
bc91dcd
to
fc308db
Compare
393dd26
to
b027f73
Compare
The base branch was changed.
…ged address generation logic for ST2W and ST4W.
b027f73
to
1d04096
Compare
// Predicate as counter is 16-bits and has the following encoding: | ||
// - Up to first 4 bits encode the element size (0b1, 0b10, 0b100, 0b1000 | ||
// for b h s d respectively) | ||
// - bits 0->LSZ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LSZ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is terminology from the spec on how predicate-as-counter works. It is LSZ
as the number of bits used is dynamic. I'll try find a webpage with this info to better explain it in the comment
// - Bit 15 represents the invert bit | ||
std::array<uint64_t, 4> out = {0, 0, 0, 0}; | ||
|
||
// Set invert bit to 1 and count to 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add some context for this choice, i.e. relate it back to ptrue. I assume it's because you want to denote true as 0 inactive elements?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, this is how the spec defined it -- will try and find a source to better explain
* W represents how many source elements are multiplied to form an output | ||
* element (i.e. for 4-way, W = 4). | ||
* Returns correctly formatted RegisterValue. */ | ||
template <typename D, typename N, int W> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't N always uint8_t and W 4? May have missed something in the docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will double check and alter if so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -548,7 +549,7 @@ void Instruction::decode() { | |||
} else if (metadata_.operands[0].is_vreg) { | |||
setInstructionType(InsnType::isVectorData); | |||
} else if ((metadata_.operands[0].reg >= AARCH64_REG_ZAB0 && | |||
metadata_.operands[0].reg <= AARCH64_REG_ZT0) || | |||
metadata_.operands[0].reg < AARCH64_REG_ZT0) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I follow the answer given here. I was just wondering if the ZT0 is used in SVE instructions, as it seems to be solely used in SME instructions when looking at the spec. If this is the case, would we not want to identify it as an SME instruction? May have missed something though.
@@ -7,8 +7,52 @@ namespace { | |||
|
|||
using InstSme = AArch64RegressionTest; | |||
|
|||
#if SIMENG_LLVM_VERSION >= 14 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we not able to keep this check in? I assumed this just concerned no SME and SME support as opposed to SME and SME2 support. May have misremembered the LLVM versioning though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah you're correct. Will re-add
This PR adds a wide range of different NEON, SVE2, SME2 instructions with regressions tests. These facilitate a subset of some internal SME-based GEMM and GEMV codes.
There is some BF16 prototypical instruction support which by default is disabled (using a new build option and an if statement in each appropriate switch statement case) due to some usage of
__bf16
which is not compiler agnostic, some hacky usage of memcpy to re-interpretuint16_t
, and a lack of regression tests for the BF16 instructions in question.These BF16 instructions can be enabled through a new CMake option
-DSIMENG_ENABLE_BF16=ON
. I have deliberately not included this in the documentation given the possible instibility of the BF16 implementation and to keep it for (mainly) internal usage only.This branch is based on
sme2-support
(PR #429 ) and so should be merged after this brnch has been merged intodev
.Some SM2 instructions which use multi-vector operands can be non-trivial to read or understand. Please ask for clarification and suggest any additional comments that may help future understanding.