The RISC-V unprivileged ISA document recently added this paragraph in
section 28.3, "Instruction-Set Extension Names":
Some ISA extensions depend on the presence of other extensions,
e.g., "D" requires "F" and "F" requires "Zicsr". However, ISA
strings may not omit the implied extensions, so, for example,
RV32ID may not be used to imply RV32IFDZicsr.
I wonder if this new rule has consequences that haven't been
considered. What happens if, in the future, the RISC-V Foundation
wants to standardize subsets of extensions F and D, with, let's say,
names Zfsubset and Zdsubset? It seems to me that extension F would
then depend on Zfsubset, and D would depend on Zdsubset, just as much
as D depends on F. After all, what does it mean that "extension x
depends on extension y" other than that y is a subset of x?
Thus, by the simple act of blessing Zfsubset and Zdsubset as standard
extensions, the Foundation would cause previously correct names such
as RV32IFDZicsr to suddenly become wrong. Instead, the officially
correct name would suddenly change to RV32IFDZicsr_Zfsubset_Zdsubset.
Obviously, this process of name expansion could occur more than once.
Am I the only one who thinks this is a mistake?
In fact, I've always believed the rule should be the opposite: The
subset extensions can (and normally should) be omitted from the full
name. So instead of RV32IFDZicsr_Zfsubset_Zdsubset, it's just RV32ID,
with the rest being implied.
The document says it's concerned about the possibility that "the
dependence between extensions could be broken". However, I'm unable
to construct any scenario where such a change is made less disruptive
because of the current name rule. If the definition of extension F
is changed so that F is no longer a subset of D, then surely that
has consequences for existing cores which implement F and D under the
old definitions, regardless of whether you call the cores RV32ID or
RV32IFDZicsr. I.e., if the definition of F changes, then cores that
were earlier called RV32IFDZicsr are no more compatible with the new F
than if they'd been called RV32ID. So I wonder, what problem is the
current name rule actually solving?
Regards,
- John Hauser
--
You received this message because you are subscribed to the Google Groups "RISC-V ISA Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isa-dev+u...@groups.riscv.org.
To post to this group, send email to isa...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/isa-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/ab650d02-cd5d-4447-96c0-6daa9353ddf1%40groups.riscv.org.
To quickly respond to the particular point you make in the paragraph quoted above: I think there is a difference between "is a subset of" and "depends upon" and the concern you raise could be avoided by simply not declaring F to be dependent on Zfsubset. Do you see a problem with that?
--
Regards,
- John Hauser
You received this message because you are subscribed to the Google Groups "RISC-V ISA Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isa-dev+u...@groups.riscv.org.
To post to this group, send email to isa...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/isa-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/905c88f2-155f-4f9a-b00b-80cba713969d%40groups.riscv.org.
regards,
Liviu
--
You received this message because you are subscribed to the Google Groups "RISC-V ISA Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isa-dev+u...@groups.riscv.org.
To post to this group, send email to isa...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/isa-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/CF276108-6A95-4F1E-BC7C-F89120CD6635%40livius.net.
regards,
Liviu
--
You received this message because you are subscribed to the Google Groups "RISC-V ISA Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isa-dev+u...@groups.riscv.org.
To post to this group, send email to isa...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/isa-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/720D792A-DBF6-421E-BB5C-056A2FEBD23A%40livius.net.
You might say it's contrived, but you can imagine a specialized embedded processor that needs double-precision floating-point hardware but has no use for single-precision. If such a configuration became important enough that we wanted to legalize it, what would we name it? Obviously, RV32ID wouldn't work, if RV32ID implied F.
I suppose one answer is to assign a new name altogether for that configuration (RV32I_ZDSansF). That would render moot the remark in the spec that "the dependence between extensions could be broken".
If you convert to double, perform an operation, and then convert back
to float, you will get double rounding errors. The end result will
not be a correct IEEE float result in that case.
... I would expect such a platform to define a custom ABI that defines float to be the same type as double.
is there any support in the compiler to do so? or a custom compiler is required?
Hi John,
I think that there's more here
than just the names. If you separate F and D the way you're
suggesting, you have to say that three user CSRs (floating point
control/status) need to be instantiated by either of F or D but
that it's incorrect to make two copies. It's similar for
floating point data registers, but there's the length difference
as well. I'm not saying that such definitions can't be done,
just that it adds an additional kind of rule that needs to be
considered. Removing repetition but adding complexity in the
working out of rules may not be a good trade-off.
Bill
--
You received this message because you are subscribed to the Google Groups "RISC-V ISA Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isa-dev+u...@groups.riscv.org.
To post to this group, send email to isa...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/isa-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/d93b739a-f083-4c33-87a5-6a051bee5d6e%40groups.riscv.org.
I think that there's more here than just the names. If you separate F and D the way you're suggesting, you have to say that three user CSRs (floating point control/status) need to be instantiated by either of F or D but that it's incorrect to make two copies. It's similar for floating point data registers, but there's the length difference as well. I'm not saying that such definitions can't be done, just that it adds an additional kind of rule that needs to be considered. Removing repetition but adding complexity in the working out of rules may not be a good trade-off.
Andrew wrote:You might say it's contrived, but you can imagine a specialized embedded processor that needs double-precision floating-point hardware but has no use for single-precision. If such a configuration became important enough that we wanted to legalize it, what would we name it? Obviously, RV32ID wouldn't work, if RV32ID implied F.
Okay, I see your point, but one can well argue that what your proposing
isn't really the same as the D extension as it's currently described,
and hence...I suppose one answer is to assign a new name altogether for that configuration (RV32I_ZDSansF). That would render moot the remark in the spec that "the dependence between extensions could be broken".
... a new name seems like a good idea for this case.
Alternatively, a better option for the specific case of F and D might
be this: In the documents, stop saying that extension D requires
extension F, and leave that instead to the platform specs. I think the
only detail to sort out would be whether the D extension alone should
imply these instructions:
FCVT.S.D
FCVT.D.S
FLW
FSW
FMV.W.X
FMV.X.W
(My vote is "yes", they are always in D, even without F.)
If the Foundation took this approach, then F and D would be separable
extensions. Either F or D would necessarily imply Zicsr. Then,
following my recommended naming rules, you would have "RV32IF" for F
alone, "RV32IFD" for both F and D, but you wouldn't write "RV32IFZicsr"
or "RV32IFDZicsr" because that's both problematic and needlessly
redundant.
The bottom line is, I think there are other ways to deal with this
specific case (and perhaps a few like it), while adopting what I think
are simpler conventions for ISA naming.
Jim Wilson:If you convert to double, perform an operation, and then convert back
to float, you will get double rounding errors. The end result will
not be a correct IEEE float result in that case.Regards,
Actually, while that sentiment is correct in general, for the specific
instance being discussed (emulating RISC-V's F instructions by
converting single-precision to double, operating in double, and
rounding back to single), double rounding is a risk only for the fused
multiply-add instructions. For all the other instructions currently
defined for F, you'll always get the correct IEEE answer.
- John Hauser
--
You received this message because you are subscribed to the Google Groups "RISC-V ISA Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isa-dev+u...@groups.riscv.org.
To post to this group, send email to isa...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/isa-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/d93b739a-f083-4c33-87a5-6a051bee5d6e%40groups.riscv.org.
Alternatively, a better option for the specific case of F and D might
be this: In the documents, stop saying that extension D requires
extension F, and leave that instead to the platform specs. I think the
only detail to sort out would be whether the D extension alone should
imply these instructions:
FCVT.S.D
FCVT.D.S
FLW
FSW
FMV.W.X
FMV.X.W
(My vote is "yes", they are always in D, even without F.)
I tentatively agree, but I don't want to get bogged down in defining D-sans-F right now.
Yeah, I don't have any strong allegiance to one scheme or the other, so maybe we should just optimize for compatibility with previous versions of the ISA-naming scheme. That would mean that F implies the existence of Zicsr, so RV32IF == RV32IFZicsr.The case for "D implies F" is less clear w.r.t. compatibility, since the previous versions of the spec don't take a stance as to whether RV32ID == RV32IFD, and current software will reject RV32ID as an invalid ISA.
--
- John Hauser
You received this message because you are subscribed to the Google Groups "RISC-V ISA Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isa-dev+u...@groups.riscv.org.
To post to this group, send email to isa...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/isa-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/1c3aa2b4-0334-4ea7-9c48-ba818df4c5a5%40groups.riscv.org.
l.
On Thu, Dec 13, 2018 at 1:35 PM Liviu Ionescu <i...@livius.net> wrote:
> sorry if not directly related to the subject, but how should the compiler generate code for float operations in such a case? use soft float? is it an efficient way to covert between floats and doubles, such that is is better to perform the operations in double and strip the results?
If you convert to double, perform an operation, and then convert back
to float, you will get double rounding errors. The end result will
not be a correct IEEE float result in that case. Soft-float will be
slower, but will give correctly rounded results.
Hi Bruce,
I think you are assuming that if
you take two single-precision floating-point numbers, convert to
double precision, do an add/sub/mul/div operation in
double-precision (in any rounding mode) then convert back to
single-precision (with the same round mode), you will get the
single-precision answer. I don't have a counter example here.
I don't think you meant you could
start with any double-precision floating-point operands, operate
and round.
More seriously, I don't think this works for FMA operations for much the same reason it doesn't work if you do more than one operation without rounding. More specifically, I think you can get a pre-rounding FMA result to be very near the single-precision-half-ulp point and have the double precision round take it to exactly the single-precision-half-ulp point where round-to-even then takes it the wrong way on convert to single.
If it, indeed, doesn't work for
FMA, that would be important in the RISC-V floating-point.
Bill
--
You received this message because you are subscribed to the Google Groups "RISC-V ISA Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isa-dev+u...@groups.riscv.org.
To post to this group, send email to isa...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/isa-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/CAP8PnuSRK2nuJ1mh4Q0ErVR8n5fGPeDARdsgjYLygqfs5SKkuQ%40mail.gmail.com.
Hi Bruce,
I think you are assuming that if you take two single-precision floating-point numbers, convert to double precision, do an add/sub/mul/div operation in double-precision (in any rounding mode) then convert back to single-precision (with the same round mode), you will get the single-precision answer. I don't have a counter example here.
I don't think you meant you could start with any double-precision floating-point operands, operate and round.
More seriously, I don't think this works for FMA operations for much the same reason it doesn't work if you do more than one operation without rounding. More specifically, I think you can get a pre-rounding FMA result to be very near the single-precision-half-ulp point and have the double precision round take it to exactly the single-precision-half-ulp point where round-to-even then takes it the wrong way on convert to single.
If it, indeed, doesn't work for FMA, that would be important in the RISC-V floating-point.