HNHacker News
TopNewBestAskShowJobs

acuster

47 karma · joined December 10, 2015

submissionscomments
acuster··on How to improve the RISC-V specification
(A better, more considered, response than I gave yesterday.)

Alastair Reid's article "How to improve the RISC-V specification" makes some great points: namely that the RISC-V specification needs improvement, (implicitly) that this work is worth doing, and that testing is integral to specification. These are all great points.

However, a new specification effort for RISC-V requires a much greater effort.

The core document certainly needs to be rewritten with better structure, a more formal presentation of each 'instruction,' better clarity on what it is saying, and fixes to numerous errata. The harder 'fix' requires resolving the tension between its two readerships --- the implementors who must process instructions according to the requirements of the spec versus the coders who need to know what they can expect from the environment in which their instuctions are processed. (The 'unpriviledged' element in the subtitle of the spec is the code being executed.) Problematically, this tension might not be resolvable: since the core instuction set has no side effects and no requirements can be placed on how implementations are made, the spec inherently has no way to express knowledge of whether the code has been processed correctly! Fun.

A new specification effort has a bigger task than fixing, as best as possible, the current document. Alastair Reid's article mentions needing to integrate testing more centrally into the specification. There is also the need to think of this core spec as the foundational document on which to build the whole suite of RISC-V specification documents. A new spec also needs to cater to the even wider readership, beyond 'implementors' and 'coders,' that accompanies projects with wide-spread success. For example, the spec ought to serve companies or governments in their procurement contracts, so they can express what is meant by deliverables which are conformant with the specification. Ideally, this wider readership under consideration would also include 'students,' that is smart people who have less a priori knowledge of the domain than that which the original 'manual' was able to assume.

This is all a lot of work, which would be of great benefit to the community but which no one in the community has any reason to, or really could, take on. Ideally, the RISC-V Foundation would scope out the work, take a position on what parts of the effort were worth pushing for, and then make that happen.

acuster··on How to improve the RISC-V specification
Sorry, it's three in the (sunday) morning, and I've been hitting the whysky trying to handle the estabilshment journalists having fun, while other journalists are talking about humans struggling to get water while themselves being asked if they will survive the night. ---I'm not at my best.

You're right to call me on my statement; I should have all my notes on hand to make that claim and I don't. Paah, no, I do: ARMv7-M Architeture Reference Manual ... Part A Application Level Architecture ... ...processor in Thread mode (vs. in Handler mode).

So ARM already has a lot of detail whereas the RISC-V architecture is trying to (has to?) start even more abstract, where code doesn't even have modes (no interrupts).

This all started a pandemic saturday morning, cup of coffee in hand, enthusiasm to read the "RISC-V Spec" and see what I could learn. Download. Confusion: it says "manual," did I get the right thing? ... Ok, yeah, that's what's on offer. Half an hour later, I'm actually pissed off, like actively angry. I'm reading this from the point of view of "what's the execution environment that I'll be working against?" and I'm getting hit with "unprivileged" which is just wrong. It turns out they are mixing up "the environment of general purpose programmers" with "the minimal that needs to be implemented"---it's a royal mess, they kindda give up on it in the middle. I'm angry about being asked to read this as "the product"; it's not even properly proof-edited. So I took my frustration and tried to figure out 'what would you do to make this better?'

The 'RISC-V' spec is trying to specify: [instructions], and what they do to the [architecture]. I don't know much about the details, but I have a notion that there was push back on writing this up as a 'state machine' and how each instruction might change that state. I assume Prof. Asanović had his own good reason to avoid framing things that way but he's yet to give us a good explantion of why. So probably he's right, I just don't know why.

So how could this be done?

I went to look at the history. The original x86 spec was tied to the chip they were trying to sell. PowerPC, MIPS, if I remember right, were not 'specified' in a clean way--none of them had the same challenge as RISC-V does, starting in pure execution environment mode. I went to read the infamous von Newmann writeup and got side-tracked by his virtural neurons but didn't find the right level of abstraction there either.

So, I'm sorry I can't really justify myself here, but this is all subtle and hard. From what I have found, I don't think anyone has faced the challenge that RISC-V faces, so I don't think we have a roadmap for the spec that RISC-V ought to have.

cheers

acuster··on How to improve the RISC-V specification
You are quite right that the document that 'specifies' RISC-V remains a key weakness in the whole movement.

For expediency, the choice was made to not sweat it. So the document is actually called a 'Manual' but is linked as being the specification. Even so, the document needs a real editor to review it. For example, the preferred bit pattern which is to be processed by an implementation as doing nothing but incrementing the program counter ('no op') is called an 'instruction' in some sections but is clearly not in others---a dumb discrepency. A review by a good technical editor would be a great first step in improving the document.

However, the greater tragedy is that a great 'specification' for RISC-V would be an invaluable educational document. This would be a very hard document to write. No document that I could find has ever tried to specify an instruction set independent of an actual implementation. So there is no roadmap towards writing a good spec for RISC-V. This is surely one of the reasons the effort has not yet been started.

After a couple of months trying to imagine how such an effort could be undertaken, how one could argue that the effort was worth trying, and how I might convince the community of the value and need for a good spec, I gave up. The work would require a team combining very fine technical knowledge with exeedingly accurate control of technical english. The work would be a multi-person-year effort, requiring concomitant funding. It is not clear to me how this work might begin.

Also you are entirely right to think about the test suite as a central concern. Specifications are strange documents. Some specifications make requirements which can not be tested; this affects the very nature of what is being 'specified'. Others have tried to root every injunction in the test suite; that approach leads to its own difficulties. The specification will have to make its choice on the matter and the authors would benefit from being very clear with themselves about what stance they are taking on the matter.

So thanks for your argument for a better specification; it would be a wonderful addition to the open instruction set. Hopefully, somehow, such an effort finds its wings.

acuster··on Update on grade strike
One of the better ways that occurred to me when we Cal grad students were protesting a couple of decades ago was, rather than withhold the grades, simply to give everyone an 'A'. That form of protest most directly targeted the institution since it simply affected its reputation. The students were not hurt, the grad students could comply with their obligations and move on. I am surprised that such an approach never took off.
acuster··on Sweden’s central bank says it has begun testing an e-krona
You are right, of course, that most of the accounts at the central bank are digital. Also, 'money' is a loose term and 'digital money' much more so. I used the term loosely since fully defining it would take a lot of time and space.

The difference of the initiatives, such as the 'e-krona' project, comes from central banks asking themselves whether the public at large could have an obligation, direct from the central bank, in digital form. Most cash is an 'obligation' to some central bank, a guarantee backed by them. Yet no individual citizen can hold a digital account with the central bank. A natural question is 'why not'? Up to now, it has been mostly practical, that the bank did not want to have to run a retail system. The rise of digital currencies has opened a new possibility: the central bank could run the system and not need to run retail operations. Thus, the research and experiments.

acuster··on Sweden’s central bank says it has begun testing an e-krona
Kudos to the swedes for working methodically to try to find a way for the central bank to issue digital money. They have been working for a number of years on this and seem to be thinking effectively about all of the issues involved.

One of the reasons that most interest me in this type of digital money comes from its use by the government itself within its various branches. Moving the financial accounts of the government from internal systems to a public blockchain potentially opens up the government accounts to public scrutiny in a way that has not yet been possible. This offers a potential for transparency which matters less, perhaps, in Sweden, than in other governments around the world.

acuster··on Sweden’s central bank says it has begun testing an e-krona
External Auditing. I can't audit the central bank's server but I can audit the publicly published blockchain.
acuster··on Three facts from “Our World in Data” that everyone should know
Your 'one thing' is exactly what Thomas Malthus originally wrote about in the first well-known book on population growth!

His thesis, glibly summarized, was that population growth gives the rich a structural problem: given that reproduction is inherently exponential and the poor reproduce more than the rich, the only logical consequence is that poor people will overwhelm the rich.