This contains my bachelors thesis and associated tex files, code snippets and maybe more. Topic: Data Movement in Heterogeneous Memories with Intel Data Streaming Accelerator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

167 lines
15 KiB

  1. \chapter{Performance Microbenchmarks}
  2. \label{chap:perf}
  3. In this chapter, we measure the performance of the \gls{dsa}, with the goal to determine an effective utilization strategy to apply the \gls{dsa} to \gls{qdp}. In Section \ref{sec:perf:method} we lay out our benchmarking methodology, then perform benchmarks in \ref{sec:perf:bench} and finally summarize our findings in \ref{sec:perf:analysis}. \par
  4. The performance of \gls{dsa} has been evaluated in great detail by Reese Kuper et al. in \cite{intel:analysis}. Therefore, we will perform only a limited amount of benchmarks with the purpose of verifying the figures from \cite{intel:analysis} and analysing best practices and restrictions for applying \gls{dsa} to \gls{qdp}. \par
  5. \section{Benchmarking Methodology}
  6. \label{sec:perf:method}
  7. \begin{figure}[ht]
  8. \centering
  9. \includegraphics[width=0.9\textwidth]{images/xeonmax-numa-layout.png}
  10. \caption{Xeon Max \glsentrylong{node} Layout \cite[Fig. 14]{intel:maxtuning} for a 2-Socket System when configured with HBM-Flat. Showing separate \glsentryshort{numa:node} IDs for manual \glsentryshort{hbm} access and for Cores and \glsentryshort{dram}.}
  11. \label{fig:perf-xeonmaxnuma}
  12. \end{figure}
  13. The benchmarks were conducted on a dual-socket server equipped with two Intel Xeon Max 9468 CPUs, each with 4 nodes that have access to 16 GiB of \gls{hbm} and 12 cores. This results in a total of 96 cores and 128 GiB of \gls{hbm}. The layout of the system is visualized in Figure \ref{fig:perf-xeonmaxnuma}. For configuring it, we follow Section \ref{sec:state:setup-and-config}. \par
  14. As \gls{intel:dml} does not have support for \glsentryshort{dsa:dwq}s, we run benchmarks exclusively with access through \glsentryshort{dsa:swq}s. The application written for the benchmarks can be obtained in source form under the directory \texttt{benchmarks} in the thesis repository \cite{thesis-repo}. \par
  15. \begin{figure}[ht]
  16. \centering
  17. \begin{subfigure}{0.3\textwidth}
  18. \includegraphics[width=\textwidth]{images/nsd-benchmark.pdf}
  19. \caption{Outer benchmark function.}
  20. \label{fig:bench:outer}
  21. \end{subfigure}
  22. \hfill
  23. \begin{subfigure}{0.7\textwidth}
  24. \includegraphics[width=\textwidth]{images/nsd-benchmark-inner.pdf}
  25. \caption{Inner benchmark function.}
  26. \label{fig:bench:inner}
  27. \end{subfigure}
  28. \hfill
  29. \caption{Benchmark Procedure Pseudocode. Timing marked with yellow background. Showing location preparation and launch in (a) and work submission in (b).}
  30. \label{fig:benchmark-function}
  31. \end{figure}
  32. The benchmark performs node setup as described in Section \ref{sec:state:dml} and allocates source and destination memory on the nodes passed in as parameters. To avoid page faults affecting the results, the entire memory regions are written to before the timed part of the benchmark starts. We therefore also do not use \enquote{.block\_on\_fault()}, as we did for the memcpy-example in Section \ref{sec:state:dml}. \par
  33. To get accurate results, the benchmark is repeated 10 times. Each iteration is timed from beginning to end, marked by yellow in Figure \ref{fig:bench:outer}. For small task sizes, the iterations complete in a very short amount of time, which can have adverse effects on the results \cite{time-longer-sections}. Therefore, we repeat the code of the inner loop for a configurable amount, virtually extending the duration of a single iteration for these cases. \par
  34. For all \gls{dsa}s used in the benchmark, a submission thread executing the inner benchmark routine is spawned. The launch is synchronized by use of a barrier for each iteration. The behaviour in the inner function then differs depending on the submission method selected which can be a single submission or a batch of given size. This can be seen in Figure \ref{fig:bench:inner} at the switch statement for \enquote{mode}. Single submission follows the example given in Section \ref{sec:state:dml}, and we therefore do not go into detail explaining it here. Batch submission works unlike the former. A sequence with specified size is created which tasks are then added to. This sequence is submitted to the engine similar to the submission of a single descriptor. \par
  35. \section{Benchmarks}
  36. \label{sec:perf:bench}
  37. In this section we will In this section, we will present three benchmarks, each accompanied by setup information and a preview. We will then provide plots displaying the results, followed by a detailed analysis. We will formulate expectations and compare them with the observations from our measurements. \par
  38. \subsection{Submission Method}
  39. \label{subsec:perf:submitmethod}
  40. With each submission, descriptors must be prepared and sent to the underlying hardware. This process is anticipated to incur a cost, impacting throughput sizes and submission methods differently. We submit different sizes and compare batching with single submissions, determining which combination of submission method and size is most effective. \par
  41. We anticipate that single submissions will consistently yield poorer performance, particularly with a pronounced effect on smaller transfer sizes. This expectation arises from the fact that the overhead of a single submission with the \gls{dsa:swq} is incurred for every iteration, whereas the batch experiences this overhead only once for multiple copies. \par
  42. \begin{figure}[ht]
  43. \centering
  44. \includegraphics[width=0.7\textwidth]{images/plot-submitmethod.pdf}
  45. \caption{Throughput for different Submission Methods and Sizes. Performing a copy with source and destination being node 0, executed by the \glsentryshort{dsa} on node 0. Observable is the submission cost which affects small transfer sizes differently, as there the completion time is lower.}
  46. \label{fig:perf-submitmethod}
  47. \end{figure}
  48. In Figure \ref{fig:perf-submitmethod} we conclude that with transfers of 1 MiB and upwards, the submission method makes no noticeable difference. For smaller transfers the performance varies greatly, with batch operations leading in throughput. This finding is aligned with the observation that \enquote{SWQ observes lower throughput between 1-8 KB [transfer size]} \cite[p. 6 and 7]{intel:analysis} for normal submission method. \par
  49. Another limitation may be observed in this result, namely the inherent throughput limit per \gls{dsa} chip of close to 30 GiB/s. This is apparently caused by I/O fabric limitations \cite[p. 5]{intel:analysis}. \par
  50. \subsection{Multithreaded Submission}
  51. \label{subsec:perf:mtsubmit}
  52. As we might encounter access to one \gls{dsa} from multiple threads through the associated \glsentrylong{dsa:swq}, understanding the impact of this type of access is crucial. We benchmark multithreaded submission for one, two, and twelve threads - the latter representing the core count of one processing sub-node on the test system. Each configuration is assigned the same 120 copy tasks split across the available threads, all submitting to one \gls{dsa}. We perform this benchmark with sizes of 1 MiB and 1 GiB to examine, if the behaviour changes with submission size. For smaller sizes, the completion time may be faster than submission time, leading to potentially different effects of threading due to the fact that multiple threads work to fill the queue, preventing task starvation. We may also experience lower-than-peak throughput with rising thread count, caused by the synchronization inherent with \gls{dsa:swq}. \par
  53. \begin{figure}[ht]
  54. \centering
  55. \includegraphics[width=0.7\textwidth]{images/plot-mtsubmit.pdf}
  56. \caption{Throughput for different Thread Counts and Sizes. Multiple threads submit to the same Shared Work Queue. Performing a copy with source and destination being node 0, executed by the DSA on node 0.}
  57. \label{fig:perf-mtsubmit}
  58. \end{figure}
  59. In Figure \ref{fig:perf-mtsubmit}, we note that threading has no discernible negative impact. The synchronization appears to affect single-threaded access in the same manner as it does for multiple threads. Interestingly, for the smaller size of 1 MiB, our assumption proved accurate, and performance increased with the addition of threads, which we attribute to enhanced queue usage. We ascribe the higher throughput observed with 1 GiB to the submission delay which is incurred more frequently with lower transfer sizes. \par
  60. \subsection{Data Movement from \glsentryshort{dram} to \glsentryshort{hbm}}
  61. \label{subsec:perf:datacopy}
  62. Moving data from \gls{dram} to \gls{hbm} is most relevant to the rest of this work, as it is the target application. As we discovered in Section \ref{subsec:perf:submitmethod}, one \gls{dsa} has a peak bandwidth limit of 30 GiB/s. For each node, the test system is configured with two DIMMs of DDR5-4800. \par
  63. The naming scheme contains the data rate in megatransfers per second \cite{kingston:ddr5-spec-overview}. We calculate the transfers performed per second as follows:
  64. \[2\ DIMMs * \frac{4800\ MT}{s\ and\ DIMM} = 76800\ T/s\]
  65. The data width of DDR5 is 64 bit \cite{kingston:ddr5-spec-overview}. The theoretical peak transfer speed in GiB/s therefore is:
  66. \[76800\ T/s * \frac{64b}{8b/B} = 75\ GiB/s\]
  67. \par
  68. We conclude that to achieve peak speeds, a copy task has to be split across multiple \gls{dsa}s. Two methods of splitting will be evaluated. The first employs a brute force approach, utilizing all available resources for any transfer direction. The second method's behaviour depends on the data source and destination locations. Given that our system consists of multiple sockets, communication crossing between sockets could introduce latency and bandwidth disadvantages \cite{bench:heterogeneous-communication}. We posit that for intra-socket transfers, utilizing the \gls{dsa} from the second socket will have only a marginal effect. For transfers crossing sockets, we assume every \gls{dsa} performs equally worse, prompting us to use only the ones on the destination and source nodes for them being the physically closest to both memory regions. While this choice may result in lower performance, it uses only one-fourth of the engines in the brute force approach for inter-socket transfers and half for intra-socket transfers. This approach also frees up additional chips for other threads to utilize.\par
  69. For this benchmark, we transfer 1 Gibibyte of data from node 0 to the destination node, employing the submission method previously described. For each utilized node, we spawn one pinned thread responsible for submission. We present data for nodes 8, 11, 12, and 15. To understand the selection, refer to Figure \ref{fig:perf-xeonmaxnuma}, which illustrates the node IDs of the configured systems and the corresponding storage technology. Node 8 accesses the \gls{hbm} on node 0, making it the physically closest possible destination. Node 11 is located diagonally on the chip, representing the furthest intra-socket operation benchmarked. Nodes 12 and 15 lie diagonally on the second socket's CPU, making them representative of inter-socket transfer operations. \par
  70. \begin{figure}[ht]
  71. \centering
  72. \begin{subfigure}{0.4\textwidth}
  73. \includegraphics[width=\textwidth]{images/plot-perf-smart-throughput-selectbarplot.pdf}
  74. \caption{Brute Force Assignment: using all available \glsentryshort{dsa}, irrespective of source and destination locations.}
  75. \label{fig:perf-dsa:smart}
  76. \end{subfigure}
  77. \hfill
  78. \begin{subfigure}{0.4\textwidth}
  79. \includegraphics[width=\textwidth]{images/plot-perf-allnodes-throughput-selectbarplot.pdf}
  80. \caption{Smart Assignment: using four on-socket \glsentryshort{dsa} for intra-socket operation and the \glsentryshort{dsa} on source and destination node for inter-socket copies.}
  81. \label{fig:perf-dsa:allnodes}
  82. \end{subfigure}
  83. \hfill
  84. \caption{Copying 1 GiB from \glsentryshort{numa:node} 0 to the destination \glsentryshort{numa:node} specified on the x-axis. Shows peak throughput achievable with \glsentryshort{dsa} for different load balancing techniques.}
  85. \label{fig:perf-dsa}
  86. \end{figure}
  87. \todo{update}
  88. From the results of the brute force approach illustrated in Figure \ref{fig:perf-peak-brute}, we observe peak speeds of close to 64 GiB/s when copying across the socket from Node 0 to Node 15. This contradicts our assumption that peak bandwidth would be limited by the interconnect. \par
  89. While consuming significantly more resources, the brute force copy depicted in Figure \ref{fig:perf-peak-brute} surpasses the performance of the smart approach shown in Figure \ref{fig:perf-peak-smart}. We observe an increase in transfer speed by utilizing all available \gls{dsa}, achieving 2 GiB/s for copying to Node 8, 18 GiB/s for Nodes 11 and 12, and 30 GiB/s for Node 15. The smart approach could accommodate another intra-socket copy on the second socket, we assume, without observing negative impacts. From this, we conclude that the smart copy assignment is worth using, as it provides better scalability. \par
  90. \subsection{Data Movement using CPU}
  91. For evaluating CPU copy performance we use the benchmark code from Section \ref{subsec:perf:datacopy}, selecting the software instead of hardware execution path (see Section \ref{subsec:state:dsa-software-view}). Colleagues performed extensive benchmarking of the peak throughput on CPU for the test system \cite{xeonmax-peakthroughput}, from which we will present results as well. \par
  92. \begin{figure}[ht]
  93. \centering
  94. \begin{subfigure}{0.4\textwidth}
  95. \includegraphics[width=\textwidth]{images/plot-allnodes-cpu-throughput.pdf}
  96. \caption{Using allnodes code with software path.}
  97. \label{fig:perf-cpu:swpath}
  98. \end{subfigure}
  99. \hfill
  100. \begin{subfigure}{0.4\textwidth}
  101. \includegraphics[width=\textwidth]{images/plot-andrepeak-cpu-throughput.pdf}
  102. \caption{Colleague's benchmark \cite{xeonmax-peakthroughput}.}
  103. \label{fig:perf-cpu:andrepeak}
  104. \end{subfigure}
  105. \hfill
  106. \caption{Throughput from \glsentryshort{dram} to \glsentryshort{hbm} on CPU. Copying from \glsentryshort{numa:node} 0 to the destination \glsentryshort{numa:node} specified on the x-axis.}
  107. \label{fig:perf-cpu}
  108. \end{figure}
  109. The
  110. \section{Analysis}
  111. \label{sec:perf:analysis}
  112. In this section we summarize the conclusions drawn from the three benchmarks performed in the sections above and outline a utilization guideline. We also compare CPU and \gls{dsa} for the task of copying data from \gls{dram} to \gls{hbm}. \par
  113. \begin{itemize}
  114. \item From \ref{subsec:perf:submitmethod} we conclude that small copies under 1 MiB in size require batching and still do not reach peak performance. Task size should therefore be at or above 1 MiB if possible.
  115. \item Subsection \ref{subsec:perf:mtsubmit} assures that access from multiple threads does not negatively affect the performance when using \glsentrylong{dsa:swq} for work submission.
  116. \item In \ref{subsec:perf:datacopy}, we chose to use the presented smart copy methodology to split copy tasks across multiple \gls{dsa} chips to achieve low utilization with acceptable performance.
  117. \end{itemize}
  118. \todo{update}
  119. Once again, we refer to Figures \ref{fig:perf-cpu} and \ref{fig:perf-cpu-peak-brute}, both representing the maximum throughput achieved with the utilization of either \gls{dsa} for the former and CPU for the latter. Noticeably, the \gls{dsa} does not seem to suffer from inter-socket overhead like the CPU. In any case, \gls{dsa} performs at or above CPUs peak throughput, demonstrating potential for faster data movement while simultaneously freeing up CPU cycles. \par
  120. %%% Local Variables:
  121. %%% TeX-master: "diplom"
  122. %%% End: