
























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

























1
2
Kernel programming interface
Runtime implementation
Transparent to application programmer Supports multiple runtimes
Runtime API
Simple and small API for basic operations Provides only high-level control over stream data
4
Kernel Programming Interface
Runtime provided by associated runtime library (DirectX)
Front-end compiler provided by Microsoft (
fxc
Back-end code generation and optimization done by GPUvendors
Generate HLSL for Brook kernels
Invoke DirectX runtime calls for stream management andkernel invocation, etc
5
Exposes the GPU architecture completely
Provides insight into GPU architecture and expectedperformance
Very useful for performance profiling
Useful for debugging programs
7
8
Registers do not have specific types
Can be used to store 32-bit integers, floats, and 64-bitdouble precision values
Types are defined by the instructions, e.g. IMUL
and
correspond to multiplication of signed integers, unsigned integers, floats and doublesrespectively
10
Items within
<>
are replaced by specific words or phrases. For
example,
could be replaced by
mov
.
When more than one item of the same type exists, for example
a zero-based number is appended to the item name. For
example, for 2-input instructions the sources (inputs) would belabeled
src
and
src
.
Items within square brackets,
[]
, are optional.
Items within braces,
{}
, represent a choice-grouping. For example,
{x|y|z|w}
means to choose
x
,
y
,
z
or
w
.
An ellipsis,
...
, represents a list of alternatives having the same
format as the first alternative in the list.
11
div_zeroop(op) dst, src0, src1 dst = src0 / src1 zeroop()
decides value of output if divisor is zero, e.g.
fltmax, zero, infinity, inf_else_max
RCP
rcp_zeroop(op) dst, src0 dst = 1/src0.w
SQRT
sqrt dst, src0 dst = sqrt(src0.w)
13
14
Register
Description
Need to declare
Example
r#
Temporary
No
mad r0, r0, r0, r
cb#[#]
Const buffer
Yes
mov o0, cb0[0]
v
Position
Yes
mul o0, v0.xyxx, cb0[0]
o#
Output
Yes
mov o0, v0.xyxx
Both the sample operator and output register are type-less –
The data format and sampling mode needs to be specified in thekernel for each sampler
e.g. dcl_resource_id(0)_type(2d,unnorm)_fmtx(float)_fmty(float)_fmt
z(float)_fmtw(float) Type of resource (1d vs 2d) specified Type of address (normalized vs unnormalized) specified –
Normalized uses coordinates in [0..1] range
Unnormalized uses coordinates in [0..n-1] range
16
2D Resource
Unnormalized
Float
17
Destination Modifier
Source Modifier
Write Mask
Swizzle Mask
19
Letter (
x
y
z
w
) => element to be written
Underscore (
) => element
not
to be written
Zero (
) or One (
) => element forced to zero or one
Omitting => underscore
E.g.
mov r0.x_zw, r1 mov r0.x_01, r
20