COMP 412, Fall 2024
Lab 2: Local Register Allocation
Table of Contents Critical Dates for the Project
1. Introduction 1 Code Due Date 10/23/2024
2. Overview of the Problem 2 Code Check #1 Due 10/04/2024
3. Code Specifications 3 Code Check #2 Due 10/16/2024
5. Submitting Your Code 5
6. Grading Rubric & Honor Policy 6
Please report suspected typographical
errors to the instructors via a message on
the class Piazza site.
7. Honor Policy 7
A. ILOC Simulator & Subset 8
B. Tools 10
C. Timing Results from Prior Years 11
D. Checklist for Lab 2 13
1. Introduction
In this programming assignment you will build a local register allocator—that is, a program that
reads in a single block of ILOC code, transforms that block so that it uses a specified number of
registers, and writes the transformed block out to the standard output stream. The input and
output blocks are both written in the ILOC subset used in Lab 1. Section A.1 of this document
describes the ILOC subset and its simulator.
For the purposes of this lab, an input program and an output program are considered
equivalent if and only if they print the same values in the same order to stdout and
each data-memory location defined by an execution of the input program receives the
same value when the output program executes.
The output program may define additional memory locations that are not defined by
the input program. In particular, it will define and use new locations to hold values that
it decides to spill from registers to memory.
The input blocks receive data in one of two ways. Either the values are is hard-coded into the
block, or they are specified on the simulator’s command line using the -i command-line option.
The concepts and algorithms behind register allocation are explained in two distinct places.
First, there are a series of short videos available on the course Canvas Site. You should watch
each of these videos. Second, Chapter 13 in the textbook explains register allocation in depth.
Sections 13.1 and 13.2 provide background and Section 13.3 presents, in detail, the algorithms
that pertain to Lab 2. You should read this material. An excerpt from Section 13.3 is posted on
Canvas. (The later sections of Chapter 13 describe global allocation, the more complex problem
that arises when the allocator looks at code that includes control-flow operations.)
Lab 2: Local Register Allocation Version 2024-1
COMP 412 2 Fall 2024
This document describes the specifications for your program, the policies for the lab, the
various logistics associated with the lab, the process for submitting the lab, and the grading
rubric. The document is long, but you should read it to ensure that you understand what is
expected of your lab and what tools are available to help.
2. Overview of the Problem
A register allocator is a compiler pass that transforms a version of the program that uses an
arbitrary number of registers into a version that uses a specified number of registers. That is,
the input program might be written to use seventy-three registers and the output program can
only use the number of registers available for application use on the target machine.
The number of registers available for the output program is a parameter, called k, that is passed
into the allocator on the command line. When invoked with a command line, such as
./412alloc 17 ~comp412/students/ILOC/SLOCs/T001k.1
The allocator should read the file, ~comp412/students/ILOC/SLOCs/T001k.i, determine if it is a
valid ILOC block, and produce an equivalent block that uses at most 17 registers.
To transform the program, the register allocator reads through the operations in the block and
makes, at each operation, a decision as to which values should remain in registers and which
values should be relegated to storage in memory. It inserts stores (spills) and loads (restores) as
necessary to ensure that the values are in the right places. It rewrites the code to use the
names of the actual hardware registers (r0 through r16 for the example command line).
Your allocator may not apply optimizations other than register allocation. All the loads, stores,
and arithmetic operations that appear in the input program must appear in the output
program, in the same relative order.
1
The output block must perform the original computation;
it cannot pre-compute the results. Allocators that perform optimizations other than register
allocation will lose substantial credit. Of course, the output block may use different register
names than the input block.
Your allocator may remove nops; they have no effect on the equivalence of the input and
output of programs. If your allocator performs rematerialization (see the Lab 2 Performance
Lecture), then it may move loadI operations around in ways that cannot happen with a load or
a store. Finally, your allocator must not perform optimizations based on the input constants
specified in ILOC test block comments; the autograder may use different input values to test
your code.
To evaluate your submission, we will use an autograder — a fairly-straightforward python
program that will unpack your submission, perform any actions needed to build the executable,
and test your executable against a series of test blocks. We will provide a distribution of the
autograder so that you can verify that your submission works with the autograder. The
production autograder will use additional files, not available in the distributed autograder, to
assess your submission.
1
We say “relative order” because the allocator may insert spills and/or restores between any two
operations in the original program. Lab 2: Local Register Allocation Version 2024-1
COMP 412 3 Fall 2024
3. Code Specifications
Your allocator must adhere to the following specifications.
• Name: The executable version of your allocator must be named 412alloc.
• Behavior: Your allocator must work in following three modes:
412alloc -h When passed the -h flag, 412alloc must print a list of the valid commandline
arguments that it accepts, along with a concise explanation for that option. That list
should include the arguments described in this table, as well as any others that your
allocator supports. After printing the message, 412alloc should sto.
412alloc -x <name> The -x flag will only be used for Code Check 1. Again, <name>
is a Linux pathname. With this flag, 412alloc should scan and parse the input block. It
should then perform renaming on the code in the input block and print the results to
the standard output stream (stdout). lab2_ref does not implement the -x flag.
412alloc k <name> In this format, k is the number of registers available to the
allocator (3 ≤ k ≤ 64) and <name> is a Linux pathname to the file containing the input
block. The pathname can be either a relative pathname or an absolute pathname.
If k is outside the valid range or it cannot open the file specified by <name>, 412alloc
should print a reasonable error message and exit cleanly (e.g., no backtrace).
If the parameters are valid, 412alloc should scan parse, and allocate the code in the
input block so that it uses only registers r0 to rk-1 and print the resulting code to the
standard output stream (stdout).
In each mode, 412alloc should check the input parameters and report any problems on the
standard error stream (stderr). All error messages should be printed to the standard error
stream (stderr). Normal output should be printed to the standard output stream (stdout).
• Input File: The input file will consist of a sequence of ILOC operations (a block) in the subset
described in § A. If 412alloc cannot read the input file, or the code in the file is not valid
ILOC, it should write an error message to the standard error file (stderr). 412alloc should
detect as many errors in the file as it can before quitting.
If the ILOC code in the input block uses a value from a register that has no prior definition,
your allocator should handle the situation gracefully.
Scanning and Parsing: Your register allocator should use your front end from Lab 1 to read
and parse the input file. The front end should be prepared to handle large input files, such
as the file T128k.i from Lab 1 (also found in ~comp412/students/ILOC/Scalability/SLOCs/).
Makefile & Shell Script: As in Lab 1, you will submit a tar archive file that contains the
source code for your allocator, along with any scripts or Makefiles required to create and
execute the final code.2
For a Java lab, you must submit the code, not a jar file.
2
If you prefer to use another build manager (available on CLEAR), invoke that build manager in your Makefile. Your
build manager should not leave behind a repository— particularly hidden files in comp412’s home directory. Lab 2: Local Register Allocation Version 2024-1
COMP 412 4 Fall 2024
Lab 2 submissions written in languages that require a compilation step, such as C, C++, or
Java, must include a Makefile. The autograder will invoke make with the two commands:
make clean
make build
in that order. The clean target should remove any files from old attempts to build the
executable. The build target should ensure that the 412alloc executable is ready to run. If
your submission is written in a language that does not require compilation, such as python,
then it does not need a Makefile.
If your submission does not create a standalone executable named 412alloc, then it should
include a shell script named 412alloc that accepts the required command-line arguments
and passes them to the program. For example, a project written in python3
named lab2.py
could provide an shell script named 412alloc that includes the following instructions:
#!/bin/bash
python3 lab2.py $@
To invoke python2, you would use the command “python2” rather than “python3”.
Similarly, a project written in Java with a jar file named lab2.jar or a class named lab2.class
that contains the main function could provide, respectively, one of the following two
executable shell scripts, naming it 412alloc.
#!/bin/bash #!/bin/bash
java -jar lab2.jar $@ java lab2 $@
To ensure that your 412alloc shell script is executable on a Linux system, execute the
following command in the CLEAR directory where your 412alloc shell script resides:
chmod a+x 412alloc
To avoid problems related to the translation of carriage return and line feed between
Windows and Linux, we strongly recommend that you write your shell script and Makefile
on CLEAR rather than on a Windows system (see also man dos2unix).
• README: Your submission must include a file named README (uppercase letters, no suffix)
that provides directions for building and invoking your allocator. Include a description of all
command-line arguments required for Lab 2 as well as any additional command-line
arguments that your allocator supports. The autograder expects that the first two lines of
your README file are in the following format:
//NAME: <your name>
//NETID: <your netid>
Note that there are no spaces after the slashes, and that the keywords NAME and NETID
are in all capital letters. Your name should be capitalized normally. Your netid should be
lowercase characters and numbers.
3 Alternatively, you can write a python program that runs directly. As an example, see the lab 1 testing script on
CLEAR. Its first line is a comment that tells the shell to invoke python; the main routine parses argv and argc. Lab 2: Local Register Allocation Version 2024-1
COMP 412 5 Fall 2024
• Programming Language: You may use any programming language provided on Rice’s CLEAR
facility, except for Perl. Your goal should be to use a language that is available on CLEAR, in
which you are comfortable programming, for which you have decent debugging tools, and
that allows you to easily reuse code in Lab 3. When coding, be sure to target the version of
your chosen programming language that is available on CLEAR.
• USE CLEAR: Your submission must work on CLEAR. If the code must be translated (e.g.,
compiled, linked, turned into a jar or an a.out), that must happen on CLEAR. Test the code
on CLEAR; test it in the distributed autograder. Students have, in previous years, found
differences between language and library versions on their laptops and on CLEAR.
4. Code Checks
Lab 2 has two intermediate code checks. To pass a code check, you should run the appropriate
script (see below) and submit a screen shot to the code check assignment on Canvas. The code
checks are intended to keep your progress on track, time wise. You get full credit at the due
date, half credit two days late, and no credit beyond two days late. Grace days do not apply.
(The grading rubric is discussed in § 5.)
Code Check #1: The due date for code check #1 is shown on page 1. To pass code check #1,
412alloc must correctly scan, parse, perform register renaming, and print the resulting
renamed ILOC block to stdout. The code check #1 script and test blocks are located on
CLEAR in the directory ~comp412/students/lab2/code_check_1/.
Code Check #2: The due date for code check #2 is shown on page 1. To pass code check #2,
412alloc must correctly perform register allocation on a limited set of test blocks. (That is,
the allocated code must produce the correct answers when run with only k registers on the
ILOC simulator.) The code check #2 script and the test blocks are found in
~comp412/students/lab2/code_check_2/.
The code check directories on CLEAR contain a README file that describes how to invoke the
code check script and interpret the results. As before, you may need an executable shell script
that to conform to the interface. A working Makefile is not critical for the code checks, but we
recommend that you create your Makefile or script before the first code check and use it while
developing your code.
5. Submitting Your Final Code
Due date: The due date for your code submission is shown on page 1. All work is due at
11:59PM on the specified day. Individual extensions to this deadline will not be granted.
Early-Submission Bonus: Submissions received before the due date will receive a bonus of one
semester point (1% of the final course grade).
Late Penalty: Submissions received after the due date will receive a penalty of one semester
point (1% of the final course grade). No code will be accepted after the date when the next
project is made available. Lab 2: Local Register Allocation Version 2024-1
COMP 412 6 Fall 2024
Grace Days: To cover situations that inevitably arise, we will waive up to four days of late
penalties per semester when computing your final COMP 412 grade. Note that we choose
where those days apply, after all grades are complete. We will apply these “grace” days in a
way that maximizes benefit to you.
Submission Details: To submit your work, you must create a tar archive that contains your
submission, including (1) the source code for the register allocator, (2) the Makefile and/or
shell script, (3) the README file, and (4) any other files that are needed for the autograder to
build and test your code. The tar file should unpack into the current working directory. The
README, Makefile, and executable script, if any, must reside in that top-level directory.
The document “NoteOnTarFiles.pdf”, available on the COMP 412 Canvas Site, provides more
details about the structure of the submission file system and the tar archive. You can test
your archive using the autograder. If your archive does not work with the autograder, that
will reduce the points you receive in the conformance portion of the grading rubric.
If your allocator does not work, include in your tar file a file named STATUS that contains a
brief description of its current state. You may include ILOC files that your lab handles
correctly and ILOC files that it handles incorrectly. List those file names in the STATUS file.
Name the tar file with your Rice netid (e.g., if your netid is jed12, you would name the
archive jed12.tar). To submit your tar file, move it to CLEAR and execute the command
~comp412/bin/submit_2 <tar file name>
The submit_2 script will create a copy of your tar archive, timestamp it, and send an email
confirmation to you and to the comp412 email account (for record-keeping). You should
keep the tar archive until the end of the semester to record what you submitted.
6. Grading Rubric
The Lab 2 grade accounts for 20% of your final COMP 412 grade. The code rubric is based on
100 points, allocated as follows. Correctness and cycle count will be determined using the Lab 2
ILOC simulator.
• 10 points for passing code check #1 by its due date (see table on page 1). 5 points will be
awarded for passing code check #1 within three days of the due date. No points for code
check #1 will be awarded after that time. Grace days do not apply to this deadline.
• 10 points for passing code check #2 by its due date (see table on page 1). 5 points will be
awarded for passing code check #2 within three days of the due date. No points for code
check #2 will be awarded after that time. Grace days do not apply do this deadline.
• 10 points for conformance to the Lab 2 code specifications and submission requirements.
• 30 points for correctness of the allocated code produced by the final submission. Here,
correctness means that running the allocated code produces the correct answer.
• 20 points for effectiveness, measured as the number of cycles required to run the
allocated code produced by your final submission on the Lab 2 ILOC simulator. An
allocator that gets within 10% of the cycle counts for lab2_ref will receive full credit for Lab 2: Local Register Allocation Version 2024-1
COMP 412 7 Fall 2024
effectiveness. You can use the spreadsheet Lab2SpreadSheet.xlsx, in the lab 2
documents folder, to estimate effectiveness on the report blocks. The report blocks are a
subset of the blocks used to grade your allocator.
• 20 points for performance, split equally between scalability and efficiency. The autotimer
measures performance using blocks from ~comp412/students/ILOC/Scalability/SLOCs.
The autotimer is included with the distributed autograder.
Scalability: The register allocator should display linear scaling — that is, a doubling of the
input size should produce growth of no more than 2x in the runtime. You can see this by
plotting runtime as a function of non-comment lines in the input file; do not use a
logarithmic scale on either axis.
Efficiency: The table below shows the measured runtime on block T128k.i required for full
credit and the time that will produce zero credit. Runtimes between full credit and zero
credit will receive partial credit, on a linear scale between the breakpoints. The specific
breakpoints were determined by analyzing the lab 2 submissions from the Fall 2020 class.
Language Full Credit No Credit
C £ 1.0 second ³ 2.0 seconds
C++ £ 2.0 second ³ 4.0 seconds
Java £ 4.75 seconds ³ 12.0 seconds
Python £ 8.0 seconds ³ 20.0 seconds
Go £ 1.0 second ³ 2.0 seconds
For languages not shown in the table, the instructor will determine a set of breakpoints
based on the language, its implementation, and, perhaps, some additional testing.
7. Honor Policy
Your submitted source code and README file must consist of code and/or text that you wrote,
not edited or copied versions of code and/or text written by others or in collaboration with
others. You may not look at COMP 412 code from past semesters. Your submitted code may
not invoke the COMP 412 reference allocator, or any other allocator that you did not write.
You are free to collaborate with current COMP 412 students when preparing your Makefile
and/or shell script and to submit the results of your collaborative Makefile and/or shell script
efforts. However, as indicated in the previous paragraph, all other Lab 2 code and text
submitted must be your own work, not the result of a collaborative effort. You may not use
tools based on generative AI to assist you in creating the code for your allocator.
You are welcome to discuss Lab 2 with the COMP 412 staff and with students currently taking
COMP 412. You are also encouraged to use the archive of test blocks produced by students in
previous semesters. However, we ask that you not make your COMP 412 labs available to Lab 2: Local Register Allocation Version 2024-1
COMP 412 8 Fall 2024
students (other than COMP 412 TAs) in any form during or after this semester. We ask that you
not place your code anywhere on the Internet that is viewable by others.
Appendix A. ILOC Simulator & Subset
ILOC Simulator: An ILOC simulator, its source, and documentation are available in the subtree
under ~comp412/students/lab2 on CLEAR. The source code and documentation are available.
If you need to build a private copy of the simulator, § 7.1 of the simulator documentation
explains the various configuration options.
The simulator builds and executes on CLEAR. You can either run the simulator from comp412’s
directory or copy it into your local directory. You can build a copy to run on your laptop. It
appears to work on other OS implementations but that is not guaranteed. Your allocator will be
tested and graded on CLEAR, so you should be sure to test it on CLEAR.
ILOC Subset: Lab 2 input and output files consist of a single basic block4 of code written in a
subset of ILOC, detailed in the following table. ILOC is case-sensitive.
Syntax Meaning Latency
load r1 => r2 r2 ß MEM(r1) 3
loadI x => r2 r2 ß x 1
store r1 => r2 MEM(r2) ß r1 3
add r1, r2 => r3 r3 ß r1 + r2 1
sub r1, r2 => r3 r3 ß r1 - r2 1
mult r1, r2 => r3 r3 ß r1 * r2 1
lshift r1, r2 => r3 r3 ß r1 << r2 1
rshift r1, r2 => r3 r3 ß r1 >> r2 1
output x prints MEM(x) to stdout 1
nop idle for one cycle 1
All register names have an initial lowercase r followed immediately by a non-negative integer.
Leading zeros in the register name are not significant; thus, r017 and r17 refer to the same
register. Arguments that do not begin with r, which appear as x in the table above, are assumed
to be non-negative integer constants in the range 0 to 231 – 1. The assignment arrow is
composed of an equal sign followed by a greater than symbol, as shown (=>).
Each ILOC operation in an input block must begin on a new line and be completely contained on
that line.
5
Whitespace is defined to be any combination of blanks and tabs. ILOC opcodes must
4
A basic block is a maximal length sequence of straight-line (i.e., branch-free) code. We use the terms block and
basic block interchangeably when the meaning is clear. 5
Both Carriage returns (CR, \r, 0x0D) and line feeds (LF, \n, 0x0A) may appear as in end-of-line sequences. Lab 2: Local Register Allocation Version 2024-1
COMP 412 9 Fall 2024
be followed by whitespace. Whitespace preceding and following all other symbols is optional.
Whitespace is not allowed within operation names, register names, or the assignment arrow. A
double slash (//) indicates that the rest of the line is a comment and can be discarded. Empty
lines and nops in input files may also be discarded.
Memory Use in the ILOC Simulator: The ILOC simulator has separate address spaces for code
and data. The code memory is not accessible to a running ILOC program; this unreasonable
restriction avoids a class of errors in the allocated code that are quite difficult to debug.
The simulator only supports word-aligned accesses—that is, the address must be evenly
divisible by four. For this assignment, addresses above 32,767 are reserved for the register
allocator to use as spill locations. Any values that an ILOC test block stores to memory (other
than spills) must use an address between 0 and 32,764, inclusive.
For more details, see the ILOC Simulator document, in ~comp412/students/lab2/simulator/ on
CLEAR.
Simulator Usage Example: If test1.i is in your present working directory, you can invoke the
simulator on test1.i in the following manner to test your register allocator:
/clear/courses/comp412/students/lab2/sim -r 5 -i 2048 1 2 3 < test1.i
This command will cause the simulator to execute the instructions in test1.i, print the values
corresponding to ILOC output instructions, and display the total number of cycles, operations,
and instructions executed.
The -r parameter is optional and restricts the number of registers the simulator will use. (In the
example, the simulator only uses 5 registers, named r0, r1, r2, r3, and r4.). You can use the –r
parameter to verify that code generated by your allocator uses at most k registers. You should
not use -r when running the original (non-transformed) report and timing blocks.
The -i parameter is used to fill memory, starting at the memory address indicated by the first
argument that appears after -i, with the initial values listed after the memory address. The load
and store operations available in the ILOC subset require word-aligned addresses (that is,
addresses must be evenly divisible by 4). The example command line shown above initializes
location 2048 to 1, location 2052 to 2, and location 2056 to 3. (If the first operation in block
test1.i is "output 2048", the simulator will print the value 1 to stdout.) When computing
addresses for new spill locations, your allocator must generate word-aligned addresses.
The simulator’s -x parameter will be used to verify that your allocator passes the Lab 2 code
check. For example, if your 412alloc implementation produces a file of renamed ILOC code
called renamed_block.i, the following command can be used to check whether renaming was
correctly performed:
/clear/courses/comp412/students/lab2/sim -x < renamed_block.i
See the ILOC simulator document for additional information about supported command-line
options. (Note that the command-line options -d, -s, and -c are not relevant for Lab 2.)
Lab 2: Local Register Allocation Version 2024-1
COMP 412 10 Fall 2024
ILOC Input Blocks: A large collection of ILOC input blocks is available on CLEAR, in the directory
~comp412/students/ILOC/. Each block has the //SIM INPUT: and //OUTPUT: specifications to
allow the various testing scripts to check for correctness. If you experience problems with the
input blocks, please submit bug reports to the course Piazza site.
To estimate your allocator’s performance, you may want to use the report blocks, which are
available on CLEAR in ~comp412/students/lab2/report/. The report blocks all appear in the
production autograder’s test suite. The autotimer uses a subset of the blocks found on CLEAR in
~comp412/students/ILOC/Scalability/SLOCs/.
B. Tools
B.1 Reference Allocator
To help you understand the functioning of a local register allocator and to provide an exemplar
for your implementation and debugging efforts, we provide a reference allocator, lab2_ref. The
reference allocator is a C implementation of the allocator. It follows the basic outline of the
algorithm presented in class; it pays careful attention to how it generates spill code. You can
improve your understanding of register allocation by examining its output on small blocks. The
output code includes comments that are intended to help you understand what it did.
The reference allocator is an example. You do not need to duplicate its behavior, its results, or
the allocations that it produces.
You can use the reference allocator to determine how well your allocator performs in terms of
effectiveness (the number of execution cycles that the simulator reports when it runs the code
that your allocator generates) and efficiency (the runtime of your allocator itself).
The COMP 412 reference allocator can be invoked on CLEAR as follows:
~comp412/students/lab2/lab2_ref k <name>
where k is an integer (3 £ k £ 64) that specifies the number of registers available to the
allocator and <name> is a valid Linux pathname relative to the current working directory that
names an input file. For a description of the complete set of flags supported by the COMP 412
reference allocator, enter the following command on CLEAR:
~comp412/students/lab2/lab2_ref –h
Note that the COMP 412 reference allocator can only be run on CLEAR.
B.2 Testing and Timing Scripts
Scripts to test your allocator’s correctness and efficiency are available on CLEAR in the directory
~comp412/students/lab2/. Directions are provided in the related README files.
Lab 2: Local Register Allocation Version 2024-1
COMP 412 11 Fall 2024
C. Timing Results from Prior Years
The graphs below show the timing results for the fastest implementation written in each of C,
C++, Java, Python, and Go, from Fall 2021. In addition, we include graphs for Ruby (2014),
OCaml (2015), Haskell (2015), and R (2014). These graphs should provide you with a reasonable
notion of what kind of efficiency a student can achieve in the allocator project.
Note the units on the vertical axes of the graphs. They change significantly between languages.
D. Checklist for Lab 2
The following high-level checklist is provided to help you track your progress on Lab 2.
£ Implement a bottom-up local register allocator based on the algorithm in § 13.3 of
Engineering a Compiler, 3rd Edition, and the project videos. Submit your allocator by
October 23, 2024.
£ Use the ILOC simulator, described in § A-1, to ensure that the allocated code produced by
your program is correct—that is, it produces an equivalent sequence of operations as
described on page 1—and to measure the number of cycles that the ILOC simulator requires
to execute the allocated block. A large library of ILOC test blocks is available for you to use
when testing your allocator in comp412’s students/ILOC subtree on CLEAR.
£ Test your allocator thoroughly on CLEAR. It will be graded on CLEAR.
£ Ensure that your code passes Lab 2 code check #1. To pass the code check, your code must
correctly scan, parse, perform register renaming, and print the resulting renamed ILOC
block to stdout. To receive full credit, submit results that demonstrate that your allocator
passes code check #1 on or before October 4, 2024.
£ Ensure that your code passes Lab 2 code check #2. To pass the code check, your code must
conform to the interface described in § 3 and must perform register allocation correctly and
print the resulting allocated ILOC block to stdout. To receive full credit, submit results that
demonstrate that your allocator passes code check #2 on or before October 16, 2024.
£ Spend the rest of your time improving the effectiveness of the allocator, as measured by
the number of cycles that the simulator reports when it runs the allocated code, and the
efficiency of the allocator, as reported by the autotimer.
To produce an effectiveness grade, we will run the allocator on each of the report blocks
and on a set of private blocks. We will test each code with k set to 3, 4, 5, 6, 8, and 10. The
number of points awarded to an allocator for effectiveness will be based on a comparison
of the cycle counts produced by the allocator and the cycle counts produced by lab2_ref on
the same input file and k value.
相关推荐
GD32F103入门实践(一)配置环境,搭建工程模板,烧写程序
写在前面 本系列博客是我初学GD32F103的操作实录,我个人是个小白,在学习过程中真的也遇到了不少坑,因此我希望能记录下来,帮助到同样踩坑的你。 我的芯片是GD32F103ZE,软件是Keil,烧写用的是JLink。 材料准备 首先我在兆易创新官网(兆易创新),下载相关的文件。点击资料下载,在搜索框里输入“GD32F10”可以得到相关的资料,其他芯片类似。比较重要的是GD32F10x AddOn和GD32F10x Firmware Library(固件库),这两个必须下载。 下载Keil MDK5,这
InnoDB 内存结构总览:Change Buffer、AHI 与 Log Buffer
本文系统梳理InnoDB内存结构中的ChangeBuffer、Adaptive Hash Index(AHI)与LogBuffer。ChangeBuffer缓存二级索引页不在内存时的变更,减少随机IO,仅在页加载时合并;聚簇索引修改立即执行,因数据本身不可延后。AHI基于高频等值查询自动构建哈希索引,加速定位,仅支持等值操作。LogBuffer为redo log内存缓冲,配合磁盘日志实现崩溃恢复。三者均服务于性能优化,其中ChangeBuffer与AHI共享BufferPool空间,而LogBuffer独立
FDTD脚本教程——结构的创建
文章目录结构的搭建创建长方体创建柱体多边形柱体(椭)圆柱体圆环柱自定义形状创建surface波导球棱锥 在lumerical中,可以使用脚本进行操作,可在右侧脚本编辑器运行,或者直接在下方shell输入。 结构的搭建 创建长方体 um = 1e-6; nm = 1e-7; addrect; set("name","myRect"); set("material","SiO2 (Glass) - Palik"); set("render type","wireframe"); # 默认是细节渲染,也就是det
信创环境下PageOffice文档控件适配与实践
信创适配做到文档控件这一层,拼的已经不是"有没有国产版本",而是同一个功能在两类终端上是否真的等价。等价的标准很具体:同一次点击能得到同样的结果,同一份公文能得到同样的版式,同一个项目不需要维护两套代码。这背后是三件并不轻松的工作:服务端用一套接口同时支撑两类终端,客户端把两种系统与四种芯片的安装包分发清楚,文档内核层由产品侧跟着 WPS 的版本走。浏览器这一层的压力,则被收进了产品自己的窗口里——升级节奏由产品掌握,不再交给运气。
(Linux)DHCP 超级作用域和中继代理(超难受做了超久)
DHCP服务器在192.168.159.0 可以实现分配IP的功能,现在要跨网段分配IP 就需要用到DHCP中继代理。中继代理有两张网卡分别eth0:IP 192.168.159.2 ;eth1: IP:192.168.200.2 。现在要实现192.168.200.0网段的客户机可以获取DHCP服务器的IP。中继代理其实是相当于一个路由器的作用 DHCP服务器的IP地址 :192.168.159...
智驾系统分层架构:从传感器到执行器的全链路解析
本文深入解析了智能驾驶系统的分层架构,从传感器数据采集融合、应用层决策到车辆管理层执行,完整呈现了从感知到控制的全链路工作流程。文章重点阐述了架构设计的核心优势在于接口标准化与模块解耦,以ACC和LKA协同场景为例,说明了各层级如何通过清晰分工与高效协作,实现复杂系统的可靠、灵活与易于升级。
第三篇 第 6 课
前置:第三篇第 1 课(stdx 引入),第二篇第 1 课(std.regex)。环境:仓颉 SDK 1.2.0。本文所有代码与输出均逐行实测。
python爬虫抖音 个人资料 仅供学习参考 切勿用于商业
本文仅供学习参考 切勿用于商业 本次爬取使用fiddler+模拟器(下载抖音APP)+pycharm 1. 下载最新版本的fiddler(自行百度下载),以及相关配置 1.1.依次点击,菜单栏-Tools-Options-HTTPS,如图1红框打钩,HTTPS旁边Connections配置,如图2红框打钩 1.2.再次点击HTTPS栏,点击Actions选择第二个…to ...
【从零理解 Spring AI · 12】MCP 的两种角色:做客户端还是做服务端
上一篇讲了 MCP 的概念:标准协议、三大角色、M+N 替代 M×N。
ConvNeXt 系列改进:二次创新 ConvNeXt:结合 RepVGG 结构重参数化,训练多分支、推理单路
2026年的视觉模型赛道呈现出一种有趣的“返璞归真”趋势——在Transformer狂飙数年之后,卷积网络正以全新的姿态回归。这其中,ConvNeXt无疑是纯卷积阵营中最耀眼的明星。从2022年Meta AI首次提出至今,ConvNeXt系列已经走过了近四年的演进之路,衍生出ConvNeXt V2、E-ConvNeXt等多个增强版本。ConvNeXt的7×7深度卷积带来了不错的感受野,却也埋下了推理效率的隐患。
LSTM在DNA序列分析中的应用:生物信息学的探索
长短期记忆网络(LSTM)是循环神经网络(RNN)的一个变种,旨在解决RNN在长序列数据中出现的梯度消失和梯度爆炸问题。LSTM通过引入“记忆单元”和三个门(输入门、遗忘门和输出门)来有效捕捉长距离依赖关系。这使得LSTM在处理DNA序列等时间序列数据时具有优势。LSTM在DNA序列分析中展现了强大的能力,能够捕捉复杂的序列特征,并提供高效的解决方案。本文从LSTM的基本原理、DNA序列特性、模型构建、训练过程到实际应用进行了详细阐述。
pcl2启动器下载(Minecraft PCL2 启动器 最新版 安装与使用说明)
摘要:PCL2(Plain Craft Launcher 2)是一款面向 Minecraft 的第三方启动器,支持正式版与快照版本管理、模组与整合包安装、Java 运行时自动匹配,绿色免安装、双击即可运行。适合在 Windows 上玩单机整合包、需要多版本共存或离线启动的用户使用
华为OD机试:使用Ascend C语言实现Matmul与LeakyReLU融合算子的全流程设计与优化解析
通过本文的详细解析,相信你已经对华为OD机试中基于Ascend C语言的Matmul+LeakyReLU融合算子的设计与实现有了深入的理解。我们不仅从理论上探讨了融合算子的核心优势,还通过实际的代码示例演示了如何一步步完成算子的实现与优化。融合算子在AI算子开发中的应用,尤其是在处理大规模矩阵计算的场景中,能够显著提升计算效率,优化内存占用,并减少数据传输的开销。通过合理的Tiling策略设计,我们还能够充分利用多核处理器的算力,进一步提升AI模型的训练与推理性能。
spring boot 4集成SQLLite,及其SQLLite的建库
spring boot 4集成SQLLite,及其SQLLite的建库
NTscan扫描工具
ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。
pscad IEEE标准系统搭建说明
pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。
Java 集合容器高频面试题全解:HashMap 树化阈值、1.7 死循环与 ConcurrentHashMap 演进(2026 招聘 JD 真题复盘)
HashMap 树化阈值 8 的泊松分布依据、退化阈值 6 的防抖设计、JDK 1.7 头插成环死循环的排查与修复、1.8 尾插后为何仍线程不安全、ConcurrentHashMap 放弃分段锁的原因与 ForwardingNode 协作扩容、computeIfAbsent 死锁陷阱、大集合找重复的场景题选型,附三层追问链自测。题目来源为 38 期公开招聘 JD 样本与字节、拼多多、建行、美团、快手公开面经。
VC中sqlite的使用
在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示
spdlog 同步日志库使用详解
spdlog是一个轻量级 C++ 日志库,支持同步日志、异步日志、多线程日志、日志文件轮转和自定义日志格式。对于嵌入式 Linux 应用开发,我建议先使用。它可以帮我们完成:日志级别过滤。时间戳和线程 ID 输出。日志格式化。终端和文件输出。多线程安全写入。日志文件按大小或时间轮转。我们不需要自己实现互斥锁、文件写入、日志格式化和轮转等底层功能。
android 蓝牙通讯demo
android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。
JavaSE通关手册:数据类型与变量
代码无需额外处理,编译时编译器自动完成转换。
IDEA 简介:从零认识 IntelliJ IDEA
IDEA 全称,是由 JetBrains 公司开发的一款主流 Java 集成开发环境(IDE)。它集代码编辑、编译、调试、测试、版本控制、构建管理等功能于一体,被大量 Java 开发者视为日常开发的首选工具。所谓 IDE(Integrated Development Environment,集成开发环境),就是把写代码所需的各类工具整合到同一个界面中。相比只用文本编辑器加命令行编译,IDE 能显著减少重复操作,让开发者把精力集中在业务逻辑上。
Docker部署linkding:HTTPS与数据备份
部署私人书签库,除了让页面能够打开,还需要考虑几个实际问题:重建容器后数据是否保留、登录和保存是否正常、升级前怎样备份,以及出现 502 或 CSRF 错误时从哪里检查。本文使用 Docker Compose 部署 linkding,采用默认 SQLite 数据库,通过 Caddy 提供 HTTPS,并完成账户创建、数据持久化验证和备份。如果重建后账户或书签消失,应先检查是否换了项目目录、改了挂载路径,或者启动了另一套实例,不要急着重新初始化。遇到权限问题,应根据日志确认具体目录和运行用户,再调整权限。
动态代理两大流派:JDK 代理与子类代理
业务类想加日志,最直白的写法是侵入式修改: 问题很明显:每个方法都要改一遍,改一个业务要动十处。代理模式的解法是:调用方不直接依赖 ,而是依赖一个代理对象。代理对象长得跟目标一模一样,调用它 → 代理先执行增强逻辑 → 再转调真实对象。 关键在于:代理对象的类型是哪来的?这就是"动态"二字的含义:代理类在运行时才诞生。两个角色: 承载增强逻辑, 负责生成代理类。 组装代理并调用: 输出: 业务代码 一行没动,增强逻辑全在 里。这就是 AOP 的味道。 内部四步: 第 2 步 内部:先查 (同一个接口
C++20协程怎么运行?原理与三大核心组件深度剖析
C++20协程是轻量级的无栈状态机,通过co_await、co_yield、co_return实现挂起与恢复,由Promise、协程句柄和Awaitable三大组件协同工作。协程与线程互补,适用于高效管理大量并发I/O任务,显著降低上下文切换开销。其核心在于编译器生成的状态机机制,需配合库(如cppcoro)使用。掌握Promise控制逻辑、句柄生命周期管理及Awaitable语义,是构建高性能异步程序的基础。
c++ explicit关键字详解
explicit。
TRingBuffer两端都能增删(快递站版)
TRingBuffer 是一个支持两端增删、下标访问且容量动态增长的环形双端队列。它通过无符号索引的永不归零设计,利用减法自动模运算实现空满判断与元素计数,避免了传统环形缓冲浪费格子的问题。内部以票号(索引)标记首尾,扩容时重排元素为连续存储,保证 O(1) 操作与高缓存效率。虽不线程安全,但其高效性使其成为游戏开发中事件队列、命令缓冲等场景的理想选择。
Teamcenter Java SOA 开发:连接、查询与保存
本文介绍如何通过 Java 调用 Teamcenter SOA 接口实现外部系统对接,涵盖连接登录、查询保存等核心操作。以最小闭环示例展示 Connection、Service、ModelObject 等关键组件的使用,强调错误处理与事务管理要点。梳理了 DataManagement、Query、File Management 等 API 模块分工,并结合“工作移交WebService”案例,说明幂等性设计与流程状态返回的重要性。适用于 Web 门户、ERP 集成等场景,建议批量操作用 bulk 接口优化性
Java 项目实战:交友项目后台系统——网关统一鉴权与 B 端管理后台
本次改造通过引入SpringCloud Gateway实现网关统一鉴权与路由,新建mf-admin管理端复用C端域服务(Dubbo调用),实现管理员登录与用户管理四件查询。核心套路:网关白名单+双体系JWT(同工具不同payload)、管理端零直连业务库、分页形态区分(MySQL自动count/Mongo手动count)、浏览器端独立聚合。踩坑12条,附自检清单与后续改造方向,可复用于多角色后台系统。
Mac上装了最新版本的Android Studio,但是没找到jdk的设置选项也没找到jbr的目录
新版Android Studio(2025.3.1+)因三项变更导致常见问题:一、JDK设置移至“DaemonJVM criteria”,新项目默认自动探测或下载JDK;二、JBR目录改名为带版本号的jbr-21等,需进入.app/Contents/查看,或通过About窗口确认运行时;三、命令行缺adb因platform-tools未加入PATH,需在SDK Manager中勾选并配置~/.zshrc中的ANDROID_HOME及PATH。重装或清理残留可解决缺失问题,切勿手动设JAVA_HOME或安装冲
3万+



被折叠的 条评论
为什么被折叠?



