2

I'll start by saying this is not something I am doing in a production system, just a personal project and just writing coding to learn and try and find challenging tasks.

So NVMe drives are used in computers for storing information and they have controllers and perform a set of standard operations and I have been reading through the specification (https://nvmexpress.org/developers/) trying to figure out if there is any way to use them in a way that would actually be getting them to compute information. I have been reading through the specifications, and there are a lot of different commands they can do. But I haven't found anything where someone has already tried this yet, but maybe I'm just using the wrong search terms. I wanted to check if anyone knows if this is something that has been done, using NVMe storage as a compute device?

Some of the things I thought I might be able to find where?

  • Maybe a write option equivalent to a logical OR where it would write 1s over 0s but not change other values?
  • Maybe a way to compare values as they were overwritten, so if there was a status code that was tracking wear levelling or if the data actually changed on a write, then it might have been possible to know if the value written to was already set to the value I just wrote?
  • Maybe a check if data is blank or all zeros command?
  • Maybe a command to return the hash or parity bit for the data instead of the data?
  • I was hoping to find some combination or Move or BitShift or Logical operators that be chained together to do calculations on data without returning it.
  • Or possibly a status code on an operation that would give me information about the data.
user802599
  • 787
  • 2
  • 12
  • 35
  • IIRC, physical NAND flash reads as `1` in the erased state, and can be written to `0`. But inversion is basically free in hardware if it's hard-wired in so a drive could in theory support either of setting more bits or clearing more bits for already-written sectors without an erase. (I think.) In practice I'd guess that NVMe doesn't have a command for that. – Peter Cordes Oct 03 '21 at 04:07
  • Interesting ideas about what *could* be possible. Copying within the drive without sending data over the PCIe bus might get used, but I doubt there'd be much real-world use for shift or bitwise booleans; XOR en/decryption doesn't get much use. You could imagine a command that lets you upload blocks to be used for XOR-and-copy do decrypting with a stream cipher (like RC5) only requires CPU->device transfers of the stream data, not read/CPU xor/write. But stream ciphers are *not* widely used. Now if there was a built-in AES that would be another matter. But most use cases aren't disk->disk – Peter Cordes Oct 03 '21 at 04:10
  • So the compute command ideas seem unlikely to find much use, but checking for all zero, or for some hash of the data, might get use to save PCIe and main-memory bandwidth. (In some hypothetical command set that had this, assuming NVMe doesn't.) – Peter Cordes Oct 03 '21 at 04:12
  • I wouldn't be impressed if it is impossible. Like other host-to-drive interfaces, NVMe is designed the way that host "thinks" how to parallel data, etc, and the drive is "dumb". – Alex Guteniev Oct 04 '21 at 15:38
  • 1
    Did some more research, at the moment I think the answer is NO. But there is a draft standard for "Computational Storage" and a Technical Working Group for it (https://www.snia.org/computational). So maybe in a few years. – user802599 Oct 05 '21 at 00:47
  • I said earlier that NAND flash could in theory allow setting or clearing more bits without erasing. But it's only that simple for SLC flash that store 1 bit per cell. MLC / TLC / QLC that encode 4, 8, or 16 different levels in a single cell, not just on/off, map multiple logical bits to the same physical cell, and even if they could move from one level to a higher level (not sure), that wouldn't always correlate with setting some previously unset bits. Plus there's probably some error-correction coding per write-block that makes it not that simple even for SLC. – Peter Cordes Oct 09 '21 at 01:21

0 Answers0