Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch > #33369

"volatile" on the Mill

From Ivan Godard <ivan@millcomputing.com>
Newsgroups comp.arch
Subject "volatile" on the Mill
Date 2016-01-31 17:10 -0800
Organization A noiseless patient Spider
Message-ID <n8mb5k$27c$1@dont-email.me> (permalink)

Show all headers | View raw


Several people here have expressed interest in informal information 
about the Mill. Currently there is much posting (and consternation) 
about the related subjects of memory ordering, volatile, and compiler 
optimization. Here is the Present Most Recent Final Word about such 
issues on the Mill. Subject to change without notice.

The Mill is hardware. While we are retargeting the clang/llvm compiler 
to the Mill, and no doubt will retarget GCC and others in time, we have 
no control over what the compiler does with your program before our code 
generator gets it, and even less control over what the languages define 
or don't define. This note describes our intentions in the hardware and 
code generator, only portions of which are as yet implemented. It is not 
canon.

Mill hardware is inherently sequentially consistent. That is a technical 
term and does not mean that it imposes a global ordering; see 
https://en.wikipedia.org/wiki/Sequential_consistency. Sequential 
consistency is a stronger model than that offered by other commercial 
CPUs. Active agents (in practice cores) see memory changes they and 
other agents make in each mutator's program order, arbitrarily interleaved.

The Mill does not have memory-op, op-memory, read-modify-write, membar, 
or bus-locking operations (or busses to lock). It uses cache-based 
optimistic concurrency control.

There are some caveats to this, which are defined in our (incomplete, 
not published) ABI:

"volatile" is an attribute attached to particular memory-reference 
actions in the intermediate representation (genAsm) provided by the 
compiler to the code generator. It then becomes a flag bit attached to 
memory reference operations in the member-specific binary encoding 
(conAsm). The flag is in turn attached to requests created by the 
load/store functional units and passed down the hierarchy. A "volatile 
access" is such a request with the volatile bit set.

A volatile access that crosses a cache line boundary will fault. 
Naturally-aligned access never crosses a line boundary.

A volatile access to an object larger than the largest supported on a 
target Mill member will receive a code-generator diagnostic, for example 
a volatile access to a quad (16 byte) object on a target that does not 
support native quad.

A volatile access using a deferred load (of either kind) is generally 
uncodeable and will receive a code-generator diagnostic, but if codeable 
on a particular member will fault.

A volatile access that is part of the participant set of an 
optimistic-atomic group (sometimes called a transaction) is generally 
uncodeable and will receive a code-generator diagnostic, but if codeable 
on a particular member will fault.

A volatile access that is a within an optimistic-atomic group but is not 
a participant will execute as a normal volatile access on each retry.

Volatile accesses are not reordered by the code generator, which honors 
the compiler-supplied ordering. They may be arbitrarily reordered with 
respect to other operations, consistent with the dataflow and control 
flow of the program.

Volatile accesses are not speculated, and will not be executed unless 
actual program control flow requires.

Volatile accesses may issue across a misprediction, but without 
hardware-visible side effects until the prediction is verified.

A volatile access to a virtual address within the target-member-defined 
MMIO space behaves the same as a non-volatile access, namely a store is 
not cached and a load does not check for a cached value. Individual 
entities within MMIO space may constrain the access beyond the usual 
alignment restrictions.

A volatile access is cacheable normally unless the access is marked 
uncacheable or is to MMIO space. Both cacheable and uncacheable volatile 
accesses act identically to the corresponding non-volatile access, i.e. 
an uncacheable store updates cache normally followed by a succession of 
evicts to memory, thereby removing the line from all caches, while an 
uncacheable load invalidates the requested bytes at each cache level 
followed by satisfaction from memory and normal caching.

Volatile accesses to different virtual addresses that alias by page 
mapping are ordered as if they used the same virtual address.

A volatile load of backless memory that is not satisfied in cache 
receives a zero normally.

The effect of these rules is that a Mill volatile access is guaranteed 
to comprise a single atomic action that is executed in program order and 
iff required by actual program control flow. Volatile is not required to 
safely access devices (determined by an address in the MMIO region), nor 
does it alone guarantee that external memory is actually accessed 
(determined by the "uncached" flag).

Back to comp.arch | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

"volatile" on the Mill Ivan Godard <ivan@millcomputing.com> - 2016-01-31 17:10 -0800
  Re: "volatile" on the Mill nmm@wheeler.UUCP (Nick Maclaren) - 2016-02-01 07:48 +0000
    Re: "volatile" on the Mill William Edwards <willvarfar@gmail.com> - 2016-01-31 23:53 -0800
      Re: "volatile" on the Mill nmm@wheeler.UUCP (Nick Maclaren) - 2016-02-01 08:47 +0000
  Re: "volatile" on the Mill "Paul A. Clayton" <paaronclayton@gmail.com> - 2016-02-01 20:34 -0800
    Re: "volatile" on the Mill already5chosen@yahoo.com - 2016-02-02 01:36 -0800
      Re: "volatile" on the Mill Ivan Godard <ivan@millcomputing.com> - 2016-02-02 04:19 -0800
        Re: "volatile" on the Mill nmm@wheeler.UUCP (Nick Maclaren) - 2016-02-02 12:55 +0000
        Re: "volatile" on the Mill already5chosen@yahoo.com - 2016-02-02 05:16 -0800
          Re: "volatile" on the Mill "Chris M. Thomasson" <nospam@nospam.nospam> - 2016-02-03 11:55 -0800
            Re: "volatile" on the Mill "Chris M. Thomasson" <nospam@nospam.nospam> - 2016-02-08 11:10 -0800
            Re: "volatile" on the Mill gpderetta <gpderetta@gmail.com> - 2016-02-15 02:27 -0800
              Re: "volatile" on the Mill "Chris M. Thomasson" <nospam@nospam.nospam> - 2016-02-21 14:05 -0800
                Re: "volatile" on the Mill gpderetta <gpderetta@gmail.com> - 2016-02-29 07:37 -0800
                Re: "volatile" on the Mill "Chris M. Thomasson" <nospam@nospam.nospam> - 2016-03-07 15:24 -0800
          Re: "volatile" on the Mill "Chris M. Thomasson" <nospam@nospam.nospam> - 2016-02-03 12:30 -0800
        Re: "volatile" on the Mill Quadibloc <jsavard@ecn.ab.ca> - 2016-02-02 11:16 -0800
          Re: "volatile" on the Mill Quadibloc <jsavard@ecn.ab.ca> - 2016-02-02 11:18 -0800
            Re: "volatile" on the Mill already5chosen@yahoo.com - 2016-02-02 11:30 -0800
        Re: "volatile" on the Mill "Paul A. Clayton" <paaronclayton@gmail.com> - 2016-02-02 11:37 -0800
          Re: "volatile" on the Mill Ivan Godard <ivan@millcomputing.com> - 2016-02-02 15:22 -0800
            Re: "volatile" on the Mill MitchAlsup <MitchAlsup@aol.com> - 2016-02-02 16:54 -0800
              Re: "volatile" on the Mill anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-02-03 10:53 +0000
                Re: "volatile" on the Mill Quadibloc <jsavard@ecn.ab.ca> - 2016-02-03 07:19 -0800
                Re: "volatile" on the Mill Quadibloc <jsavard@ecn.ab.ca> - 2016-02-03 07:49 -0800
                Re: "volatile" on the Mill anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-02-03 16:17 +0000
                Re: "volatile" on the Mill Quadibloc <jsavard@ecn.ab.ca> - 2016-02-03 12:41 -0800
                Re: "volatile" on the Mill anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-02-04 17:03 +0000
                Re: "volatile" on the Mill Quadibloc <jsavard@ecn.ab.ca> - 2016-02-03 12:47 -0800
                Re: "volatile" on the Mill anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-02-04 17:20 +0000
            Re: "volatile" on the Mill nmm@wheeler.UUCP (Nick Maclaren) - 2016-02-03 09:59 +0000
              Re: "volatile" on the Mill Ivan Godard <ivan@millcomputing.com> - 2016-02-03 02:34 -0800
                Re: "volatile" on the Mill nmm@wheeler.UUCP (Nick Maclaren) - 2016-02-03 11:01 +0000
                Re: "volatile" on the Mill gpderetta <gpderetta@gmail.com> - 2016-02-15 02:18 -0800
                Re: "volatile" on the Mill nmm@wheeler.UUCP (Nick Maclaren) - 2016-02-15 11:41 +0000

csiph-web