ISARef Multi-ISA & Silicon Reference
45,419 ISA items · 105,907 timings · 1,823 microarchs · 16,083 chips · 105 sources
Arch:
Tier:

vISA 3D_SAMPLE

T1 intel-gpu simd insn
Intel GPU vISA Instruction: 3D_SAMPLE
SourceIntel Graphics Compiler Official Virtual ISA (vISA) Specification (intel_gpu_visa)
Reliability TierT1 — Official Specification
ISA / Silicon ScopeIntel Gen8–Xe2 vISA
Intel Gen9–Gen12 / Xe-LP / Xe-HPG / Xe-HPC / Xe2
License & VersionMIT
master
Upstreamhttps://github.com/intel/intel-graphics-compiler/tree/master/documentation/visa
Privilegeuser
ExtensionsBDW, SKL, BXT, ICLLP, TGLLP

Summary

Intel GPU vISA 3D_SAMPLE instruction.

Syntax / Encoding

{-PVC}For pre-PVC platforms:

Binary Encodings (1)

WidthFormatBit PatternMask / Match
Intel-vISA /

Operands

NameDescription
Exec_sizeExecution size
PredPredication control
AoffimmiA UW representing the _aoffimmi modifier with the following format:. Must have type UW
SamplerIndex of the sampler variable
SurfaceIndex of the surface variable
DstThe result of the sample. Must have type HF,F,W,UW,D,UD
NumParamsnumber of additional parameters for this instruction. Valid values are [1-15]
RefThe first <exec_size> elements contain the reference value that is compared against the red channel of the sampled surface
BiasThe first <exec_size> elements contain the LOD bias, with range of [-16.0, 16.0]
BiasOffUVRThe first <exec_size> elements contain the LOD bias combined with U, V, and R offsets
LodThe first <exec_size> elements contain the LOD
LodOffUVRThe first <exec_size> elements contain the LOD parameter combined with U, V, and R offsets
LodOffUVThe first <exec_size> elements contain the LOD parameter combined with U and V offsets
UThe first <exec_size> elements contain the normalized x coordinates
DudxThe first <exec_size> elements contain the gradients of the u coordinate
DudyThe first <exec_size> elements contain the gradients of the u coordinate
VThe first <exec_size> elements contain for
DvdxThe first <exec_size> elements contain the gradients of the v coordinate
DvdyThe first <exec_size> elements contain the gradients of the v coordinate
RThe first <exec_size> elements contain for
OffUVRProgrammable U, V, and R offsets combined into one parameter
OffUVR_RProgrammable U, V, and R offsets along with R index combined into one parameter
OffUV_RProgrammable U, and V offsets combined into one parameter
DrdxThe first <exec_size> elements contain the gradients of the r coordinate

Reference Notes

## Opcode

  3D_SAMPLE = 0x6d

## Format


### CONDITION

- Op.op=LOD, sample, sample_lz


| | | | | | | |
| --- | --- | --- | --- | --- | --- | --- |
| 0x6d(3D_SAMPLE) | Op            | Exec_size | Pred      | Channels | Aoffimmi | Sampler |
|                 | Surface       | Dst       | NumParams | U        | V        | R       |
|                 | Ai            |           |           |          |          |         |


### CONDITION

- Op.op=sample_b


| | | | | | | |
| --- | --- | --- | --- | --- | --- | --- |
| 0x6d(3D_SAMPLE) | Op           | Exec_size | Pred      | Channels | Aoffimmi | Sampler |
|                 | Surface      | Dst       | NumParams | Bias\*   | U        | V       |
|                 | R            | Ai        |           |          |          |         |


### CONDITION

- Op.op=sample_b_c


| | | | | | | |
| --- | --- | --- | --- | --- | --- | --- |
| 0x6d(3D_SAMPLE) | Op             | Exec_size | Pred      | Channels | Aoffimmi | Sampler |
|                 | Surface        | Dst       | NumParams | Ref\*    | Bias\*   | U       |
|                 | V              | R         | Ai        |          |          |         |


### CONDITION

- Op.op=sample_c, sample_c_lz


| | | | | | | |
| --- | --- | --- | --- | --- | --- | --- |
| 0x6d(3D_SAMPLE) | Op              | Exec_size | Pred      | Channels | Aoffimmi | Sampler |
|                 | Surface         | Dst       | NumParams | Ref\*    | U        | V       |
|                 | R               | Ai        |           |          |          |         |


### CONDITION

- Op.op=sample_d


| | | | | | | |
| --- | --- | --- | --- | --- | --- | --- |
| 0x6d(3D_SAMPLE) | Op           | Exec_size | Pred      | Channels | Aoffimmi | Sampler |
|                 | Surface      | Dst       | NumParams | U        | Dudx\*   | Dudy\*  |
|                 | V            | Dvdx\*    | Dvdy\*    | R        | Drdx\*   | Drdy\*  |
|                 | Ai           |           |           |          |          |         |


### CONDITION

- Op.op=sample_d_c


| | | | | | | |
| --- | --- | --- | --- | --- | --- | --- |
| 0x6d(3D_SAMPLE) | Op             | Exec_size | Pred      | Channels | Aoffimmi | Sampler |
|                 | Surface        | Dst       | NumParams | Ref\*    | U        | Dudx\*  |
|                 | Dudy\*         | V         | Dvdx\*    | Dvdy\*   | R        | Drdx\*  |
|                 | Drdy\*         | Ai        |           |          |          |         |


### CONDITION

- Op.op=sample_l


| | | | | | | |
| --- | --- | --- | --- | --- | --- | --- |
| 0x6d(3D_SAMPLE) | Op           | Exec_size | Pred      | Channels | Aoffimmi | Sampler |
|                 | Surface      | Dst       | NumParams | Lod\*    | U        | V       |
|                 | R            | Ai        |           |          |          |         |


### CONDITION

- Op.op=sample_l_c


| | | | | | | |
| --- | --- | --- | --- | --- | --- | --- |
| 0x6d(3D_SAMPLE) | Op             | Exec_size | Pred      | Channels | Aoffimmi | Sampler |
|                 | Surface        | Dst       | NumParams | Ref\*    | Lod\*    | U       |
|                 | V              | R         | Ai        |          |          |         |


### CONDITION

- Op.op=sample_po


| | | | | | | |
| --- | --- | --- | --- | --- | --- | --- |
| 0x6d(3D_SAMPLE) | Op            | Exec_size | Pred      | Channels | Aoffimmi | Sampler |
|                 | Surface       | Dst       | NumParams | U        | V        | R       |
|                 | OffUVR\*      | Ai        |           |          |          |         |


### CONDITION

- Op.op=sample_po_b


| | | | | | | |
| --- | --- | --- | --- | --- | --- | --- |
| 0x6d(3D_SAMPLE) | Op              | Exec_size | Pred      | Channels   | Aoffimmi | Sampler |
|                 | Surface         | Dst       | NumParams | BiasOffUVR\* | U        | V       |
|                 | R               | Ai        |           |            |          |         |


### CONDITION

- Op.op=sample_po_c


| | | | | | | |
| --- | --- | --- | --- | --- | --- | --- |
| 0x6d(3D_SAMPLE) | Op              | Exec_size | Pred      | Channels | Aoffimmi | Sampler |
|                 | Surface         | Dst       | NumParams | Ref\*    | U        | V       |
|                 | R               | OffUV_R\* | Ai        |          |          |         |


### CONDITION

- Op.op=sample_po_d


| | | | | | | |
| --- | --- | --- | --- | --- | --- | --- |
| 0x6d(3D_SAMPLE) | Op              | Exec_size | Pred      | Channels | Aoffimmi | Sampler |
|                 | Surface         | Dst       | NumParams | U        | Dudx\*   | Dudy\*  |
|                 | V               | Dvdx\*    | Dvdy\*    | R        | OffUVR_R\* | Drdx\*  |
|                 | Drdy\*          | Ai        |           |          |          |         |


### CONDITION

- Op.op=sample_po_l


| | | | | | | |
| --- | --- | --- | --- | --- | --- | --- |
| 0x6d(3D_SAMPLE) | Op              | Exec_size | Pred      | Channels  | Aoffimmi | Sampler |
|                 | Surface         | Dst       | NumParams | LodOffUVR\* | U        | V       |
|                 | R               | Ai        |           |           |          |         |


### CONDITION

- Op.op=sample_po_l_c


| | | | | | | |
| --- | --- | --- | --- | --- | --- | --- |
| 0x6d(3D_SAMPLE) | Op                | Exec_size | Pred      | Channels | Aoffimmi | Sampler |
|                 | Surface           | Dst       | NumParams | Ref\*    | LodOffUV\* | U       |
|                 | V                 | R         | Ai        |          |          |         |


## Semantics


```

      Sample a surface
```

## Description





```
    Samples <surface> using the indicated sampler state <sampler>. LOD, bias, ref, and gradients are computed differently based on the sampler operation. Up to 4 channels of data is returned for each pixel in <dst>.
```


- **Op(uw):**

  - Bit[7..0]: encodes the sampler operation

    - 0b00000000:  sample
    - 0b00000001:  sample_b
    - 0b00000010:  sample_l
    - 0b00000011:  sample_c
    - 0b00000100:  sample_d
    - 0b00000101:  sample_b_c
    - 0b00000110:  sample_l_c
    - 0b00001001:  LOD
    - 0b00010100:  sample_d_c
    - 0b00011000:  sample_lz
    - 0b00011001:  sample_c_lz
    - 0b00100000:  sample_po
    - 0b00100001:  sample_po_b
    - 0b00100010:  sample_po_l
    - 0b00100011:  sample_po_c
    - 0b00100100:  sample_po_d
    - 0b00100110:  sample_po_l_c
  - Bit[8]: pixel null mask enable. Specifies whether the writeback message will include an extra phase indicating the pixel null mask.

  - {ICLLP+}Bit[9]: CPS LOD compensation enable. Only available for sample, sample_b, sample_bc, sample_c, and LOD.

  - Bit[10]: non-uniform sampler state. true if the sampler field may be different for each thread


- **Exec_size(ub):** Execution size

  - Bit[2..0]: size of the region for source and destination operands

    - 0b011:  8 elements
    - 0b100:  16 elements
    - 0b101:  32 elements
  - Bit[7..4]: execution mask (explicit control over the enabled channels)

    - 0b0000:  M1
    - 0b0001:  M2
    - 0b0010:  M3
    - 0b0011:  M4
    - 0b0100:  M5
    - 0b0101:  M6
    - 0b0110:  M7
    - 0b0111:  M8
    - 0b1000:  M1_NM
    - 0b1001:  M2_NM
    - 0b1010:  M3_NM
    - 0b1011:  M4_NM
    - 0b1100:  M5_NM
    - 0b1101:  M6_NM
    - 0b1110:  M7_NM
    - 0b1111:  M8_NM

- **Pred(uw):** Predication control


- **Channels(ub):**

  - Bit[3..0]: determines the write masks for the RGBA channel, with R being bit 0 and A bit 3. At least one channel must be enabled (i.e., "0000" is not allowed)


- **Aoffimmi(scalar):**  A UW representing the _aoffimmi modifier with the following format:. Must have type UW

  - Bit[3..0]: stores the R offset. Valid values are [-8-7]

  - Bit[7..4]: stores the V offset. Valid values are [-8-7]

  - Bit[11..8]: stores the U offset. Valid values are [-8-7]

  - Bit[15..12]: reserved. Must be zero


- **Sampler(ub):*