Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

refactor codebase to leverage C++17, enhance cmakelists, and improve code readability #2091

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from

Conversation

github-roushan
Copy link
Contributor

@github-roushan github-roushan commented Mar 10, 2025

Description of Changes

  • Enhanced the hardware_cmd_list.cc file by adopting C++17 features.
  • Improved CMakeLists.txt to dynamically determine the C++ version used, removing hardcoding of the version in the output.
  • Refactored the setup command from the run command, improving variable naming for clarity and readability.
  • Moved relevant functionality from ggml.cc to ggml.h for better modularity.

Fixes Issues

  • Closes #
  • Closes #

Self Checklist

  • Added relevant comments, esp in complex areas
  • Updated docs (for bug fixes / features)
  • Created issues for follow-up changes or refactoring needed

@github-roushan github-roushan changed the title chore: remove unused headers and code cleanup WIP Mar 10, 2025
@github-roushan github-roushan force-pushed the big-refactor branch 2 times, most recently from c3ac900 to 9685dcb Compare March 11, 2025 14:59
@github-roushan
Copy link
Contributor Author

@sangjanai. Adding you to review the changes and push them whenever possible before this branch diverged too much from main, leaving me to do merge :( .

@github-roushan github-roushan marked this pull request as ready for review March 11, 2025 15:01
@github-roushan
Copy link
Contributor Author

@vansangpfiev . can you have a look at this

@vansangpfiev
Copy link
Contributor

@vansangpfiev . can you have a look at this

Is it ready to review or still in-progress?

@github-roushan
Copy link
Contributor Author

@vansangpfiev . can you have a look at this

Is it ready to review or still in-progress?

I will be making progress, but for now you can review and if good merge them. This will save me for doing merge fixes everytime it diverts from main. Thanks again

@qnixsynapse
Copy link
Contributor

Also, when submitting PR, please write about the changes so that it can easy for us to review. :) If it's WIP, then please keep it as draft.

@github-roushan
Copy link
Contributor Author

Also, when submitting PR, please write about the changes so that it can easy for us to review. :) If it's WIP, then please keep it as draft.

Noted. What i want is that the commits be merged timely so as not to diverge too much from main as it becomes painful to merge them locally. But will keep this in mind

@github-roushan github-roushan changed the title WIP Refactor code with C++17 Mar 26, 2025
@github-roushan github-roushan changed the title Refactor code with C++17 Refactor Codebase to Leverage C++17, Enhance CMakeLists, and Improve Code Readability Mar 26, 2025
@github-roushan
Copy link
Contributor Author

@vansangpfiev . This is open to be reviewed

@github-roushan github-roushan changed the title Refactor Codebase to Leverage C++17, Enhance CMakeLists, and Improve Code Readability refactor codebase to leverage C++17, enhance cmakelists, and improve code readability Mar 26, 2025
}

const std::unordered_map<GGMLType, GGMLTypeTrait> kGGMLTypeTraits = {
{GGML_TYPE_F32, {.block_size = 1, .type_size = 4}},
Copy link
Contributor

Choose a reason for hiding this comment

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

Designated initializer requires C++20, the CIs use C++17

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Working on a fix

@@ -204,7 +205,7 @@ if(CMAKE_CXX_STANDARD LESS 17)
find_package(Boost 1.61.0 REQUIRED)
target_include_directories(${TARGET_NAME} PRIVATE ${Boost_INCLUDE_DIRS})
else()
message(STATUS "use c++17")
message(STATUS "use c++${CMAKE_CXX_STANDARD}")
Copy link
Contributor

Choose a reason for hiding this comment

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

This change is not needed.

if (result.has_error()) {
CTL_ERR(result.error());

auto hardware_json_response = curl_utils::SimpleGetJson(url.ToFullPath());
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a variable name change?

static constexpr std::array<const char*, 3> STORAGE_INFO_HEADERS = {
"#", "Total (GiB)", "Available (GiB)"};
static constexpr std::array<const char*, 4> POWER_INFO_HEADERS = {
"#", "Battery Life", "Charging Status", "Power Saving"};
};
} // namespace commands
Copy link
Contributor

Choose a reason for hiding this comment

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

File doesn't end with an empty line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants