svstep

Links

svstep performs explicit stepping of the Vector for-loop, and it can also be used to enquire about the current state of the REMAP indices and SVSTATE.

Format

(Allocation of opcode TBD pending OPF ISA WG approval), using EXT22 temporarily and fitting into the bitmanip space

Form: SVL-Form (see fields.text)

0.5 6.10 11.15 16..22 23...25 26.30 31 name
OPCD RT / SVi / / vf 11011 Rc svstep

Instruction format:

svstep RT,SVi,vf  (Rc=0)
svstep. RT,SVi,vf (Rc=1)

Description

svstep may be used to enquire about the REMAP Schedule. When vf=1 then stepping occurs. When vf=0 the enquiry is performed without altering internal state. If SVi=0, Rc=0, vf=0 this instruction is a nop. The following modes are identical to those in setvl, returning identical results:

  • When SVi is 1-4 the REMAP Schedule for a given SVSHAPE may be returned in RT. SVi=1 selects SVSHAPE0 current state, through to SVi=4 selects SVSHAPE3.
  • When SVi is 5, SVSTATE.srcstep is returned.
  • When SVi is 6, SVSTATE.dststep is returned.
  • When SVi is 0b1100 pack/unpack in SVSTATE is cleared
  • When SVi is 0b1101 pack in SVSTATE is set, unpack is cleared
  • When SVi is 0b1110 unpack in SVSTATE is set, pack is cleared
  • When SVi is 0b1111 pack/unpack in SVSTATE are set

As this is a Single-Predicated (1P) instruction, predication may be applied to skip (or zero) elements.

  • Vertical-First Mode will return the requested index (and move to the next state if vf=1)
  • Horizontal-First Mode can be used to return all indices, i.e. walks through all possible states.

To obtain the full set of possible computed element indices use svstep RT.v,SVI,1 which will store all computed element indices, starting from RT. If Rc=1 then a co-result Vector of CR Fields will also be returned, comprising the "loop end-points" of each of the inner loops when either Matrix Mode or DCT/FFT is set. In other words, for example, when the xdim inner loop reaches the end and on the next iteration it will begin again at zero, the CR Field EQ will be set. With a maximum of three loops within both Matrix and DCT/FFT Modes, the CR Field's EQ bit will be set at the end of the first inner loop, the LE bit for the second, the GT bit for the outermost loop and the SO bit set on the very last element, when all loops reach their maximum extent.

Programmer's note (1): VL in some situations, particularly larger Matrices, may exceed 64, meaning that sv.svshape returning a considerable number of values. Under such circumstances sv.svshape/ew=8 is recommended.

Programmer's note (2): having conveniently obtained a pre-computed Schedule with sv.svstep, it may then be used as the input to Indexed REMAP Mode to achieve the exact same Schedule. It is evident however that before use some of the Indices may be arbitrarily altered as desired. sv.svstep helps the programmer avoid having to manually recreate Indices for certain types of common Loop patterns, and in its simplest form, without REMAP (SVi=5 or SVi=6), is equivalent to the iota instruction found in other Vector ISAs