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.
Name |
Directive |
Description |
|---|---|---|
Register |
|
Private for a work-item |
Private |
|
Private memory for a work-item |
Shared |
|
Shared memory for work-items in a work-group |
Global |
|
Global memory, accessible by all work-items |
Constant |
|
Constant memory, initialized and read-only memory |
Parameter |
|
Exclusively used for kernel argument passing |
PISA specifies the size of each memory address space for addressing purposes.
Address Space |
Address Size |
Null Pointer Value |
|---|---|---|
Private ( |
32-bit |
0xFFFFFFFF (-1) |
Shared ( |
32-bit |
0xFFFFFFFF (-1) |
Global ( |
64-bit |
0 |
Constant ( |
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.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#
Qualifier |
Bitwidth |
|---|---|
|
8 |
|
16 |
|
32 |
|
64 |
|
128 |
Qualifier |
Bitwidth |
|---|---|
|
16 |
|
16 |
|
32 |
|
64 |
Conversion instructions, such as i2f and f2i, also support signed and unsigned versions of scalar integer types.
Unsigned Qualifier |
Signed Qualifier |
Bitwidth |
|---|---|---|
|
|
8 |
|
|
16 |
|
|
32 |
|
|
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.
Qualifier |
Bitwidth |
Element |
Count |
|---|---|---|---|
|
32 |
|
4 |
|
32 |
|
2 |
|
32 |
|
2 |
|
32 |
|
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).
Bitwidth |
Element Count |
|---|---|
|
2, 3, 4 |
|
2, 3, 4 |
|
2, 3, 4, 5, 6, 7, 8, 16, 32, 64 |
|
2, 3, 4 |