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

Cleanup CI and Upgrade clang-{tidy,format} to 1.18 #102

Merged
merged 6 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@ CheckOptions:
- { key: readability-implicit-bool-conversion.AllowPointerConditions, value: 1 }
- { key: readability-function-cognitive-complexity.IgnoreMacros, value: 1 }
- { key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic, value: "true" }
# disable warnings is asmjit
- { key: 'clang-analyzer-optin.cplusplus.UninitializedObject:IgnoreRecordsWithField', value: 'asmjit::Operand_::Signature' }
# disable warnings is external libraries
- { key: 'clang-analyzer-optin.cplusplus.UninitializedObject:IgnoreRecordsWithField', value: 'asmjit::Operand_::Signature' }
- { key: 'misc-include-cleaner.IgnoreHeaders', value: '.*asmjit.*;.*hwloc.*' }
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
9732bdb59717274f666e9c1497289d1f9a0d7858
57259a1c5dce3b90a71520abc068af8aab37bb56
748ceb28e4f607e8f86fa8247b40539c0d645b8a
2 changes: 1 addition & 1 deletion .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: [push, pull_request]

jobs:
clang-format:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ env:

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
Expand Down
17 changes: 0 additions & 17 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ jobs:
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/.ghcup

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Checkout repository
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -104,10 +99,6 @@ jobs:
run: |
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Checkout repository
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -174,10 +165,6 @@ jobs:
env:
CUDA_ROOT: '/usr/local/cuda'
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Checkout repository
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -281,10 +268,6 @@ jobs:
if: startsWith(matrix.compiler, 'clang')
run: |
sudo apt install ${{ matrix.compiler }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Checkout repository
uses: actions/checkout@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion DeveloperDocumenation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This document contains knowledge required to work on the FIRESTARTER project.

Code style follows the LLVM project.
It is enforced by an automatic CI check.
The currently used version for `clang-format` and `clang-tidy` is `1.14` (the default for Ubuntu 22.04).
The currently used version for `clang-format` and `clang-tidy` is `1.18` (the default for Ubuntu 24.04).

When using VSCode as your editor it is recomended that you install the [Clang-Format](https://marketplace.visualstudio.com/items?itemName=xaver.clang-format) and [clangd](https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd) extension.

Expand Down
1 change: 1 addition & 0 deletions include/firestarter/CPUTopology.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <set>

extern "C" {
// NOLINTNEXTLINE(misc-header-include-cycle) internal cycle inside hwloc
#include <hwloc.h>
}

Expand Down
32 changes: 17 additions & 15 deletions include/firestarter/Constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,49 +83,51 @@ struct FirestarterOptionalFeatures {
};

// MSC only supports designated initializers from C++20
static constexpr const FirestarterOptionalFeatures OptionalFeatures {
static constexpr const FirestarterOptionalFeatures OptionalFeatures{
#if defined(linux) || defined(__linux__)
/*OptimizationEnabled=*/true,
/*OptimizationEnabled=*/true,
#else
/*OptimizationEnabled=*/false,
/*OptimizationEnabled=*/false,
#endif

#if defined(FIRESTARTER_BUILD_CUDA) || defined(FIRESTARTER_BUILD_HIP)
/*CudaEnabled=*/true,
/*CudaEnabled=*/true,
#else
/*CudaEnabled=*/false,
/*CudaEnabled=*/false,
#endif

#ifdef FIRESTARTER_BUILD_ONEAPI
/*OneAPIEnabled=*/true,
/*OneAPIEnabled=*/true,
#else
/*OneAPIEnabled=*/false,
/*OneAPIEnabled=*/false,
#endif

/*ErrorDetectionEnabled=*/true,
/*ErrorDetectionEnabled=*/true,

#ifdef FIRESTARTER_DEBUG_FEATURES
/*DebugFeatureEnabled=*/true, /*DumpRegisterEnabled =*/true,
/*DebugFeatureEnabled=*/true,
/*DumpRegisterEnabled =*/true,
#else
/*DebugFeatureEnabled=*/false, /*DumpRegisterEnabled =*/false,
/*DebugFeatureEnabled=*/false,
/*DumpRegisterEnabled =*/false,
#endif

#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64)
/*IsX86=*/true,
/*IsX86=*/true,
#else
#error "FIRESTARTER is not implemented for this ISA"
#endif

#ifdef _WIN32
/*IsWin32=*/true,
/*IsWin32=*/true,
#else
/*IsWin32=*/false,
/*IsWin32=*/false,
#endif

#ifdef _MSC_VER
/*IsMsc=*/true,
/*IsMsc=*/true,
#else
/*IsMsc=*/false,
/*IsMsc=*/false,
#endif
};

Expand Down
2 changes: 1 addition & 1 deletion include/firestarter/DumpRegisterWorkerData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class DumpRegisterWorkerData {
/// which the registers are dumped as well as getting the size and count of registers.
std::shared_ptr<LoadWorkerData> LoadWorkerDataPtr;
/// Every this number of seconds the register content will be dumped.
const std::chrono::seconds DumpTimeDelta;
std::chrono::seconds DumpTimeDelta;
/// The folder in which the hamming_distance.csv file will be created.
std::string DumpFilePath;
};
Expand Down
29 changes: 14 additions & 15 deletions include/firestarter/FunctionSelection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@ class FunctionSelection {
/// \arg Topology The topology which contains information about the cpu requied to select the correct function.
/// \arg AllowUnavailablePayload If true we will not throw if the PlatformConfig is not available.
[[nodiscard]] auto selectFunction(std::optional<unsigned> FunctionId, const ProcessorInformation& ProcessorInfos,
const CPUTopology& Topology, bool AllowUnavailablePayload) const
-> std::unique_ptr<platform::PlatformConfig>;
const CPUTopology& Topology,
bool AllowUnavailablePayload) const -> std::unique_ptr<platform::PlatformConfig>;

/// Select a PlatformConfig based on its generated id. This function will throw if a payload is not available or the
/// id is incorrect.
/// \arg FunctionId The id of the PlatformConfig that should be selected.
/// \arg Features The CPU features of the current processor.
/// \arg InstructionCacheSize The optional size of the instruction cache.
/// \arg AllowUnavailablePayload If true we will not throw if the PlatformConfig is not available.
[[nodiscard]] auto selectAvailableFunction(unsigned FunctionId, const CpuFeatures& Features,
std::optional<unsigned> InstructionCacheSize,
bool AllowUnavailablePayload) const
-> std::unique_ptr<platform::PlatformConfig>;
[[nodiscard]] auto
selectAvailableFunction(unsigned FunctionId, const CpuFeatures& Features,
std::optional<unsigned> InstructionCacheSize,
bool AllowUnavailablePayload) const -> std::unique_ptr<platform::PlatformConfig>;

/// Select the fallback PlatformConfig if no id is given.
/// \arg Model The class that identifies the cpu model.
Expand All @@ -64,22 +64,21 @@ class FunctionSelection {
/// \arg ModelString The string of the cpu model.
/// \arg InstructionCacheSize The optional size of the instruction cache.
/// \arg NumThreadsPerCore The number of threads per core.
[[nodiscard]] auto selectDefaultOrFallbackFunction(const CpuModel& Model, const CpuFeatures& Features,
const std::string& VendorString, const std::string& ModelString,
std::optional<unsigned> InstructionCacheSize,
unsigned NumThreadsPerCore) const
-> std::unique_ptr<platform::PlatformConfig>;
[[nodiscard]] auto
selectDefaultOrFallbackFunction(const CpuModel& Model, const CpuFeatures& Features, const std::string& VendorString,
const std::string& ModelString, std::optional<unsigned> InstructionCacheSize,
unsigned NumThreadsPerCore) const -> std::unique_ptr<platform::PlatformConfig>;

/// Print a list of available high-load function and if they are available on the current system.
/// \arg ProcessorInfos Information about the processor which is specific to the current ISA.
/// \arg ForceYes Force all functions to be shown as avaialable
void printFunctionSummary(const ProcessorInformation& ProcessorInfos, bool ForceYes) const;

[[nodiscard]] virtual auto platformConfigs() const
-> const std::vector<std::shared_ptr<firestarter::platform::PlatformConfig>>& = 0;
[[nodiscard]] virtual auto
platformConfigs() const -> const std::vector<std::shared_ptr<firestarter::platform::PlatformConfig>>& = 0;

[[nodiscard]] virtual auto fallbackPlatformConfigs() const
-> const std::vector<std::shared_ptr<firestarter::platform::PlatformConfig>>& = 0;
[[nodiscard]] virtual auto
fallbackPlatformConfigs() const -> const std::vector<std::shared_ptr<firestarter::platform::PlatformConfig>>& = 0;
};

} // namespace firestarter
4 changes: 2 additions & 2 deletions include/firestarter/LoadWorkerMemory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ struct LoadWorkerMemory {

/// Get the pointer to the start of the memory use for computations.
/// \returns the pointer to the memory.
[[nodiscard]] auto getMemoryAddress() -> auto{
[[nodiscard]] auto getMemoryAddress() -> auto {
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
return reinterpret_cast<double*>(&DoNotUseAddrMem);
}

/// Get the offset to the memory which is used by the high-load functions
/// \returns the offset to the memory
[[nodiscard]] constexpr static auto getMemoryOffset() -> auto{ return offsetof(LoadWorkerMemory, DoNotUseAddrMem); }
[[nodiscard]] constexpr static auto getMemoryOffset() -> auto { return offsetof(LoadWorkerMemory, DoNotUseAddrMem); }

/// Allocate the memory for the high-load thread on 64B cache line boundaries and return a unique_ptr.
/// \arg Bytes The number of bytes allocated for the array whoose start address is returned by the getMemoryAddress
Expand Down
6 changes: 3 additions & 3 deletions include/firestarter/Measurement/MeasurementWorker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ class MeasurementWorker {
/// \arg StartDelta The time to skip from the measurement start
/// \arg StopDelta The time to skip from the measurement stop
/// \returns The map from all metrics to their respective summaries.
auto getValues(std::chrono::milliseconds StartDelta = std::chrono::milliseconds::zero(),
std::chrono::milliseconds StopDelta = std::chrono::milliseconds::zero())
-> std::map<std::string, Summary>;
auto
getValues(std::chrono::milliseconds StartDelta = std::chrono::milliseconds::zero(),
std::chrono::milliseconds StopDelta = std::chrono::milliseconds::zero()) -> std::map<std::string, Summary>;
};

} // namespace firestarter::measurement
4 changes: 2 additions & 2 deletions include/firestarter/Optimizer/Problem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ class Problem {
/// \arg Summaries The summaries of one evaluation.
/// \returns The fitness vector derived from the summaries. The size of this vector is equal to the number of
/// objectives.
[[nodiscard]] virtual auto fitness(std::map<std::string, firestarter::measurement::Summary> const& Summaries) const
-> std::vector<double> = 0;
[[nodiscard]] virtual auto
fitness(std::map<std::string, firestarter::measurement::Summary> const& Summaries) const -> std::vector<double> = 0;

/// Get the bounds of the problem. For each dimension a min and max value is supplied.
/// \return The min and max bound per dimension.
Expand Down
4 changes: 2 additions & 2 deletions include/firestarter/Payload/CompiledPayload.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ class CompiledPayload {
/// \arg Iterations The current iteration counter. This number will be incremented for every iteration of the high
/// load loop.
/// \returns The iteration counter passed into this function plus the number of iteration of the high load loop.
[[nodiscard]] auto highLoadFunction(double* MemoryAddr, volatile LoadThreadWorkType& LoadVar, uint64_t Iterations)
-> uint64_t {
[[nodiscard]] auto highLoadFunction(double* MemoryAddr, volatile LoadThreadWorkType& LoadVar,
uint64_t Iterations) -> uint64_t {
return HighLoadFunction(MemoryAddr, &LoadVar, Iterations);
}

Expand Down
15 changes: 7 additions & 8 deletions include/firestarter/Payload/PayloadSettings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ struct PayloadSettings {
/// \arg Sequence The sequence that is analyzed.
/// \arg Start The string that contains the start of the item names that should be counted in the sequence.
/// \returns The number of items in the sequence that start with the supplied strings.
[[nodiscard]] static auto getSequenceStartCount(const std::vector<std::string>& Sequence, const std::string& Start)
-> unsigned;
[[nodiscard]] static auto getSequenceStartCount(const std::vector<std::string>& Sequence,
const std::string& Start) -> unsigned;

public:
PayloadSettings() = delete;
Expand Down Expand Up @@ -168,7 +168,7 @@ struct PayloadSettings {
[[nodiscard]] auto dataCacheBufferSize() const -> const auto& { return DataCacheBufferSize; }

/// The selected size of the buffer that is in the RAM on the physical CPU core.
[[nodiscard]] auto ramBufferSize() const -> auto{ return RamBufferSize; }
[[nodiscard]] auto ramBufferSize() const -> auto { return RamBufferSize; }

/// Return the total buffer size for the data caches and the ram per physical CPU core.
[[nodiscard]] auto totalBufferSize() const -> std::size_t {
Expand All @@ -181,12 +181,11 @@ struct PayloadSettings {
}

/// The number of instruction groups which should be used in the payload per physical CPU core.
[[nodiscard]] auto lines() const -> auto{ return Lines; }
[[nodiscard]] auto lines() const -> auto { return Lines; }

/// The available instruction cache size. This refers to the L1i-Cache per thread on the physical CPU core.
[[nodiscard]] auto instructionCacheSizePerThread() const -> std::optional<unsigned> {
auto InstructionCacheSize = this->InstructionCacheSize;
if (*InstructionCacheSize) {
if (InstructionCacheSize) {
return *InstructionCacheSize / thread();
}
return {};
Expand All @@ -202,13 +201,13 @@ struct PayloadSettings {
}

/// The selected size of the buffer that is in the RAM per thread on the physical CPU core.
[[nodiscard]] auto ramBufferSizePerThread() const -> auto{ return RamBufferSize / thread(); }
[[nodiscard]] auto ramBufferSizePerThread() const -> auto { return RamBufferSize / thread(); }

/// Return the total buffer size for the data caches and the ram per thread on the physical CPU core.
[[nodiscard]] auto totalBufferSizePerThread() const -> std::size_t { return totalBufferSize() / thread(); }

/// The number of instruction groups which should be used in the payload per thread on the physical CPU core.
[[nodiscard]] auto linesPerThread() const -> auto{ return Lines / thread(); }
[[nodiscard]] auto linesPerThread() const -> auto { return Lines / thread(); }

/// The vector of instruction groups with proportions.
[[nodiscard]] auto groups() const -> const auto& { return Groups; }
Expand Down
9 changes: 5 additions & 4 deletions include/firestarter/Platform/PlatformConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class PlatformConfig {
/// Clone a concreate platform config.
/// \arg InstructionCacheSize The detected size of the instructions cache.
/// \arg ThreadPerCore The number of threads per pysical CPU.
[[nodiscard]] virtual auto cloneConcreate(std::optional<unsigned> InstructionCacheSize, unsigned ThreadsPerCore) const
-> std::unique_ptr<PlatformConfig> = 0;
[[nodiscard]] virtual auto cloneConcreate(std::optional<unsigned> InstructionCacheSize,
unsigned ThreadsPerCore) const -> std::unique_ptr<PlatformConfig> = 0;

/// Parse the selected payload instruction groups and save the in the selected function. Throws if the input is
/// invalid.
Expand Down Expand Up @@ -131,8 +131,9 @@ class PlatformConfig {
<< " thread(s) per core\n"
<< " Used buffersizes per thread:";

if (settings().instructionCacheSizePerThread()) {
log::info() << " - L1i-Cache: " << *settings().instructionCacheSizePerThread() << " Bytes";
const auto ICacheSizePerThread = settings().instructionCacheSizePerThread();
if (ICacheSizePerThread) {
log::info() << " - L1i-Cache: " << *ICacheSizePerThread << " Bytes";
}

unsigned I = 1;
Expand Down
4 changes: 2 additions & 2 deletions include/firestarter/Platform/PlatformConfigAndThreads.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ struct PlatformConfigAndThreads {
/// Get the vector of available configurations for a specific platform config.
/// \arg Config The reference to the platform config
/// \returns The vector of available configurations for this platform config.
[[nodiscard]] static auto fromPlatformConfig(const std::shared_ptr<PlatformConfig>& Config)
-> std::vector<PlatformConfigAndThreads> {
[[nodiscard]] static auto
fromPlatformConfig(const std::shared_ptr<PlatformConfig>& Config) -> std::vector<PlatformConfigAndThreads> {
std::vector<PlatformConfigAndThreads> Vec;

for (const auto& Thread : Config->constRef().settings().threads()) {
Expand Down
4 changes: 0 additions & 4 deletions include/firestarter/ProcessorInformation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@
#include <sstream>
#include <string>

extern "C" {
#include <hwloc.h>
}

namespace firestarter {

/// This class models the properties of a processor.
Expand Down
7 changes: 4 additions & 3 deletions include/firestarter/X86/Payload/AVX512Payload.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#pragma once

#include "firestarter/Payload/PayloadSettings.hpp"
#include "firestarter/X86/Payload/X86Payload.hpp"

namespace firestarter::x86::payload {
Expand Down Expand Up @@ -60,9 +61,9 @@ class AVX512Payload final : public X86Payload {
/// of the compiled payload.
/// \arg PrintAssembler Should the generated assembler code be logged.
/// \returns The compiled payload that provides access to the init and load functions.
[[nodiscard]] auto compilePayload(const firestarter::payload::PayloadSettings& Settings, bool DumpRegisters,
bool ErrorDetection, bool PrintAssembler) const
-> firestarter::payload::CompiledPayload::UniquePtr override;
[[nodiscard]] auto
compilePayload(const firestarter::payload::PayloadSettings& Settings, bool DumpRegisters, bool ErrorDetection,
bool PrintAssembler) const -> firestarter::payload::CompiledPayload::UniquePtr override;

private:
/// Function to initialize the memory used by the high load function.
Expand Down
Loading
Loading