Changes

Jump to: navigation, search

Fall 2022 SPO600 Weekly Schedule

21,047 bytes added, 00:06, 13 November 2022
no edit summary
[[Category:Fall 2022 SPO600]]
This is the schedule and main index page for the [[SPO600]] ''Software Portability and Optimization'' course for Fall 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]]}} -->
 
|1||Sep 5||[[#Week 1 - Class I|Introduction to the Course / Introduction to the Problem / Computer Architecture Basics]]||[[#Week 1 - Class II|Binary Representation of Data]]||[[#Week 1 Deliverables|Set up for the course / Lab 1]]
|-
|2||Sep 12||[[#Week 2 - Class I|Introduction to 6502 Assembly]]||[[#Week 2 - Class II|Writing and Debugging 6502 Code Math / Assembly Language Conventions / Using Macros EffectivelyJumps, Branches, and Subroutines]]||[[#Week 2 Deliverables|Lab 2]]
|-
|3||Sep 19||[[#Week 3 - Class I|6502 Math / Jumps, Branches, and SubroutinesStrings]]||[[#Week 3 - Class II|6502 StringsString Input / Building Code: Make and Makefiles]]||[[#Week 3 Deliverables|Lab 3]]
|-
|4||Sep 26||[[#Week 4 - Class I|Compiler Optimizations]]||[[#Week 4 - Class II|Building Code : Compiler Options, GNU Autotools/ Make and Makefiles / Autotools and FriendsAutomake]]||[[#Week 4 Deliverables|Lab 3, September blog posts]]
|-
|5||Oct 3||[[#Week 5 - Class I|Introduction to 64-bit Architectures - Registers and Assembly Language (x86_64 and AArch64)]]||[[#Week 5 - Class II|Memory on 64-bit Systems]]||[[#Week 5 Deliverables|Lab 34]]
|-
|6||Oct 10||[[#Week 6 - Class I|64Mid-Bit Assembly Language - Part 1semester Sync Discussion]]||[[#Week 6 - Class II|64-Bit Assembly Language Algorithm Selection / In- Part 2line Assembler / SIMD]]||[[#Week 6 Deliverables|Lab 45]]
|-
|7||Oct 17||[[#Week 7 - Class I|Optimization TradeExploring 64-Off / Algorithm Selection / Benchmarkingbit Code]]||[[#Week 7 - Class II|SIMD / Algorithm SelectionSVE2]]||[[#Week 7 Deliverables|Lab Wrap up lab 5]]
|-
|Reading||Oct 24||style="background: #f0f0ff" colspan="3" align="center"|Reading Week
|-
|8||Oct 31||[[#Week 8 - Class I|Sclable Vector Extensions v2 (SVE2)Optimization Trade-Offs / Algorithm Selection / Inline Assembler / SIMD]]||[[#Week 8 - Class II|Project Stage 1Scalable Vector Extensions (SVE/SVE2) via Inline Assembler and C Intrinsics]]||[[#Week 8 Deliverables|Lab 6, October blog posts]]
|-
|9||Nov 7||[[#Week 9 - Class I|iFunc & Project Discussion 1Overview]]||[[#Week 9 - Class II|---Project Detail]]||[[#Week 9 Deliverables|Blog about ifunc and your project work]]
|-
|10||Nov 14||[[#Week 10 - Class I|Project Discussion 2]]||[[#Week 10 - Class II|GCC and SVE2Memory Barriers]]||[[#Week 10 Deliverables|Blog about project work]]
|-
|11||Nov 21||[[#Week 11 - Class I|Project Discussion 3]]||[[#Week 11 - Class II|SVE2 ExamplesAdvanced Memory Systems]]||[[#Week 11 Deliverables|Blog about project work]]
|-
|12||Nov 28||[[#Week 12 - Class I|Demo/discussion of SVE 2 ExamplesProject Discussion]]||[[#Week 12 - Class II|SVE2 Examples Part 2Compiler Technology]]||[[#Week 12 Deliverables|Blog about project work, November blog posts]]
|-
|13||Dec 5||[[#Week 13 - Class I|Memory SystemsProject Discussion]]||TBA[[#Week 13 - Class II|Final project instructions]]||[[#Week 13 Deliverables|Blog about project work]]
|-
|14||Dec 12||[[#Week 14 - Class I|Future Directions in Architecture]]||style="background: #f0f0ff"|(No class)||[[#Week 14 Deliverables|Project Stage 3, December blog posts]]
|-
 
|}
*** [[Endian|Endianness]]
** Code that takes advantage of platform-specific features
* Reasons for writing code in Assembly Langauge Language include:
** Performance
** [[Atomic Operation|Atomic Operations]]
===== Build Process =====
Building software is a complex task that many developers gloss over. The simple act of compiling a program invokes a process with five or more stages, including pre-proccessingprocessing, compiling, optimizing, assembling, and linking. However, a complex software system will have hundreds or even thousands of source files, as well as dozens or hundreds of build configuration options, auto configuration scripts (cmake, autotools), build scripts (such as Makefiles) to coordinate the process, test suites, and more.
The build process varies significantly between software packages. Most software distribution projects (including Linux distributions such as Ubuntu and Fedora) use a packaging system that further wraps the build process in a standardized script format, so that different software packages can be built using a consistent process.
*** 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-10 as an analog electical electrical value, we could use a voltage from 0 - 10 volts. However, if we use a long cable, there will be signal loss and the voltage will drop: we could apply 10 volts on one end of the cable, but only observe (say) 9.1 volts on the other end of the cable. Alternately, electromagnetic interference from nearby devices could slightly increase the signal.
*** If we instead use the same voltages and cable length to carry a binary signal, where 0 volts == off == "0" and 10 volts == on == "1", a signal that had degraded from 10 volts to 9.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
*** Instead of fixed-length numbers, variable-length numbers are used, with the most common values encoded in the smallest number of bits. This is an effective strategy if the distribution of values in the data set is uneven.
** Repeated sequence encoding (1D, 2D, 3D)
*** Run length encoding is an encoding scheme that records the number of repeated values. For example, fax messages are encoded as a series of numbers representing the number of white pixels, then the number of black pixels, then white pixels, then black pixels, alternating to the end of each line. These numbers are then represented with adaptive artithmetic arithmetic encoding.
*** Text data can be compressed by building a dictionary of common sequences, which may represent words or complete phrases, where each entry in the dictionary is numbered. The compressed data contains the dictionary plus a sequence of numbers which represent the occurrence of the sequences in the original text. On standard text, this typically enables 10:1 compression.
** Decomposition
*** Compound audio wavforms waveforms can be decomposed into individual signals, which can then be modelled as repeated sequences. For example, a waveform consisting of two notes being played at different frequencies can be decomposed into those separate notes; since each note consists of a number of repetitions of a particular wave pattern, they can individually be represented in a more compact format by describing the frequency, waveform shape, and amplitude characteristics.
** Palletization
*** Images often contain repeated colours, and rarely use all of the available colours in the original encoding scheme. For example, a 1920x1080 "full HD" image contains about 2 million pixels, so if every pixel was a different colour, there would be a maximum of 2 million colours. But it's likely that many of the pixels in the image are the same colour, so there might only be (perhaps) 4000 colours in the image. If each pixel is encoded as a 24-bit value, there are potentially 16 million colours available, and there is no possibility that they are all used. Instead, a palette can be provided which specifies each of the 4000 colours used in the picture, and then each pixel can be encoded as a 12-bit number which selects one of the colours from the palette. The total storage requirement for the original 24-bit scheme is 1920*1080*3 bytes per pixel = 5.9 MB. Using a 12-bit pallette, the storage requirement is 3 * 4096 bytes for the palette plus 1920*1080*1.5 bytes for the image, for a total of 3 MB -- a reduction of almost 50%
# Follow the [[SPO600 Communication Tools]] set-up instructions.
# Optional (strongly recommended): [[SPO600 Host Setup|Set up a personal Linux system]].
# Optional: If you have an AArch64 development board (such as a Raspberry Pi 4, Raspberry Pi 400, or [http://96boards.org 96Boards] device), consider installing a 64-bit Linux operating system such as Fedora on it.
# Start work on [[SPO600 Code Review Lab|Lab 1]]. Blog your work.
 
== Week 2 ==
 
=== Week 2 - Class I ===
 
==== Video ====
* [https://web.microsoftstream.com/video/bcb8d448-84bc-4c36-909f-58bc1ccd1dfe Summary video recording from class]
* [https://web.microsoftstream.com/video/ed7aedf1-fe6f-4b72-bbf1-c9b4e6e80af9 Calculating 6502 Program Execution Time]
* '''Reminder:''' The Wednesday classes are live. An edited recording is provided for reference only - it is no substitute for attending class (via Zoom), taking notes, and asking questions!
 
==== Machine Language, Assembly Language ====
{{Admon/tip|Follow the Links!|To get the full benefit of the following material, please follow the links embedded within it. For additional detail, see the Category links at the bottom of those pages -- for example, the [[Category:Computer Architecture|Computer Architecture]] category linked from many of the following pages has over 30 pages of content.}}
 
* Although we program computers in a variety of languages, they can really only execute one language: [[Machine Language]], which is encoded in an architecture-specific binary code, sometimes called object code.
* Machine language is not easy to read. [[Assembly Language]] corresponds very closely to machine language, but is (sort of!) human-readable.
* Assembly language is converted into machine code by a particular type of compiler called an [[Assembler]] (sometimes the language itself is also referred to as "Assembler").
 
==== 6502 ====
Modern processors are complex - the reference manual for 64-bit ARM processors is over 11000 pages long! - so we're going to look at assembly language on a much simpler processor to get started. This processor is the 6502, a processor used in many early home and personal computers as well as video game systems, including the Commodore PET, VIC-20, C64; the Apple II; the Atari 400 and 800 computers and 2600 video game systems; and many others.
 
* Introduction to the [[6502]] (note the Resources links on that page)
* Introduction to the [[6502 Instructions - Introduction|6502 Instructions]]
* Introduction to the [[6502 Addressing Modes]]
* Information about the [[6502 Emulator]] which we will use in this course, and some [[6502_Emulator_Example_Code|example code]]
* Link to the actual [http://6502.cdot.systems 6502 emulator]
 
==== Lab 2 ====
* [[6502 Assembly Language Lab]] - Lab 2
 
=== Week 2 - Class II ===
 
==== Videos ====
* [https://web.microsoftstream.com/video/792a1653-36a0-4f15-b3fc-36461dbbb969 6502 Jumps, Branches, and Procedures]
* [https://web.microsoftstream.com/video/e0d37bd1-d296-4873-88b3-1d70dc89e9e7 6502 Math]
* [https://web.microsoftstream.com/video/52c0d800-9618-46ac-8a5e-1a5477b5e4f0 Bitwise Operations]
 
=== Reading ===
* [[6502 Jumps, Branches, and Procedures]]
* [[6502 Math]] (including Bitwise Operations)
 
=== Week 2 Deliverables ===
# If not already completed last week:
## Set up your [[SPO600 Communication Tools]]
## Complete [[SPO600 Code Review Lab|Lab 1]] and blog your work.
# Study the [[6502 Instructions - Introduction|6502 Instructions]] and [[6502 Addressing Modes]] and make sure you understand what each one does.
# Complete [[6502 Assembly Language Lab|Lab 2]] and blog your results.
 
== Week 3 ==
 
=== Week 3 - Class I ===
 
==== Video ====
* [https://web.microsoftstream.com/video/a4707dd6-b0df-409b-8168-58ec21a06c1b Summary video from class on 6502 Strings]
==== Lab ====
* [[6502 Math and Strings Lab]] (Lab 3)
 
 
=== Week 3 - Class II ===
 
==== Video ====
* 6502 Assembly Language
** [https://web.microsoftstream.com/video/9caa5e8d-0f15-4b8b-9293-0151c82f77b1 6502 String Input]
** [https://web.microsoftstream.com/video/6a645edd-3537-4910-843c-6d32f6678e79 A 6502 Assembly Hack]
** [https://web.microsoftstream.com/video/1775931c-b9eb-4b2a-a7bd-598d7d725853 6502 Assembly Sample Code]
* 6502 - Additional Resources
** [https://web.microsoftstream.com/video/6a645edd-3537-4910-843c-6d32f6678e79 An old video on the basics of using the 6502 Emulator]
** [https://web.microsoftstream.com/video/f22220d6-9c87-4d23-aaf8-95f681756c41 6502 Assembler Directives] - using "define" and "dcb"
* Building code: make
** [https://web.microsoftstream.com/video/6b83e243-2b82-4afe-848e-e8c26881199a make and Makefiles]
 
==== Resources ====
* [[Make and Makefiles]]
* 6502 Example Code
** [[6502 Emulator Example Code]] page on this wiki
** Chris Tyler's [https://github.com/ctyler/6502js-code/ 6502js-code] repository on GitHub (includes Wordle-like example)
** [http://6502asm.com/ 6502asm.com] - a site with an early version of the 6502 Emulator - see the "Examples" pull-down menu (these examples will run in [[http://6502.cdot.systems|our emulator]]
 
=== Week 3 Deliverables ===
* [[6502 Math and Strings Lab|Lab 3]]
* Note that September blog posts are due at the end of next week, so don't get behind in your blogging
 
 
== Week 4 ==
 
=== Week 4 - Class I ===
 
==== Video ====
* [https://web.microsoftstream.com/video/30fa002e-9e3d-41f6-95db-36832a8a509c Edited Class Summary Video]
 
==== Reading Resources ====
* [[Compiler Optimizations]]
* Connecting to course servers
** [[SPO600 Servers]]
** [[SSH]]
** [[Screen Tutorial|Screen utility]] - allows disconnection/reconnection to remote host
 
=== Week 4 - Class II ===
 
==== Video ====
* [https://web.microsoftstream.com/video/48f2d7a8-67d3-4e49-b02e-a29e7d9b656c Building Code: Compiler Options]
* [https://web.microsoftstream.com/video/38b050c6-6aad-4e64-b564-95ceb53adc7c Building Code: Automake/Autotools (configure scripts)]
 
==== Resouces ====
* [https://www.gnu.org/software/automake/manual/html_node/index.html GNU Autotools/Automake]
* [https://gcc.gnu.org/onlinedocs/ GCC Manual]
 
=== Week 4 Deliverables ===
* September blogs are due this weekend (Sunday, October 2 at 11:59 pm)
 
== Week 5 ==
 
=== Week 5 - Class I ===
 
==== Video ====
* [https://web.microsoftstream.com/video/fe744d30-f947-433d-b9f3-f5284e6fb2ad Class Summary Video]
 
==== Resources ====
* [[Assembly Language]]
* [[ELF]] file format
* [[X86_64 Register and Instruction Quick Start]]
* [[Aarch64 Register and Instruction Quick Start]]
* ARM 64-bit CPU Instruction Set and Software Developer Manuals
* ARM Aarch64 documentation
** [http://developer.arm.com/ ARM Developer Information Centre]
*** [https://developer.arm.com/docs/den0024/latest ARM Cortex-A Series Programmer’s Guide for ARMv8-A]
*** The ''short'' guide to the ARMv8 instruction set: [https://www.element14.com/community/servlet/JiveServlet/previewBody/41836-102-1-229511/ARM.Reference_Manual.pdf ARMv8 Instruction Set Overview] ("ARM ISA Overview")
*** The ''long'' guide to the ARMv8 instruction set: [https://developer.arm.com/docs/ddi0487/latest/arm-architecture-reference-manual-armv8-for-armv8-a-architecture-profile ARM Architecture Reference Manual ARMv8, for ARMv8-A architecture profile] ("ARM ARM")
** [https://developer.arm.com/docs/ihi0055/latest/procedure-call-standard-for-the-arm-64-bit-architecture Procedure Call Standard for the ARM 64-bit Architecture (AArch64)]
* x86_64 Documentation
** [https://developer.amd.com/resources/developer-guides-manuals/ AMD Developer Guide and Manuals](see the AMD64 Architecture section, particularly the ''AMD64 Architecture Programmer’s Manual Volume 3: General Purpose and System Instructions'')
** [http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html Intel Software Developers Manuals]
* GAS Manual - Using as, The GNU Assembler: https://sourceware.org/binutils/docs/as/
 
=== Week 5 - Class II ===
 
==== Video ====
* [https://web.microsoftstream.com/video/1bcab47b-514a-4f23-bdd4-f73662a0673f Paged Memory Systems]
* [https://web.microsoftstream.com/video/880fb0f8-1084-457a-92e0-80f04ad62463 Memory Alignment and Performance]
 
==== Lab 4 ====
* [[SPO600 64-bit Assembly Language Lab]] (Lab 4)
 
=== Week 5 Deliverables ===
* [[SPO600 64-bit Assembly Language Lab|Lab 4]]
 
 
== Week 6 ==
 
=== Week 6 - Class I ===
 
We used this class for introductions, a discussion of how things are going, and feedback on the course.
 
=== Week 6 - Class II ===
 
==== Video ====
* [https://web.microsoftstream.com/video/d208a737-7777-4b5a-b276-1b19dc78145c Inline Assembly Language] - Inserting assembly language code into programs written in other languages (in this case, C)
* [https://web.microsoftstream.com/video/f60b92c6-9db3-4f57-b0b9-7c35ea0c054f Single Instruction, Multiple Data (SIMD)]
* [https://web.microsoftstream.com/video/2a82da88-bf5b-4112-953a-7408fbab30c1 Algorithm Selection and Benchmarking]
 
==== Lab 5 ====
* [https://wiki.cdot.senecacollege.ca/wiki/SPO600_Algorithm_Selection_Lab Algorithm Selection Lab] (Lab 5)
 
 
=== Week 6 Deliverables ===
* [https://wiki.cdot.senecacollege.ca/wiki/SPO600_Algorithm_Selection_Lab Lab 5]
 
 
== Week 7 ==
 
=== Week 7 - Class I ===
 
==== Video ====
* Video summary will be posted after editing
 
=== Week 7 - Class II ===
 
'''Please catch up on course material to this point. If you are fully caught up, you can start to take a look at SVE2:'''
 
==== Reading ====
* [[SVE2]]
 
==== 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 with strucure loads.
*# An implementation using inline assembler for SVE2 with an interleaved factor table.
*# 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 four versions of the binary -- one using each of the four implementations -- 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[1234][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 7 Deliverables ===
* Complete [[SPO600 64-bit Assembly Language Lab|Lab 4]] and [https://wiki.cdot.senecacollege.ca/wiki/SPO600_Algorithm_Selection_Lab Lab 5]
* Remember that October blogs are due soon.
 
== Week 8 ==
 
=== Week 8 - Class I ===
 
==== Video ====
* [https://web.microsoftstream.com/video/f67c0185-fc67-43fb-ac39-57cae26792a8 SIMD - Edited Summary Video]
 
=== Week 8 - Class II ===
 
==== Video ====
* [https://web.microsoftstream.com/video/a6b892e4-b408-4bc7-9fc1-d78e4efb8e0e SVE & SVE2 - Edited Summary Video]
 
==== Reading ====
* [[SVE2]]
 
==== SVE2 Demonstration ====
* Code available here: https://github.com/ctyler/sve2-test
** You can clone this to israel.cdot.systems with: <code>git clone https://github.com/ctyler/sve2-test.git</code>
* 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 with strucure loads.
*# An implementation using inline assembler for SVE2 with an interleaved factor table.
*# 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 four versions of the binary -- one using each of the four implementations -- 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[1234][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 8 Deliverables ===
* Continue your blogging
* Include blogging on SVE/SVE
* The second group of blog posts is due on or before this Sunday (November 6, 11:59 pm)
 
== Week 9 ==
 
=== Week 9 - Class I ===
 
==== Video ====
* Will be posted after editing
 
==== iFunc ====
 
GNU iFunc is a facility for handling indirect functions. The basic premise is that you prototype the function to be called, add the <code>ifunc</code> attribute to that prototype, and provide the name of a resolver function. The resolver function is called at program initialization, and returns a pointer to the function to be executed when the function referenced in the prototype is called. The resolver typically picks one of several implementations based on the capabilities of the machine on which the code is running; for example, it could return a pointer to a non-SVE, SVE, or SVE2 implementation of a function based on cpu capabilities (on an Aarch64 system) or it could return a pointer to an SSE, SSE2, AVX, or AVX512 implementation (on an x86_64 system).
 
There is a [https://github.com/ctyler/ifunc-aarch64-demo GitHub repository] available with example iFunc code -- please clone this to [[SPO600 Servers#AArch64:_israel.cdot.systems|israel.cdot.systems]] and build and test the code there. You should see different results if you run the output executable directly (<code>./ifunc-test</code>) and run it through the qemu-aarch64 tool, which will emultate SVE2 capabilities (<code>qemu-aarch64 ./ifunc-test</code>). Make sure you understand how the code works.
 
==== Reading/Resources ====
 
* [https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/Common-Function-Attributes.html#index-ifunc-function-attribute GNU iFunc attribute in GCC manual]
* [https://sourceware.org/glibc/wiki/GNU_IFUNC iFunc on the glibc wiki]
 
=== Week 9 - Class II ===
 
==== Video ====
* [https://web.microsoftstream.com/video/edc09b0a-1a7f-45d1-a27e-7f4901bba03d Edited summary video] - '''Important!''' This video contains a detailed discussion of the requirements for the course project.
** Project discussion starts at beginning of video
** Demo of what the project needs to do (manually performing the same steps) starts at 0:27:47
** Recap/summary of the demo starts around 1:02:05
 
==== Project ====
* [[Fall 2022 SPO600 Project]]
 
=== Week 9 Deliverables ===
* Investigate the iFunc example code
* Blog about your investigation
* Start blogging about your project
<!-- Memory System Design - Paging ; Memory - Cache/Numa ; Memory - Observability, Barriers -->
<!--
 
#############################################
#############################################
*** [[Endian|Endianness]]
** Code that takes advantage of platform-specific features
* Reasons for writing code in Assembly Langauge == Week 2 == === Week 2 - Class I === ==== Video ====* [https://web.microsoftstream.com/video/cf653b70-1000-4dbe-a45f-184625eb45c1 Summary video recording from class]* '''Reminder:''' The Tuesday classes are live. An edited recording is provided for reference only - it is no substitute for attending class, taking notes, and asking questions! ==== Machine Language, Assembly Language ===={{Admon/tip|Follow the Links!|To get the full benefit of the following material, please follow the links embedded within it. For additional detail, see the Category links at the bottom of those pages -- for example, the [[Category:Computer Architecture|Computer Architecture]] category linked from many of the following pages has over 30 pages of content.}} * Although we program computers in a variety of languages, they can really only execute one language: [[Machine Language]], which is encoded in an architecture-specific binary code, sometimes called object code.* Machine language is not easy to read. [[Assembly Language]] corresponds very closely to machine language, but is (sort of!) human-readable.* Assembly language is converted into machine code by a particular type of compiler called an [[Assembler]] (sometimes the language itself is also referred to as "Assembler"). ==== 6502 ====Modern processors are complex - the reference manual for 64-bit ARM processors is over 7000 pages long! - so we 're going to look at assembly language on a much simpler processor to get started. This processor is the 6502. * Introduction to the [[6502]] (note the Resources links on that page)* Introduction to the [[6502 Instructions - Introduction|6502 Instructions]]* Information about the [[6502 Emulator]] which we will use in this course, and some [[6502_Emulator_Example_Code|example code]]* Link to the actual [http://6502.cdot.systems 6502 emulator] === Week 2 - Class II === ==== Videos ====* [https://web.microsoftstream.com/video/1e70e6a8-0fff-40de-b0e3-1297442572b8 Week 2 Announcements]* [https://web.microsoftstream.com/video/01d6cae5-e490-40fd-85a1-2000025fdb68 6502 Emulator and Debugger]* [https://web.microsoftstream.com/video/ed7aedf1-fe6f-4b72-bbf1-c9b4e6e80af9 Calculating 6502 Program Execution Time] ==== Lab 2 ====* [[6502 Assembly Language Lab]] - Lab 2 === Week 2 Deliverables ===# If not already completed:## Set up your [[SPO600 Communication Tools]]## Complete [[SPO600 Code Review Lab|Lab 1]] and blog your work.# Study the [[6502 Instructions - Introduction|6502 Instructions]] and make sure you understand what each one does# Complete [[6502 Assembly Language Lab|Lab 2]] and blog your resultsy Language include:
** Performance
** [[Atomic Operation|Atomic Operations]]
===== Build Process =====
Building software is a complex task that many developers gloss over. The simple act of compiling a program invokes a process with five or more stages, including pre-proccessingprocessing, compiling, optimizing, assembling, and linking. However, a complex software system will have hundreds or even thousands of source files, as well as dozens or hundreds of build configuration options, auto configuration scripts (cmake, autotools), build scripts (such as Makefiles) to coordinate the process, test suites, and more.
The build process varies significantly between software packages. Most software distribution projects (including Linux distributions such as Ubuntu and Fedora) use a packaging system that further wraps the build process in a standardized script format, so that different software packages can be built using a consistent process.
*** 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 as an analog electical electrical value, we could use a voltage from 0 - 5 volts. However, if we use a long cable, there will be signal loss and the voltage will drop: we could apply 5 volts on one end of the cable, but only observe (say) 4.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 volts == on == "1", a signal that had degraded from 5 volts to 4.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
* Compression techniques
** Huffman encoding / Adaptive arithmetic encoding
*** Instead of fixed-length numbers, == Week 2 == === Week 2 - Class I === ==== Video ====* [https://web.microsoftstream.com/video/cf653b70-1000-4dbe-a45f-184625eb45c1 Summary video recording from class]* '''Reminder:''' The Tuesday classes are live. An edited recording is provided for reference only - it is no substitute for attending class, taking notes, and asking questions! ==== Machine Language, Assembly Language ===={{Admon/tip|Follow the Links!|To get the full benefit of the following material, please follow the links embedded within it. For additional detail, see the Category links at the bottom of those pages -- for example, the [[Category:Computer Architecture|Computer Architecture]] category linked from many of the following pages has over 30 pages of content.}} * Although we program computers in a variety of languages, they can really only execute one language: [[Machine Language]], which is encoded in an architecture-specific binary code, sometimes called object code.* Machine language is not easy to read. [[Assembly Language]] corresponds very closely to machine language, but is (sort of!) human-readable.* Assembly language is converted into machine code by a particular type of compiler called an [[Assembler]] (sometimes the language itself is also referred to as "Assembler"). ==== 6502 ====Modern processors are complex - the reference manual for 64-bit ARM processors is over 7000 pages long! - so we 're going to look at assembly language on a much simpler processor to get started. This processor is the 6502. * Introduction to the [[6502]] (note the Resources links on that page)* Introduction to the [[6502 Instructions - Introduction|6502 Instructions]]* Information about the [[6502 Emulator]] which we will use in this course, and some [[6502_Emulator_Example_Code|example code]]* Link to the actual [http://6502.cdot.systems 6502 emulator] === Week 2 - Class II === ==== Videos ====* [https://web.microsoftstream.com/video/1e70e6a8-0fff-40de-b0e3-1297442572b8 Week 2 Announcements]* [https://web.microsoftstream.com/video/01d6cae5-e490-40fd-85a1-2000025fdb68 6502 Emulator and Debugger]* [https://web.microsoftstream.com/video/ed7aedf1-fe6f-4b72-bbf1-c9b4e6e80af9 Calculating 6502 Program Execution Time] ==== Lab 2 ====* [[6502 Assembly Language Lab]] - Lab 2 === Week 2 Deliverables ===# If not already completed:## Set up your [[SPO600 Communication Tools]]## Complete [[SPO600 Code Review Lab|Lab 1]] and blog your work.# Study the [[6502 Instructions - Introduction|6502 Instructions]] and make sure you understand what each one does# Complete [[6502 Assembly Language Lab|Lab 2]] and blog your results variable-length numbers are used, with the most common values encoded in the smallest number of bits. This is an effective strategy if the distribution of values in the data set is uneven.
** Repeated sequence encoding (1D, 2D, 3D)
*** Run length encoding is an encoding scheme that records the number of repeated values. For example, fax messages are encoded as a series of numbers representing the number of white pixels, then the number of black pixels, then white pixels, then black pixels, alternating to the end of each line. These numbers are then represented with adaptive artithmetic arithmetic encoding.
*** Text data can be compressed by building a dictionary of common sequences, which may represent words or complete phrases, where each entry in the dictionary is numbered. The compressed data contains the dictionary plus a sequence of numbers which represent the occurrence of the sequences in the original text. On standard text, this typically enables 10:1 compression.
** Decomposition
*** Compound audio wavforms waveforms can be decomposed into individual signals, which can then be modelled as repeated sequences. For example, a waveform consisting of two notes being played at different frequencies can be decomposed into those separate notes; since each note consists of a number of repetitions of a particular wave pattern, they can individually be represented in a more compact format by describing the frequency, waveform shape, and amplitude characteristics.
** Palletization
*** Images often contain repeated colours, and rarely use all of the available colours in the original encoding scheme. For example, a 1920x1080 "full HD" image contains about 2 million pixels, so if every pixel was a different colour, there would be a maximum of 2 million colours. But it's likely that many of the pixels in the image are the same colour, so there might only be (perhaps) 4000 colours in the image. If each pixel is encoded as a 24-bit value, there are potentially 16 million colours available, and there is no possibility that they are all used. Instead, a palette can be provided which specifies each of the 4000 colours used in the picture, and then each pixel can be encoded as a 12-bit number which selects one of the colours from the palette. The total storage requirement for the original 24-bit scheme is 1920*1080*3 bytes per pixel = 5.9 MB. Using a 12-bit pallette, the storage requirement is 3 * 4096 bytes for the palette plus 1920*1080*1.5 bytes for the image, for a total of 3 MB -- a reduction of almost 50%
{{Admon/tip|Follow the Links!|To get the full benefit of the following material, please follow the links embedded within it. For additional detail, see the Category links at the bottom of those pages -- for example, the [[Category:Computer Architecture|Computer Architecture]] category linked from many of the following pages has over 30 pages of content.}}
* Although we program computers in a variety of languages, they can really only execute one langaugelanguage: [[Machine Language]], which is encoded in an architecture-specific binary code, sometimes called object code.
* Machine language is not easy to read. [[Assembly Language]] corresponds very closely to machine language, but is (sort of!) human-readable.
* Assembly language is converted into machine code by a particular type of compiler called an [[Assembler]] (sometimes the language itself is also referred to as "Assembler").
==== 6502 ====
Modern processors are complex - the reference manual for 64-bit ARM processors is over 7000 pages long! - so we 're going to look at assembly lanaguage language on a much simpler processor to get started. This processor is the 6502.
* Introduction to the [[6502]] (note the Resources links on that page)
* Introduction to the [[6502 Instructions - Introduction|6502 Instructions]]
* Information about the [[6502 Emulator]] which we will use in this course, and some [[6502_Emulator_Example_Code|example code]]
* Link to the actual [http://6502.cdot.system systems 6502 emulator]
=== Week 2 - Class II ===
* 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 SVE2with strucure loads.*# An implementation using inline assembler for SVE2 with an interleaved factor table.*# (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 four versions of the binary, -- one using implementation 1 (named <code>image_adjust1</code>) and one using implementation 2 (named <code>image_adjust2</code>), each of the four implementations -- 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[121234][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!
###############################################
-->
 
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>

Navigation menu