changeset 21:acd79634dc4e

finish?
author admin@e055734.st.ie.u-ryukyu.ac.jp
date Fri, 27 Mar 2009 00:29:08 +0900
parents bbe9703e7133
children 363d231726bc
files paper/ARC183OS111-39.bbl paper/ARC183OS111-39.bib paper/ARC183OS111-39.tex paper/compare.tex paper/conclusion.tex paper/galium.tex
diffstat 6 files changed, 189 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/paper/ARC183OS111-39.bbl	Thu Mar 26 20:10:07 2009 +0900
+++ b/paper/ARC183OS111-39.bbl	Fri Mar 27 00:29:08 2009 +0900
@@ -11,6 +11,16 @@
 宮國渡 : Cell 用の Fine-Grain Task Managerの実装
  : 琉球大学理工学研究科情報工学専攻 平成20年度学位論文 (2009).
 
+\bibitem{gongo}
+神里晃 : Cell を用いたゲームフレームワークの実装
+ : 琉球大学理工学研究科情報工学専攻 平成19年度学位論文 (2009).
+
+\bibitem{galium}
+: Galium3D , \url{http://www.tungstengraphics.com/wiki/index.php/Gallium3D}
+
+\bibitem{osmesa}
+: The Mesa 3D Graphics Library , \url{http://www.mesa3d.org/}
+
 \bibitem{sdl}
 : {Simple DirectMedia Layer}, \url{http://www.libsdl.org/}.
 
--- a/paper/ARC183OS111-39.bib	Thu Mar 26 20:10:07 2009 +0900
+++ b/paper/ARC183OS111-39.bib	Fri Mar 27 00:29:08 2009 +0900
@@ -6,6 +6,26 @@
         year = 2009
 }
 
+@article{akira
+        author = "神里晃",
+        yomi = "KAMIZATO Akira",
+        title = "Cell を用いたゲームフレームワークの提案",
+        journal = "琉球大学理工学研究科情報工学専攻 平成19年度学位論文",
+        year = 2008
+}
+
+@misc{galium
+        author = "",
+        title = "Galium3D",
+        howpublished = "http://www.tungstengraphics.com/wiki/index.php/Gallium3D"
+}
+
+@misc{osmesa
+        author = "",
+        title = "The Mesa 3D Graphics Library",
+        howpubished = "http://www.mesa3d.org/"
+}
+
 @misc{sdl,
         author = "",
         title = "{Simple DirectMedia Layer}",
@@ -30,3 +50,4 @@
         title = "{Cell broadband engine architecture}",
         year = 2005
 }
+
--- a/paper/ARC183OS111-39.tex	Thu Mar 26 20:10:07 2009 +0900
+++ b/paper/ARC183OS111-39.tex	Fri Mar 27 00:29:08 2009 +0900
@@ -102,7 +102,7 @@
 \input{cerium}         % Cerium
 \input{rendering}      % 開発過程
 \input{compare}        % 評価と考察
-\input{comparison}     % 比較
+\input{galium}         % Galium
 \input{conclusion}     % まとめ
 
 %\nocite{kono}
--- a/paper/compare.tex	Thu Mar 26 20:10:07 2009 +0900
+++ b/paper/compare.tex	Fri Mar 27 00:29:08 2009 +0900
@@ -13,7 +13,7 @@
 その子になり回転しながら移動する。
 \end{itemize}
  \\
-\subsection{実行結果}
+\subsubsection{実行結果}
 
 \begin{table}[!h]
   \begin{center}
@@ -37,7 +37,7 @@
 \item Mac OSX は SDL\cite{sdl} 経由で出力、PlayStation 3 は Frame Buffer へ直接出力している。
 \end{itemize}
  \\
-\subsection{考察}
+\subsubsection{考察}
 
 Scale を適用した結果、実行速度の向上が見られた。
 しかし、SPE を1つ用いたときと、6つ用いたときの速度が 2.6 倍ほどしか
@@ -45,3 +45,29 @@
 
 台数効果が出ていない原因として、DMA 転送の待ち時間
 の無駄を十分に利用できてことが考えられる (Amdahl則\cite{amdahl})
+
+\newpage
+
+\subsection{キャッシュ}
+
+SPE 上の Texture データのキャッシュの有効性を検証する。
+
+キャッシュを用いた場合と用いてない場合を SPE の数を変更して比較する。
+
+\begin{table}[!h]
+  \begin{center}
+    \caption{キャッシュの有無による処理速度の比較}
+    \hbox to\hsize{\hfil
+      \begin{tabular}{c|l} \hline 
+       キャッシュなし(SPE 1 個) & 0.08 FPS \\ \hline
+       キャッシュなし(SPE 6 個) & 0.42 FPS \\ \hline
+        \hline
+       キャッシュあり(SPE 1 個) & 0.59 FPS \\ \hline
+       キャッシュあり(SPE 6 個) & 2.54 FPS \\ \hline
+      \end{tabular}\hfil}
+    \label{tb:cache}
+  \end{center}
+  \begin{center}
+  \end{center}
+\end{table}
+
--- a/paper/conclusion.tex	Thu Mar 26 20:10:07 2009 +0900
+++ b/paper/conclusion.tex	Fri Mar 27 00:29:08 2009 +0900
@@ -1,5 +1,8 @@
 \section{まとめ}
 
+Scale による DMA 待ち時間の有効活用と、
+SPE 上の Texture データのキャッシュの有効性を証明できた。
+
 DMA 転送の待ち時間の無駄を十分に利用できていない可能性が出たので、
 さらに SPE 上で行う処理を増やし、待ち時間の有効活用を目指す。
 
@@ -16,3 +19,5 @@
 DMA 転送の待ち時間を利用した SPE のデータ管理における実行速度の検証を、
 FPS だけでなく特定の命令数、命令の実行時間などの別の指標を用いて検証を行うことが
 必要である。
+
+\newpage
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/paper/galium.tex	Fri Mar 27 00:29:08 2009 +0900
@@ -0,0 +1,124 @@
+\section{Gallium}
+
+Gallium3D \cite{gallium} とは Tungsten Graphics 社が開発している、
+オープンソースの 3D グラフィックドライバ である。
+現在、Gallium には Intel GPU (i915) と Cell のドライバが実装されており、
+OSMesa \cite{osmesa} ではこの Cell ドライバを用いている。
+現在の Cell Driver のバージョンは 0.2 で、
+Cell SDK (Software Development Kit) の version 2.1 もしくは 3.0が 必要となる。
+
+Gallium Cell Driver では、Triangle を SPE に送り、
+そこから得られた Span に対してテクスチャを貼りレンダリングする。
+この時、Tile と呼ばれる、分割した描画領域毎に FrameBuffer へ書き込む。
+SPE は 6 個使用しており、SPE 上では SIMD 演算を積極的に使用している。
+
+我々がレンダリングエンジンとして OSMesa を採用しなかった理由は
+先行研究 \cite{akira} で述べられているように、
+OSMesa の実装自体が非常に複雑で、SPE を使用するための拡張が困難であると
+判断したからである。
+その OSMesa の Cell 実装として OpenGL のドライバである Gallium が登場した
+ことにより、レンダリングエンジンとして Gallium を採用することを考えた。
+しかし、Cell 上でのゲーム開発において、
+レンダリングエンジンのみを SPE 上に実装しても、
+Amdahl 則を考慮すると並列度の確保が困難であると考えられる。
+よって、我々はレンダリングエンジンとして Gallium を採用せず、
+レンダリングだけではなく SceneGraph の動作も SPE 上で行わせる
+Cerium の開発を行っている。
+
+\subsection{実行速度比較}
+
+Cerium は OSMesa のレンダリング実装を参考にしているため、
+Gallium と同様のレンダリングを行っている。
+ここでは、Cerium と Gallium の実行速度を計測し比較した。
+例題プログラムとして、図 9 地球のオブジェクトを
+表示して、SDL から得られる実行時間を元に
+FPS (Frame Per Second) を出力して比較する。解像度は 1920x1080 とする。
+Gallium、Cerium それぞれで以下のような実行環境を構築している。
+
+\begin{figure}[htb]
+  \begin{center}
+    \includegraphics[scale=0.2]{image/com_gallium.pdf}
+    \caption{Gallium、Cerium 例題}
+    \label{fig:com_gallium}
+  \end{center}
+\end{figure}
+
+\subsubsection{実行環境構築 Gallium}
+
+Gallium の例題プログラムでは、Cell Driver が組み込まれている
+OpenGL library (libGL) をロードして実行する。
+また、xml ファイル を用いて
+OpenGL の API で表示するルーチンは同研究室の杉山が実装した。
+以下がそのコードとなる。
+
+\begin{verbatim}
+void
+SceneGraph::gl_draw(void)
+{
+  glEnable(GL_TEXTURE_2D);
+  glBindTexture(GL_TEXTURE_2D, (GLuint)texture);
+
+  glTranslatef(xyz[0], xyz[1], xyz[2]);
+
+  glTranslatef(c_xyz[0], c_xyz[1], c_xyz[2]);
+  glRotatef(angle[0], 1, 0, 0);
+  glRotatef(angle[1], 0, 1, 0);
+  glRotatef(angle[2], 0, 0, 1);
+  glTranslatef(-c_xyz[0], -c_xyz[1], -c_xyz[2]);
+
+  glBegin( GL_TRIANGLES);
+  for(n = 0; n < size*3; n += 3) {
+      glTexCoord2f(tex_pos[n], 1-data[n+1]);
+      glVertex3f(coord[n], coord[n+1], coord[n+2]);
+      glNormal3f(normal[n], normal[n+1], normal[n+2]);
+  }
+  glEnd();
+  glDisable(GL_TEXTURE_2D);
+}
+\end{verbatim}
+
+\subsubsection{実行環境構築 Cerium}
+
+Cerium の描画出力は SDL Window と FrameBuffer の二種類ある。
+FrameBuffer では、SPE から直接 FrameBuffer へ DMA 転送により書き込むが、
+SDL Window 経由では、一度 PPE の バッファ (SDL\_Surface) へ書き込んでから
+FrameBuffer へ書き込む。以下がそのコードとなる。
+通常、SDL を用いる場合はこの様なコードになる。
+
+\begin{verbatim}
+  // bitmap : RGB値を持つ バッファ (SPE から書き込まれる)
+  // screen : FrameBuffer のアドレスを指す
+  SDL_BlitSurface(bitmap, NULL, screen, NULL);
+  SDL_UpdateRect(screen, 0, 0, 0, 0);
+\end{verbatim}
+
+\subsection{実行結果と考察}
+
+各環境の実行結果を \tabref{com_gallium} に示す。
+コンパイラの最適化レベルは -O9 を用いている。
+
+\begin{table}[htb]
+  \begin{center}
+    \caption{Gallium、Cerium 実行速度比較結果} \label{tab:com_gallium}
+    \hbox to\hsize{\hfil
+      \begin{tabular}{l|l} \hline \hline
+        Gallium (SPE 6個) & {\bf 5.4 FPS} \\ \hline
+        \hline
+        Cerium (SDL 出力、SPE 1個) & 2.2 FPS \\ \hline
+        Cerium (FrameBuffer 出力、SPE 1個) & 2.5 FPS \\ \hline
+        Cerium (SDL 出力、SPE 6個) & 6.7 FPS \\ \hline
+        Cerium (FrameBuffer 出力、SPE 6個) & {\bf 9.5 FPS} \\ \hline
+      \end{tabular}\hfil}
+  \end{center}
+\end{table}
+
+結果から、SPE の数が同じ場合は Cerium の方が Gallium よりも実行速度が
+速いと確認できた。
+また、直接 FrameBuffer に書き込む方が速いことも確認できる。
+
+Cerium では光源やシェーディング、アルファブレンディングなどの処理は
+行っておらず、現在は最低限のレンダリング機能しか実装していないため
+速度に差が出たのではないかと考えられる。
+しかし、Gallium と違い Cerium は SIMD 演算をまだ組み込んでいないため、
+%各種レンダリング機能を追加したとしても、
+さらに速度向上が期待できる。