Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

jit: Implement register allocation #418

Merged
merged 4 commits into from
Apr 29, 2024
Merged

jit: Implement register allocation #418

merged 4 commits into from
Apr 29, 2024

Conversation

vacantron
Copy link
Collaborator

Implement the register allocator with linear-scan register allocation. The reg_table is removed and integrated to the host_reg for convenience of accessing the vm register by the reg_idx.

The performance comparsion is shown below:

  • x86-64
Metric Original w/ reg-alloc SpeedUp
dhrystone 14060 DMIPS 15225 DMIPS +8.29%
coremark 3874 iters/s 3828 iters/s -1.19%
aes 0.0297 s 0.0323 s -8.75%
nqueens 2.16 s 2.05 s +5.09%
stream 29.6 s 27.6 s +6.76%

Implement the register allocator with linear-scan register
allocation. The "reg_table" is removed and integrated to the
"host_reg" for convenience of accessing the vm register by the
"reg_idx".

The performance comparsion is shown below:

* x86-64
| Metric    | Original       | w/ reg-alloc   | SpeedUp |
|-----------+----------------+----------------+---------|
| dhrystone |  14060 DMIPS   |  15225 DMIPS   | +8.29%  |
| coremark  |   3874 iters/s |   3828 iters/s | -1.19%  |
| aes       | 0.0297 s       | 0.0323 s       | -8.75%  |
| nqueens   |   2.16 s       |   2.05 s       | +5.09%  |
| stream    |   29.6 s       |   27.6 s       | +6.76%  |
Copy link
Contributor

@jserv jserv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enforce consistent naming scheme, in the form item_action. E.g., prefer liveness_calc instead of calc_liveness.

@vacantron
Copy link
Collaborator Author

Enforce consistent naming scheme, in the form item_action. E.g., prefer liveness_calc instead of calc_liveness.

Is it better to use liveness_reset, reg_pick instead of reset_liveness, pick_reg also?

@jserv
Copy link
Contributor

jserv commented Apr 26, 2024

Is it better to use liveness_reset, reg_pick instead of reset_liveness, pick_reg also?

Yes, to avoid unintended symbol conflicts, let's stick to the requested naming scheme across compilation units.

@jserv jserv requested a review from qwe661234 April 27, 2024 05:12
@qwe661234 qwe661234 self-requested a review April 28, 2024 17:02
@jserv jserv changed the title Implement register allocation jit: Implement register allocation Apr 29, 2024
@jserv jserv merged commit c7179b9 into sysprog21:master Apr 29, 2024
8 checks passed
@jserv
Copy link
Contributor

jserv commented Apr 29, 2024

Thank @vacantron for contributing!

@jserv jserv added this to the release-2024.1 milestone Apr 29, 2024
@vacantron vacantron deleted the ra branch May 29, 2024 19:54
vestata pushed a commit to vestata/rv32emu that referenced this pull request Jan 24, 2025
This commit implements the register allocator using linear-scan register
allocation. The "reg_table" has been removed and integrated into the
"host_reg" for easier access to the VM register by the "reg_idx".

The performance comparison is shown below: (x86-64)

| Metric    | Original       | w/ reg-alloc   | SpeedUp |
|-----------+----------------+----------------+---------|
| dhrystone |  14060 DMIPS   |  15225 DMIPS   | +8.29%  |
| coremark  |   3874 iters/s |   3828 iters/s | -1.19%  |
| aes       | 0.0297 s       | 0.0323 s       | -8.75%  |
| nqueens   |   2.16 s       |   2.05 s       | +5.09%  |
| stream    |   29.6 s       |   27.6 s       | +6.76%  |
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants