Changes

Jump to: navigation, search

Winter 2022 SPO600 Weekly Schedule

12,747 bytes added, 10:42, 6 September 2022
Binary Representation of Data
[[Category:Winter 2022 SPO600]]
This is the schedule and main index page for the [[SPO600]] ''Software Portability and Optimization'' course for Winter 2022.
<!-- {{Admon/important|It's Alive!|This [[SPO600]] weekly schedule will be updated as the course proceeds - dates and content are subject to change. The cells in the summary table will be linked to relevant resources and labs as the course progresses.}}-->
<!-- {{Admon/important|Content being Updated|This page is in the process of being updated from a previous semester's content. It is not yet updated for the current semester. Do not rely on the accuracy of this information until this warning is removed.}} -->
<!-- {{Admon/obsolete|[[Current SPO600 Weekly Schedule]]}} -->
|3||Jan 24||[[#Week 3 - Class I|6502 Math / Jumps, Branches, and Subroutines]]||[[#Week 3 - Class II|6502 Strings]]||[[#Week 3 Deliverables|Lab 3]]
|-
|4||Jan 31||[[#Week 4 - Class I|Compiler Optimizations]]||[[#Week 4 - Class II|Building Code / Make and Makefiles / Autotools and Friends(No lecture - continue work on Lab 3)]]||[[#Week 4 Deliverables|Lab 43, January blog posts]]
|-
|5||Feb 07||[[#Week 5 - Class I|Introduction to 64-bit Assembly (x86_64 Building Code / Make and AArch64) Makefiles / Modern Architectural EnhancementsAutotools and Friends]]||[[#Week 5 - Class II|More Introduction to 64 Bit Assembler-bit Architectures - Registers (x86_64 and AArch64) / Memory Issues]]||[[#Week 5 Deliverables|Lab 53]]
|-
|6||Feb 14||[[#Week 6 - Class I|SIMD64-Bit Assembly Language - Part 1]]||[[#Week 6 - Class II|Inline 64-Bit AssemblyLanguage - Part 2]]||[[#Week 6 Deliverables|Lab 64]]
|-
|7||Feb 21||[[#Week 7 - Class I|Using ARMv9 instructions (for SVE2) on an ARMv8 systemOptimization Trade-Off / Algorithm Selection / Benchmarking]]||[[#Week 7 - Class II|Project SIMD / Algorithm Selection]]||[[#Week 7 Deliverables|Lab 75]]
|-
|Reading||Oct 25||style="background: #f0f0ff" colspan="2" align="center"|Reading Week||February Blog Postsdue at 11:59 pm Feb 28
|-
|8||Mar 07||[[#Week 8 - Class I|Benchmarking and ProfilingSclable Vector Extensions v2 (SVE2)]]||[[#Week 8 - Class II|Project Stage 1]]||[[#Week 8 Deliverables|Project Stage 1Lab 6]]
|-
|9||Mar 14||[[#Week 9 - Class I|Memory System Design - Paging / Virtual MemoryProject Discussion 1]]||[[#Week 9 - Class II|Project Discussion---]]||[[#Week 9 Deliverables|Blog about project work]]
|-
|10||Mar 21||[[#Week 10 - Class I|Memory - Cache / NUMAProject Discussion 2]]||[[#Week 10 - Class II|Project DiscussionGCC and SVE2]]||[[#Week 10 Deliverables|Blog about project work]]
|-
|11||Mar 28||[[#Week 11 - Class I|Memory - Observability, BarriersProject Discussion 3]]||[[#Week 11 - Class II|Project Stage 2SVE2 Examples]]||[[#Week 11 Deliverables|Project Stage 21 (March 28), March Blog Posts(March 31)]]
|-
|12||Apr 04||[[#Week 12 - Class I|Atomic OperationsDemo/discussion of SVE 2 Examples]]||[[#Week 12 - Class II|Project DiscussionSVE2 Examples Part 2]]||[[#Week 12 Deliverables|Blog about project work]]
|-
|13||Apr 11||[[#Week 13 - Class I|Project DiscussionMemory Systems]]||style="background: #f0f0ff"|Good Friday||[[#Week 13 Deliverables|Blog about project work]]
|-
|14||Apr 18||[[#Week 14 - Class I|Future Directions in Architecture]]||[[#Week 14 - Class II|Project Stage 3]]||[[#Week 14 Deliverables|Project Stage 3, April Blog Posts]]
|}
 
 
<!-- Memory System Design - Paging ; Memory - Cache/Numa ; Memory - Observability, Barriers -->
== Week 1 ==
*** Logically: false or true.
** Binary numbers are resistant to errors, especially when compared to other systems such as analog voltages.
*** To represent the numbers 0-5 10 as an analog electical value, we could use a voltage from 0 - 5 10 volts. However, if we use a long cable, there will be signal loss and the voltage will drop: we could apply 5 10 volts on one end of the cable, but only observe (say) 49.1 volts on the other end of the cable. Alternately, electromagnetic interference from nearby devices could slightly increase the signal.*** If we use instead use the same voltages and cable length to carry a binary signal, where 0 volts == off == "0" and 5 10 volts == on == "1", a signal that had degraded from 5 10 volts to 49.1 volts would still be counted as a "1" and a 0 volt signal with some stray electromagnetic interference presenting as (say) 0.4 volts would still be counted as "0". However, we will need to use multiple bits to carry larger numbers -- either in parallel (multiple wires side-by-side), or sequentially (multiple bits presented over the same wire in sequence).
* Integers
** Integers are the basic building block of binary numbering schemes.
** The most commonly-used floating point formats are defined in the [[IEEE 754]] standard.
** IEEE754 floating point numbers have three parts: a ''sign bit'' (0 for positive, 1 for negative), a ''mantissa'' or ''significand'', and an ''exponent''. The significand has an implied 1 and radix point preceeding the stored value. The exponent is stored as an unsigned integer to which a ''bias'' value has been added; the bias value is 2<sup>(number of exponent bits - 1)</sup> - 1. The floating point value is interpreted in normal cases as <code>''sign'' mantissa * 2<sup>(exponent - bias)</sup></code>. Exponent values which are all-zeros or all-ones encode four categories of special cases: zero, infinity, Not a Number (NaN), and subnormal numbers (numbers which are close to zero, where the significand does not have an implied 1 to the left of the radix point); in these special cases, the sign bit and significand values may have special meanings.
** There are some new floating-point formats appearing, such as ''Brain Float 16'', a 16-bit format with the same dynamic range as 32-bit IEEE 754 floating point but with less accuracy, intended for use in machine learning applications.
* Characters
** Characters are encoded as integers, where each integer corresponds to one "code point" in a character table (e.g., code 65 in ASCII corresponds to the character "A").
** Historically, many different coding schemes have been used, but the two most common ones were the American Standard Code for Information Interchange (ASCII), and Extended Binary Coded Decimal Interchange Code (EBCDIC - primarily used on IBM midrange and mainframe systems).
** ASCII characters occupied seven bits (code points 0-127), and contains only characters used in North American English. ASCII characters are usually encoded in bytes, so many vendors of ASCII-based systems used the remaining codes 128-255 for special characters such as graphics, line symbols (horizontal, vertical, connector, and corner line symbols for drawing tables), and accented characters; these were called "extended ASCII".
** Several ISO standards exist in an attempt to standardize the "extended ascii" characters, such as ISO8859, which was intended to enable the encoding of European languages by adding currency symbols and accented characters. However, the original version of ISO8859-1 does not include all accented characters and was created before the Euro symbol was standardized, so there are multiple versions of ISO8859, ranging from ISO8859-1 through ISO8859-15.
** The Unicode and ISO10646 initiatives were initiated to create a single character code set that would encode all symbols used in human writing, both for current and obsolete languages. These initiatives were merged, and the Unicode and ISO10646 standards define a common character set with 2<sup>32</sup> potential code points. However, Unicode also describes transformation formats for data interchange, rendering and composition/decomposition recommendations, and font symbol recommendations.
* Finish [[6502 Math and Strings Lab|Lab 3]]
* Continue to blog
 
== Week 5 ==
 
=== Week 5 - Class I ===
 
==== Video ====
* No recording of the live session is available (bad audio)
* Pre-recorded lecture/demo: [https://web.microsoftstream.com/video/466bc3a1-6729-434d-b51f-33d4fbb145c5 Make and Makefiles]
 
==== Notes ====
* [[Make and Makefiles]]
 
===== Compiler Options =====
* (Modern compilers are similar in options, for the sake of this discussion I'm focusing on the GNU C Compiler (gcc), part of the GNU Compiler Collection)
* There are hundreds of compiler features available, many of which are optimization options.
* These features can be controlled from the compiler command line:
** To enable a feature, specify <code>-f</code> and the option name: <code>-f''builtin''</code>
** To disable a feature, specify <code>-f</code> and then <code>no-</code> and the option name: <code>-f''no-builtin''</code>
* Example:
gcc -fbuiltin -falign-functions -no-caller-saves ''foo''.c -o foo
* To see the available optimization features and what each does, view the gcc manpage and/or gcc manual
* It's a pain to specify hundreds of <code>-f</code> options on the command line, so these are grouped into commonly-used sets. The sets can be specified with the <code>-O</code> compiler option (note that that is a capital letter "O", not a lowercase "o" nor a zero "0"), followed by an optimization level:
** -O0 : almost no optimization
** -O1 : optimizations that can be quickly performed
** -O2 : all of the normal optimizations that can be safely applied to all programs (this is the usual default optimization level)
** -O3 : all normal optimization, including some that may in rare cases cause changes to the operation of the program (for example, counting +0 and -0 as the same number -- which is fine in the vast majority of cases, but might interfere with the correct operation of some scientific calculations)
** -Os : optimize for smallest size (of both the executable and the memory usage while executing)
** -Ofast : optimize for highest speed, even at the cost of more memory usage
** -Og : optimize for debugging -- avoid optimizations that will excessively convolute the code, making it harder to see the correlation between the source code and the object code
* Note that the set of optimizations considered "safe" may vary over time - for example, vector optimization were previously considered unsafe (<code>-O3</code>) in the gcc compiler, but with improvements and testing are not considered safe and are therefore included in the <code>-O2</code> level in newer versions of gcc.
* You can specify a group of options with <code>-O</code> and override the use of individual options with <code>-f</code> by placing the <code>-O</code> group first:
gcc -O2 -fno-builtin foo.c -o foo
* To see the optimizations that will be applied by a given set of command-line options, use <code>-Q --help=optimizers</code> to query the optimization list that the compiler will use:
gcc -O1 -Q --help=optimizers | less
 
=== Week 5 - Class II ===
 
==== Video ====
* [https://web.microsoftstream.com/video/91554778-ac0f-4928-8a8b-f4636b96a427 x86_64 & AArch64 Introduction - Registers]
* [https://web.microsoftstream.com/video/880fb0f8-1084-457a-92e0-80f04ad62463 Memory Alignment and Performance]
* [https://web.microsoftstream.com/video/1bcab47b-514a-4f23-bdd4-f73662a0673f Paged Memory Systems]
 
=== Resources ===
* [[X86 64 Register and Instruction Quick Start]]
* [[AArch64 Register and Instruction Quick Start]]
* [[Computer Architecture]]
 
=== Week 5 Deliverables ===
* Finish [[6502 Math and Strings Lab|Lab 3]]
* Continue to blog
 
== Week 6 ==
 
=== Week 6 - Class I ===
 
==== Video ====
* [https://web.microsoftstream.com/video/f8ca9820-2222-4aad-a5f7-17fdc117ec3b Week 6 Class I Summary Video]
 
==== Class Servers ====
* Student accounts on the [[SPO600 Servers]] have been set up
* Please test that you can login to both of these machines as soon as possible. Contact me if you have any issues logging in.
 
=== Week 6 - Class II ===
 
==== Videos ====
* [https://web.microsoftstream.com/video/8c3c1353-5729-4217-b1ba-371410f14ad4 64-Bit Assembly Language - Part II]
 
==== Reading ====
* [[Assembly Language]]
* [[Assembler Basics]]
 
==== Lab ====
* [[SPO600 64-bit Assembly Language Lab]] (Lab 4)
 
=== Week 6 Deliverables ===
* [[SPO600 64-bit Assembly Language Lab|Lab 4]]
* Continue to Blog
 
== Week 7 ==
 
=== Week 7 - Class I ===
 
==== Video ====
* A summary video will be posted after editing
 
 
=== Week 7 - Class II ===
 
==== Videos ====
* [https://web.microsoftstream.com/video/f60b92c6-9db3-4f57-b0b9-7c35ea0c054f Single Instruction, Multiple Data (SIMD)]
* [https://web.microsoftstream.com/video/d208a737-7777-4b5a-b276-1b19dc78145c Inline Assembly Language]
* [https://web.microsoftstream.com/video/2a82da88-bf5b-4112-953a-7408fbab30c1 Algorithm Selection]
* [https://web.microsoftstream.com/video/d56ec6ff-2c2c-40d6-8967-52d829e413cc Linux Tips] (This is an older video -- the systems mentioned, such as xerxes, were previous versions of the [[SPO600 Servers|class servers]].)
 
==== Reading ====
* [[Inline Assembly Language]]
 
==== Lab ====
* [[SPO600 Algorithm Selection Lab]] (Lab 5)
 
 
=== Week 7 Deliverables ===
* [[SPO600 Algorithm Selection Lab|Lab 5]]
* '''Note:''' Blog for February are due at 11:59 pm on February 28 (Tuesday). I'll be looking for an average of 1-2 blog posts per week, or 4-8 blog posts for February. Please review your posts for accuracy and completeness.
 
== Week 8 ==
 
=== Week 8 - Class I ===
 
==== Video ====
* [https://web.microsoftstream.com/video/333ff7df-7c82-48c7-8051-39a04592c849 Edited summary video]
 
==== Reading ====
* [[SVE2]]
 
==== Lab ====
* [[SPO600 SVE2 Lab]] (Lab 6)
 
=== Week 8 - Class II ===
 
==== Project ====
* [[Winter 2022 SPO600 Project]] - We will discuss this in the next class
 
==== Video ====
* [https://web.microsoftstream.com/video/ad72567e-047d-4dda-9f24-0c525429c7d1 Searching a Codebase]
 
=== Week 8 Deliverables ===
* Blog about your [[SPO600 SVE2 Lab|Lab 6]]
 
== Week 9 ==
 
=== Week 9 - Class I ===
 
==== Video ====
* Summary video: [https://web.microsoftstream.com/video/b9ccfc5f-f816-45af-828f-98f5fad5c8c8 Project Discussion 1]
 
=== Week 9 - Class II ===
* No content posted.
 
== Week 10 ==
 
=== Week 10 - Class I ===
 
==== Video ====
* Summary video: [https://web.microsoftstream.com/video/058bf7e4-ba17-47a0-9db9-9221a24da548 Project Discussion 2]
 
=== Week 10 - Class II ===
 
==== Videos ====
* [https://web.microsoftstream.com/video/b62a6499-012b-4203-b320-126b978e6ae3 GCC and SVE2] - A discussion of compiler flags, macros, pre-processor directives, and disassembly analysis that may be useful in project stage 2.
* [https://web.microsoftstream.com/video/52c0d800-9618-46ac-8a5e-1a5477b5e4f0 Bitwise Operations] - this video covers AND, OR, XOR/EOR, and NOT operations. It should be review, but I've seen these operations misused a few times lately so it may be useful to you, especially if you are not familiar with the use of masks with these operations.
 
=== Week 10 - Deliverables ===
* Blog about your [[Winter 2022 SPO600 Project|project work]].
* '''Note:''' Your [[Winter 2022 SPO600 Project|Project Stage 1]] is due on Monday, March 28 by midnight.
 
== Week 11 ==
 
=== Week 11 - Class I ===
 
==== Videos ====
* [https://web.microsoftstream.com/video/5f633a25-c478-4aab-af90-c447d581a631 Project Discussion 3] - An edited recording of the March 28, 2022 SPO600 class.
* [https://web.microsoftstream.com/video/b197e528-3385-41ef-b648-7041d054c0d2 Benchmarking and Profiling] - An optional video that may be useful to some projects in Stage 2. This video discusses benchmarking (overall program performance analysis) and profiling (per-function/per-method performance analysis) principles and techniques. (This is an edited version of a previous-semester video. There are a couple of small audio and video glitches in the recording).
 
==== Reading ====
* [https://locklessinc.com/articles/vectorize/ Auto-vectorization with GCC 4.7] - Although based on an earlier version of GCC (and a number of new features have been added to the GCC autovectorizer since this article was written), it discusses some of the techniques and code adjustments that may be required to get the GCC compiler to vectorize code. Note that the <code>-fopt-info-vec-all</code> or <code>-fopt-info-vec-missed</code> options are useful in conjunction with this technique, as they will cause the compiler to emit information about the vectorization decisions that it is making.
* [https://www.phoronix.com/scan.php?page=news_item&px=GCC-12-Auto-Vec-O2 GCC 12 Enables Auto-Vectorization for -O2 Optimization Level] - a short news article from October 2021 regarding the [https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=2b8453c401b699ed93c085d0413ab4b5030bcdb8 commit] that added autovectorization to the <code>-O2</code> optimization level, which is the default for many projects. GCC12 is expected to ship in April 2022, according to a recent [https://gcc.gnu.org/pipermail/gcc/2022-January/238136.html status update].
 
=== Week 11 - Class II ===
 
==== SVE2 Demonstration ====
* Code available here: https://github.com/ctyler/sve2-test
* This is an implementation of a very simple program which takes an image file, adjusts the red/green/blue channels of that file, and then writes an output file. Each channel is adjusted by a factor in the range 0.0 to 2.0 (with saturation).
* The image adjustment is performed in the function <code>adjust_channels()</code> in the file <code>adjust_channels.c</code>. There are three implementations:
*# A basic (naive) implementation in C. Although this is a very basic implementation, it is potentially subject to autovectorization.
*# An implementation using inline assembler for SVE2.
*# (Future) An implementation using ACLE compile intrinsics.
* The implementation built is dependent on the value of the ADJUST_CHANNEL_IMPLEMENTATION macro.
* The provided Makefile will build two versions of the binary, one using implementation 1 (named <code>image_adjust1</code>) and one using implementation 2 (named <code>image_adjust2</code>), and it will run through 3 tests with each binary. The tests use the input image file <code>tests/input/bree.jpg</code> (a picture of a cat) and place the output in the files <code>tests/output/bree[12][abc].jpg</code>. The output files are processed with adjustment factors of 0.5/0.5/0.5, 1.0/1.0/1.0, and 2.0/2.0/2.0.
* '''Please examine, build, and test the code, compare the implementations, and note how it works - there are extensive comments in the code, especially for implementation 2.'''
* Your observations about the code might make a good blog post!
 
=== Week 11 - Deliverables ===
* Blog about your project work.
 
 
== Week 12 ==
 
=== Week 12 - Class I ===
 
==== Video ====
* [https://web.microsoftstream.com/video/00172f3b-f0cb-486f-bf15-42c73e8916b4 SVE2 Examples] - Summary video of the SPO600 class on Tuesday, April 5.
 
==== SVE2 Demonstration ====
* The SVE2 [https://github.com/ctyler/sve2-test example code] has been extended with an additional inline assembley implementation, plus an ACLE implementation.
 
=== Week 12 - Class II ===
 
==== Video ====
* [https://web.microsoftstream.com/video/11def15f-20df-41b5-84f0-6fd5bd96bc2a SVE2 Examples - Part 2] - Part 2 of a look at the [https://github.com/ctyler/sve2-test example code] - A discussion of the bug that existed in the ACLE/intrinsics code discussed in the last class, plus an examination of the disassembly of the naive/autovectorized version of the code (implementation #1).
 
=== Week 12 - Deliverables ===
* Continue to blog about your project work
* Project Stage 2 will be due on '''Wednesday, April 13''' (11:59 pm EDT).
 
== Week 13 ==
 
=== Week 13 - Class I ===
 
==== Video ====
* [https://web.microsoftstream.com/video/274ee2d2-a19c-4d12-8c1b-78141cfb4566 Memory Systems] summary video
 
=== Week 13 - Class II ===
* Good Friday - no class
 
=== Week 13 Deliverables ===
* Continue to post about your project.
 
== Week 14 ==
 
=== Week 14 - Class I ===
 
==== Video ====
 
* (Not available)
 
=== Week 14 - Class II ===
 
=== Week 14 Deliverables ===
* [[Winter_2022_SPO600_Project|Project Stage 2]] due Monday April 18 (by 11:59 pm)
* [[Winter_2022_SPO600_Project|Project Stage 3]] due Friday April 22 (by 11:59 pm)
* April blog posts due Friday April 22 (by 11:59 pm)

Navigation menu