2. Address Spaces and Data Types#

2.1. Address Spaces#

PISA variables reside in one of the address spaces below. Each address space has distinct access speed, visibility, and lifetime characteristics.

Address Spaces#

Name

Directive

Description

Register

.reg, .pred

Private for a work-item

Private

.private

Private memory for a work-item

Shared

.shared

Shared memory for work-items in a work-group

Global

.global

Global memory, accessible by all work-items

Constant

.const

Constant memory, initialized and read-only memory

Parameter

.param

Exclusively used for kernel argument passing

PISA specifies the size of each memory address space for addressing purposes.

Memory Address Spaces#

Address Space

Address Size

Null Pointer Value

Private (.private)

32-bit

0xFFFFFFFF (-1)

Shared (.shared)

32-bit

0xFFFFFFFF (-1)

Global (.global)

64-bit

0

Constant (.const)

64-bit

0

Note

An address of a variable in a memory address space can be obtained using the addrof instruction.

2.1.1. Register Space#

Register space provides private fast storage location for a work-item. Variables in this space are specified using .reg or .pred directives, and can be used directly in most instructions. Memory instructions allow transfer of data between register and other spaces.

2.1.2. Private Space#

Private space supports memory objects that are private to each work-item. Variables in this space are specified using .private directive, and can be accessed using private memory load and store instructions.

2.1.3. Shared Space#

Shared space supports memory objects that are shared among work-items within a work-group. Variables in this space are specified using .shared directive, and can be accessed using shared memory load, store, and atomic instructions. Shared variables have the same lifetime as a work-group; variables are uninitialized at creation, and their contents disappear when the work-group finishes execution.

All work-items in the same work-group may read and write to any variable in the shared space; they can also synchronize their accesses to the shared space through synchronization instructions, such as fence, which guarantees memory ordering by ensuring that all shared accesses prior to the instruction are observable by all other work-items within the same work-group.

Shared memory can also be dynamically allocated by the host. In this case, the host program provides a pointer to the allocated shared object as a kernel argument:

2.1.4. Global Space#

Global space supports memory objects that are shared among work-items in different work-groups. Variables in this space are specified using .global directive, and can be accessed using global load, store, and atomic instructions.

2.1.5. Constant Space#

Constant space supports read-only memory objects that can be accessed by every work-item. Variables in this space are specified using .const directive, and can be accessed using constant load instructions. Constant variables are guaranteed to be initialized before they are first accessed.

Warning

Storing data to a .const address space results in undefined behavior.

2.1.6. Parameter Space#

Parameter space is used exclusively for kernel arguments. Variables in this space are specified using .param directive, and can be accessed using ld.param instruction.

2.2. Data Types#

PISA virtual machine supports scalar, vector, and packed data types.

2.2.1. Scalar Types#

Scalar Integer Types#

Qualifier

Bitwidth

.8b

8

.16b

16

.32b

32

.64b

64

.128b

128

Scalar Floating Point Types#

Qualifier

Bitwidth

.hf

16

.bf

16

.f

32

.df

64

Conversion instructions, such as i2f and f2i, also support signed and unsigned versions of scalar integer types.

Scalar Integer Types (Conversion)#

Unsigned Qualifier

Signed Qualifier

Bitwidth

.u8

.s8

8

.u16

.s16

16

.u32

.s32

32

.u64

.s64

64

2.2.2. Packed Types#

A packed type is a vector of multiple scalar values of the same bitwidth. An instruction using a packed type operand will perform the operation independently on each element of the vector.

Packed Data Types#

Qualifier

Bitwidth

Element

Count

.8bx4

32

.8b

4

.16bx2

32

.16b

2

.hfx2

32

.hf

2

.bfx2

32

.bf

2

Important

Packed type operands must be register operands; immediate values are not allowed.

Note

Packed type operands (.bfx2, .hfx2, .16bx2, .8bx4) must be declared as vector registers of matching element count and size: .v2.16b for 2-element types and .v4.8b for 4-element types. The packed type qualifier on the instruction determines how the bits are interpreted; the register declaration determines storage layout.

Note

.hfx2 and .bfx2 are floating-point packed types: their elements carry floating-point semantics including rounding modes, NaN propagation, and saturation. They are distinct from the integer packed types .16bx2 and .8bx4 and must not be used interchangeably.

2.2.3. Vector Types#

Vector types are supported in limited form by memory access and data movement instructions. As these instructions do not interpret underlying data, vectors can represent both integer and floating-point values.

A vector type is specified as .vN.B, where N is the number of elements and B is the element bitwidth (e.g., .v4.32b for a 4-element vector of 32-bit integer or single-precision floating-point values).

Vector Data Types#

Bitwidth

Element Count

.8b

2, 3, 4

.16b

2, 3, 4

.32b

2, 3, 4, 5, 6, 7, 8, 16, 32, 64

.64b

2, 3, 4