Skip to content
Merged
81 changes: 0 additions & 81 deletions .github/assets/hero.svg

This file was deleted.

7 changes: 4 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ Everything we compile is `/W4 /WX`; fix warnings, do not suppress them.

## Layout

Two executables on one engine: `gao.exe` (CLI, `src/app/main.cpp`) and
`GpuAutoOptimizer.exe` (window + tray + watchdog, `src/app/gui/`). Logic both
need lives in `src/app/common.*`, never in either entry point.
Two executables on one engine: `gao.exe` (CLI, `src/app/main.cpp`, its commands
in `src/app/cli_*`) and `GpuAutoOptimizer.exe` (window + tray + watchdog,
`src/app/gui/`). Logic both need lives in `src/app/common*`, never in either
entry point.

## Rules the design depends on

Expand Down
16 changes: 14 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,15 @@ target_link_libraries(hw PUBLIC core d3d11 dxgi d3dcompiler shell32 ole32 oleaut

# UI-independent application logic shared by both executables.
add_library(app STATIC
src/app/common.hpp src/app/common.cpp
src/app/common.hpp src/app/common.cpp src/app/common_internal.hpp
src/app/common_run_steps.cpp src/app/common_optimize.cpp src/app/common_all_in_one.cpp
src/app/common_retest.cpp src/app/common_results.cpp src/app/common_boot.cpp
src/app/guarded_gpu.hpp src/app/guarded_gpu.cpp
)
target_link_libraries(app PUBLIC core hw PRIVATE gao_warnings gao_hardening)

add_executable(gao src/app/main.cpp src/app/gao.manifest src/app/app.rc)
add_executable(gao src/app/main.cpp src/app/cli_commands.hpp src/app/cli_hardware.cpp src/app/cli_runs.cpp
src/app/gao.manifest src/app/app.rc)
target_link_libraries(gao PRIVATE app gao_warnings gao_hardening)
# d3dcompiler_47.dll, d3d11.dll and dxgi.dll are not KnownDLLs: delay-load
# them so they resolve after SetDefaultDllDirectories(SYSTEM32) in main(),
Expand All @@ -128,6 +131,10 @@ target_link_libraries(imgui PUBLIC d3d11 dwmapi PRIVATE gao_hardening)
add_executable(GpuAutoOptimizer WIN32
src/app/gui/main_gui.cpp
src/app/gui/ui.hpp src/app/gui/ui.cpp
src/app/gui/ui_widgets.hpp src/app/gui/ui_widgets.cpp
src/app/gui/ui_dashboard.cpp src/app/gui/ui_fan.cpp
src/app/gui/ui_optimize.cpp src/app/gui/ui_results.cpp
src/app/gui/ui_about.cpp
src/app/gui/worker.hpp src/app/gui/worker.cpp
src/app/gao.manifest
src/app/app.rc
Expand All @@ -148,6 +155,11 @@ add_executable(core_tests
tests/test_stability.cpp
tests/test_journal.cpp
tests/test_search.cpp
tests/test_search_bandwidth.cpp
tests/test_search_bounds.cpp
tests/test_search_recovery.cpp
tests/test_search_reset_budget.cpp
tests/test_search_stock.cpp
tests/test_busy_card.cpp
tests/test_boot.cpp
tests/test_retest.cpp
Expand Down
15 changes: 12 additions & 3 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,20 @@ src/hw/ the only code that touches hardware or the OS state folders.
nvidia_app.* whether the NVIDIA app's Automatic Tuning is on, read from the driver's settings database
update_io.* what an update needs from Windows: HTTPS download, SHA-256, unzip, file version
src/app/
common.* logic both programs share: optimize, logon apply, apply-at-logon on/off
main.cpp gao.exe, the command line
common.hpp logic both programs share: optimize, logon apply, apply-at-logon on/off
common.cpp the process, locks, config and logs
common_*.cpp run steps, optimize, All in one, retest, results, logon apply (common_boot)
common_internal.hpp helpers the common_*.cpp files share
guarded_gpu.* driver calls that cannot take the process down, reconnected after a driver reset
main.cpp gao.exe, the command line: entry point, dispatch, usage
cli_* the gao.exe commands: cli_hardware (card reads and writes), cli_runs (stress tests and runs)
gui/ GpuAutoOptimizer.exe: window, tray, optimize worker thread, watchdog loop
tests/ doctest, core only
ui.* the frame and the navigation
ui_widgets.* widgets the pages share
ui_*.cpp one per page: dashboard, fan, optimize, results, about
tests/ doctest: core_tests (src/core/), app_tests (the app layer, without a GPU)
third_party/ doctest, nlohmann/json, Dear ImGui: vendored as source, no package manager
docs/images/ the README's pictures; mark.svg (32 px and up) and mark-small.svg (16 to 24 px) are the sources of src/app/app.ico
```

## Profiles as data
Expand Down
54 changes: 54 additions & 0 deletions src/app/cli_commands.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#pragma once
// The gao.exe commands as main.cpp dispatches them (cli_hardware.cpp,
// cli_runs.cpp); CLI only, not part of the interface of common.hpp.
#include "app/common.hpp"
#include "hw/stress.hpp"
#include <atomic>
#include <cstdio>
#include <optional>
#include <string>

namespace gao::cli {

// cli_hardware.cpp
int probe();
int set_offset(const char* label, int mhz, bool core);
int curve();
int curve_flatten(int mv, int mhz, int tail_drop_mhz, int core_mhz);
int reset();
int update();
int apply();
int boot(bool on);
int status();
int fan_auto();

// cli_runs.cpp
int stress(int seconds, int max_temp_c, gao::StressSelftest selftest, int duty_pct);
int optimize(gao::Preset preset, const std::optional<gao::FanCurve>& fan_curve);
int undervolt(bool on_overclock);
int retest();
int all_in_one();
int bandwidth(int after_load_s);
int stress_recreate();

// Defined in cli_runs.cpp: the Ctrl+C handler sets g_abort; main() sets
// g_busy_ok for --busy-ok.
extern std::atomic<bool> g_abort;
extern bool g_busy_ok;


// A run Ctrl+C stopped, with nothing of it kept (exit 1), puts back the tune
// it found on the card: a tray app's watchdog would otherwise take the stock
// it left for a driver reset. The window's runs do the same (gui/worker.cpp).
template <class Run> int putting_back(Run run) {
const auto before = gao::app::tune_before_run();
const int code = run();
if (g_abort && code == 1) {
gao::app::OptimizeHooks hooks;
hooks.log = gao::app::logged([](const std::string& msg) { std::printf(" %s\n", msg.c_str()); });
gao::app::put_back_after_stop(before, hooks);
}
return code;
}

} // namespace gao::cli
Loading