You are on page 1of 21

..............................................................................................................................................

2
............................................................................. 3
............................................................................................................... 3
.......................................................................................................................... 4
.......................................................................................................... 5
GPU ............................................................................................... 7
.................................................................................................... 9
Microsoft Accelerator .................................................................................................................... 10
GPU ........................................................................... 10
................................................................................................................ 15
Brook GPU ..................................................................................................................................... 15
.................................................................................................... 16
................................................................................................................ 18
, GPU ........................................................................................ 19
........................................................................................................................................ 20
.......................................................................................................................... 21



,
.
,
, ,
, ,
.
GPU
.
- : Microsoft
HLSL, NVidia Cg, OpenGL GLslang,
.
, , ,
, .

API,
,
, GPU. GPU
.



.
,
. .
,
, .
GPU
(data-parallel array processing [1])

. 1.
GPU,
. ,
GPU, [2]. (vertex processors)
,
.
,
1 (vertex shaders).
2.
,
(pixel shaders) .
, , NVidia GeForce 6800 (
2004), 6 16 .
4- ,
16 32- .

1

- : ,
; (
)
2
- .

. ,
.

. 1



:
1. ,
.
4

2. ,

3.
4. :
a.
;
b.
;
c.
;
d.
;
e.
.


. , ,

, ,

.
,
.
.

GPU
API DirectX OpenGL,
API .
5

DirectX OpenGL
, ,
- .
, .
.
,

. SIMD3 .
, ,
DirectX Pixel Shaders 2. 12
; 8 ,
; 32
, ; 16 sampler
. Sampler
.

32 , 64 .
,
.
1.
2.
3.
4.
5.

ps_2_0
dcl_2d s0
dcl t0.xy
texld r0, t0, s0
mov oC0, r0


. , sampler

, 2 .

.
3

Single Instruction Multiple Data - ,


.
SIMD-,
( ).
, ,
. (M. Flynn) 1972


sampler-

.

. , 4 DirectX
32-
;

.
[2].
GPU
.

. , GPU,

. 918 , .
GPU
.
, CPU

. , CPU,
,
.
-
.

GPU
.
SIMD.
SIMD , . GPU
SPMD4 .
.
,
,
API, DirectX OpenGL.
.
,
.

,
. , NVIDIA GeForce GTX
590 32 64- ,
IEEE 754-20085.
[3] [4].

SPMD " - [] "; SPMD ()


MIMD, .
5
IEEE 754-2008 32 64
, ,
(CPU FPU) .


(general-purpose using)
GPU .
: (API)
.
GPU.
GPU
(streaming coprocessor) CPU.
Brook GPU [5]. Brook
. ,
GPU, (kernels),

. , ,
,

. , , ,
(side-effects).
,
, ,
. Brook
Cg ++
.
,
. , Cg
.

, GPU. Microsoft
Accelerator
Microsoft Research [1]. Accelerator Brook ,
9

GPU.
,
GPU. Accelerator
.
(just-in-time compilation),
Brook . JIT-
: GPU

.
Microsoft Accelerator

.
Accelerator .
- ,
.
. Accelerator
: float, int, bool float4 (
4 float).
6 ,
: ;
; (:
, , ); ;
; .
GPU

GPU.

10


GPU 2
.

.
, ,
.
Accelerator , . .
.
, GPU.
,
. , ,

,
,
.

. ,
/ .
:
[]

)]

, ,

,
.

)]

, ,

.

11

,
,

.
(call-by-need).
.

.
,
, .
, , .

. ,
.

.
- .

.
[]

[]

[ ]).

.
ps_2_0
dcl_2d s0
// B_1
dcl_2d s1
// B_2
dcl t0.xy
// j
texld r0, t0, s0 // r0 <- B_1[j]
texld r1, t0, s1 // r1 <- B_2[j]
add r1, r0, r1
// r1 <- B_1[j] + B_2[j]
mov oC0, r1 // output r1


.
-,

12

.
.
, .
CPU GPU.
,
.
, . 2

. 2

7 7
GPU.
GPU.
. ,
,
, .

, ,
13

, ,
.
Accelerator
break-. ,
.

( ).

.
,
.
[]

[]

[ ])

[]

[]

[ ])


[]

[] []

[ ])

break-
,
.
. 3,
.

14

. 3

,
,
, Microsoft Accelerator,
[1], [6] [7].


.
[1].
Brook GPU
Brook
.
. Brook
GPU CPU
,
.

15


Brook
.
(streams), Brook

, .
.
.
GPU Brook
.
GPU. Brook GPU
ATI NVidia, OpenGL DirectX,
CPU.

GPU, Brook :
,

.
, GPU,
,
.
.
(Streams)
,
. ,

, , float s<10, 5>

. ,
16

streamRead
streamWrite, .

, ,

. , ,
(ray)
typedef struct ray_t {
float3 o;
float3 d;
float tmax;
} Ray;
Ray r<100>;

,
Brook API.
(Kernels)
,

. :
kernel void saxpy (float a, float4 x<>, float4 y<>,
out float4 result<>) {
result = a * x + y;
}
void main (void) {
float a;
float4 X[100], Y[100], Result[100];
float4 x<100>, y<100>, result<100>;
//... a, X, Y
streamRead(x, X); //
streamRead(y, Y);
saxpy(a, x, y, result); //
streamWrite(result, Result); //
}

:
, .

17

. Brook

.
.
Brook
.
,
.
, .
, .

Brook CPU
[5].

18

, GPU
GPU,
.

.
[8] ,
.

,

,
GPU.
,
, GPU
.
GPGPU
.

.
MATLAB.

19



,
,
[9].
GPU ,
,
.
GPU
.
,
. GPU , -
,
, -,

, -, GPU
, . , GPU
, ,
.

20


[1] Sidd Puri, and Jose Oglesby David Tarditi, "Accelerator: Using Data Parallelism to Program
GPUs for General-Purpose Uses," Microsoft Research, MSR-TR-2005-184, October 2006.
[Online]. http://research.microsoft.com/apps/pubs/default.aspx?id=70250
[2] David Blythe, "The Direct3D 10 System".
[3] AMD. (2011, June) AMD Web Site. [Online].
http://www.amd.com/uk/products/desktop/graphics/amd-radeon-hd-6000/hd6990/Pages/amd-radeon-hd-6990-overview.aspx#3
[4] NVidia. (2011, June) geforce. [Online]. http://www.geforce.com/#/Hardware/GPUs/geforcegtx-590/specifications
[5] Ian Buck et al., "Brook for GPUs: Stream Computing on Graphics Hardware," Stanford
University, 2004.
[6] Microsoft Research. (2010, June) An Introduction to Microsoft Accelerator v2.
[7] Microsoft Research. (2010, June) Microsoft Accelerator v2 Programming Guide.
[8] .. , .. , .. , .. , and ..
, " CUDA
," , , 2010.
[9] .. , ",
," ,
, 2008.

21

You might also like