-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Add option to build cores as single compilation units (#1746)
Many parts of ares are compiled as a single translation unit in a "unity build". Targets such as `hiro` and `ruby` directly compile only one file, `hiro.cpp` or `ruby.cpp` (or `hiro.mm` and `ruby.mm` on macOS), which `#include`s all other files beneath it in a branching fashion. By contrast, in the `ares` target, each area of each core is generally compiled as a separate translation unit, with lots of redundant inclusion of common headers. This allows for faster "development cycle" build times; if a small change to one part of the core is made, we do not need to recompile the entire core. Despite slower incremental build times, compiling each ares core instead as a single translation unit has some benefits. We can lower build times by a decent amount: | Build | Build time (multiple units) | Build time (single unit) | |-----------|-------------|-----| | `ares-windows-x64` | 9m16s | 6m47s | | `ares-windows-clang-cl-x64` | 11m3s | 8m23s | | `ares-windows-clang-cl-arm64` | 12m29s | 9m20s | | `ares-macos-universal` | 13m33s | 8m12s | Not only that, but single-unit builds also seem to confer a minor performance benefit, presumably due to more effective link-time optimization. On macOS arm64: | Game (core) | VPS (multiple units) | VPS (single unit) | |-----------|-------------|-----| | Knuckles Chaotix (Mega Drive) | 101-102 | 108-109 | | Snowboard Kids (N64) | 66-67 | 69-70 | Last but not least, we can actually arrange for single-unit builds without any code-level changes to existing ares source files. We can simply add a `<core>.cpp` file for each core that includes each 'primary' `.cpp` file that would otherwise be directly compiled; due to the magic of the `#pragma once` compiler directive, redundant header inclusions are eliminated in the unity build, but compiling still works normally if we are compile as multiple units. Given that there were no significant issues adapting existing code to compile this way, it seems worth considering adding this functionality. It can disabled for default configurations transparently (to enable faster incremental builds during development), but enabled on CI for faster builds and a modest performance benefit.
- Loading branch information
Showing
25 changed files
with
303 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
#include <a26/cartridge/cartridge.cpp> | ||
#include <a26/controller/controller.cpp> | ||
#include <a26/cpu/cpu.cpp> | ||
#include <a26/riot/riot.cpp> | ||
#include <a26/system/system.cpp> | ||
#include <a26/tia/tia.cpp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//started: 2019-02-19 | ||
|
||
#include <cv/cpu/cpu.cpp> | ||
#include <cv/vdp/vdp.cpp> | ||
#include <cv/psg/psg.cpp> | ||
#include <cv/system/system.cpp> | ||
#include <cv/cartridge/cartridge.cpp> | ||
#include <cv/controller/controller.cpp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//started: 2011-09-05 | ||
|
||
#include <fc/system/system.cpp> | ||
#include <fc/controller/controller.cpp> | ||
#include <fc/expansion/expansion.cpp> | ||
#include <fc/cartridge/cartridge.cpp> | ||
#include <fc/cpu/cpu.cpp> | ||
#include <fc/apu/apu.cpp> | ||
#include <fc/ppu/ppu.cpp> | ||
#include <fc/fds/fds.cpp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//started: 2010-12-27 | ||
|
||
#include <gb/system/system.cpp> | ||
#include <gb/cartridge/cartridge.cpp> | ||
#include <gb/bus/bus.cpp> | ||
#include <gb/cpu/cpu.cpp> | ||
#include <gb/ppu/ppu.cpp> | ||
#include <gb/apu/apu.cpp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//started: 2012-03-19 | ||
|
||
#include <gba/memory/memory.cpp> | ||
#include <gba/system/system.cpp> | ||
#include <gba/cartridge/cartridge.cpp> | ||
#include <gba/player/player.cpp> | ||
#include <gba/cpu/cpu.cpp> | ||
#include <gba/display/display.cpp> | ||
#include <gba/ppu/ppu.cpp> | ||
#include <gba/apu/apu.cpp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//started: 2016-07-08 | ||
|
||
#include <md/bus/bus.cpp> | ||
#include <md/cpu/cpu.cpp> | ||
#include <md/apu/apu.cpp> | ||
#include <md/vdp/vdp.cpp> | ||
#include <md/opn2/opn2.cpp> | ||
#include <md/m32x/m32x.cpp> | ||
#include <md/mcd/mcd.cpp> | ||
#include <md/system/system.cpp> | ||
#include <md/cartridge/cartridge.cpp> | ||
#include <md/controller/controller.cpp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//started: 2016-08-17 | ||
|
||
#include <ms/cpu/cpu.cpp> | ||
#include <ms/vdp/vdp.cpp> | ||
#include <ms/psg/psg.cpp> | ||
#include <ms/opll/opll.cpp> | ||
#include <ms/system/system.cpp> | ||
#include <ms/cartridge/cartridge.cpp> | ||
#include <ms/controller/controller.cpp> | ||
#include <ms/expansion/expansion.cpp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//started: 2018-12-28 | ||
|
||
#include <msx/system/system.cpp> | ||
#include <msx/keyboard/keyboard.cpp> | ||
#include <msx/cartridge/cartridge.cpp> | ||
#include <msx/controller/controller.cpp> | ||
#include <msx/cpu/cpu.cpp> | ||
#include <msx/vdp/vdp.cpp> | ||
#include <msx/psg/psg.cpp> | ||
#include <msx/tape/tape.cpp> | ||
#include <msx/rtc/rtc.cpp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
//started: 2023-07-19 | ||
|
||
#include <myvision/cpu/cpu.cpp> | ||
#include <myvision/vdp/vdp.cpp> | ||
#include <myvision/psg/psg.cpp> | ||
#include <myvision/system/system.cpp> | ||
#include <myvision/cartridge/cartridge.cpp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
//started: 2020-04-28 | ||
|
||
#include <n64/memory/memory.cpp> | ||
#include <n64/system/system.cpp> | ||
#include <n64/cartridge/cartridge.cpp> | ||
#include <n64/cic/cic.cpp> | ||
#include <n64/controller/controller.cpp> | ||
#include <n64/dd/dd.cpp> | ||
#include <n64/mi/mi.cpp> | ||
#include <n64/vi/vi.cpp> | ||
#include <n64/ai/ai.cpp> | ||
#include <n64/pi/pi.cpp> | ||
#include <n64/pif/pif.cpp> | ||
#include <n64/ri/ri.cpp> | ||
#include <n64/si/si.cpp> | ||
#include <n64/rdram/rdram.cpp> | ||
#include <n64/cpu/cpu.cpp> | ||
#include <n64/rsp/rsp.cpp> | ||
#include <n64/rdp/rdp.cpp> | ||
|
||
//#include <n64/vulkan/parallel-rdp/parallel-rdp/command_ring.cpp> | ||
//#include <n64/vulkan/parallel-rdp/parallel-rdp/rdp_device.cpp> | ||
//#include <n64/vulkan/parallel-rdp/parallel-rdp/rdp_dump_write.cpp> | ||
//#include <n64/vulkan/parallel-rdp/parallel-rdp/rdp_renderer.cpp> | ||
//#include <n64/vulkan/parallel-rdp/parallel-rdp/video_interface.cpp> | ||
//#include <n64/vulkan/parallel-rdp/vulkan/buffer.cpp> | ||
//#include <n64/vulkan/parallel-rdp/vulkan/buffer_pool.cpp> | ||
//#include <n64/vulkan/parallel-rdp/vulkan/command_buffer.cpp> | ||
//#include <n64/vulkan/parallel-rdp/vulkan/command_pool.cpp> | ||
//#include <n64/vulkan/parallel-rdp/vulkan/context.cpp> | ||
//#include <n64/vulkan/parallel-rdp/vulkan/cookie.cpp> | ||
//#include <n64/vulkan/parallel-rdp/vulkan/descriptor_set.cpp> | ||
//#include <n64/vulkan/parallel-rdp/vulkan/device.cpp> | ||
//#include <n64/vulkan/parallel-rdp/vulkan/event_manager.cpp> | ||
//#include <n64/vulkan/parallel-rdp/vulkan/fence.cpp> | ||
//#include <n64/vulkan/parallel-rdp/vulkan/fence_manager.cpp> | ||
//#include <n64/vulkan/parallel-rdp/vulkan/image.cpp> | ||
//#include <n64/vulkan/parallel-rdp/vulkan/indirect_layout.cpp> | ||
//#include <n64/vulkan/parallel-rdp/vulkan/memory_allocator.cpp> | ||
//#include <n64/vulkan/parallel-rdp/vulkan/pipeline_event.cpp> | ||
//#include <n64/vulkan/parallel-rdp/vulkan/query_pool.cpp> | ||
//#include <n64/vulkan/parallel-rdp/vulkan/render_pass.cpp> | ||
//#include <n64/vulkan/parallel-rdp/vulkan/sampler.cpp> | ||
//#include <n64/vulkan/parallel-rdp/vulkan/semaphore.cpp> | ||
//#include <n64/vulkan/parallel-rdp/vulkan/semaphore_manager.cpp> | ||
//#include <n64/vulkan/parallel-rdp/vulkan/shader.cpp> | ||
//#include <n64/vulkan/parallel-rdp/vulkan/texture/texture_format.cpp> | ||
//#include <n64/vulkan/parallel-rdp/util/arena_allocator.cpp> | ||
//#include <n64/vulkan/parallel-rdp/util/logging.cpp> | ||
//#include <n64/vulkan/parallel-rdp/util/thread_id.cpp> | ||
//#include <n64/vulkan/parallel-rdp/util/aligned_alloc.cpp> | ||
//#include <n64/vulkan/parallel-rdp/util/timer.cpp> | ||
//#include <n64/vulkan/parallel-rdp/util/timeline_trace_file.cpp> | ||
//#include <n64/vulkan/parallel-rdp/util/thread_name.cpp> | ||
//#include <n64/vulkan/parallel-rdp/util/environment.cpp> | ||
//#include <n64/vulkan/parallel-rdp/volk/volk.c> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//started: 2021-05-18 | ||
|
||
#include <ng/system/system.cpp> | ||
#include <ng/cpu/cpu.cpp> | ||
#include <ng/apu/apu.cpp> | ||
#include <ng/lspc/lspc.cpp> | ||
#include <ng/opnb/opnb.cpp> | ||
#include <ng/cartridge/cartridge.cpp> | ||
#include <ng/controller/controller.cpp> | ||
#include <ng/card/card.cpp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//started: 2019-01-03 | ||
|
||
#include <ngp/system/system.cpp> | ||
#include <ngp/cartridge/cartridge.cpp> | ||
#include <ngp/cpu/cpu.cpp> | ||
#include <ngp/apu/apu.cpp> | ||
#include <ngp/kge/kge.cpp> | ||
#include <ngp/psg/psg.cpp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//started: 2017-01-11 | ||
|
||
#include <pce/cpu/cpu.cpp> | ||
#include <pce/psg/psg.cpp> | ||
#include <pce/pcd/pcd.cpp> | ||
#include <pce/system/system.cpp> | ||
#include <pce/cartridge/cartridge.cpp> | ||
#include <pce/controller/controller.cpp> |
Oops, something went wrong.