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 Function Selection #98

Merged
merged 35 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7998b0d
use std::optional for functionid
marenz2569 Dec 9, 2024
55e311e
use PlatformConfig instead of X86PlatformConfig for shared ptrs
marenz2569 Dec 10, 2024
a59721a
Merge branch 'marenz.hwloc-thread-affinity' into marenz.refactor-func…
marenz2569 Dec 10, 2024
4251090
Merge branch 'marenz.hwloc-thread-affinity' into marenz.refactor-func…
marenz2569 Dec 10, 2024
aa98189
split X86Environment class into generic and X86 code
marenz2569 Dec 10, 2024
57259a1
move files from Environment folder one up
marenz2569 Dec 10, 2024
5d1bc4e
add refactor commit to .git-blame-ignore-revs
marenz2569 Dec 10, 2024
635460a
cleanup Environment class
marenz2569 Dec 10, 2024
a4754a4
split function selection code
marenz2569 Dec 10, 2024
57fed06
move code to payload class
marenz2569 Dec 10, 2024
d64961b
refactor function selection
marenz2569 Dec 10, 2024
27129cc
fix function selection
marenz2569 Dec 10, 2024
ce627b8
cleanup
marenz2569 Dec 10, 2024
2929c42
remove one smart pointer
marenz2569 Dec 10, 2024
62659a4
split instruction group parsing
marenz2569 Dec 10, 2024
31fe386
cleanup
marenz2569 Dec 11, 2024
ba57ac9
refactor instruction groups
marenz2569 Dec 11, 2024
dee1b47
use instruction groups type in more places
marenz2569 Dec 11, 2024
303c377
remove const in class private var
marenz2569 Dec 11, 2024
b754921
cleanup
marenz2569 Dec 11, 2024
6d4aa75
remove one member from the firestarter class
marenz2569 Dec 11, 2024
2e407cd
do not set instruction groups in payload directly
marenz2569 Dec 11, 2024
6d98bd5
cleanup interfaces
marenz2569 Dec 11, 2024
115534b
Merge branch 'marenz.hwloc-thread-affinity' into marenz.refactor-func…
marenz2569 Dec 11, 2024
769df8b
remove unused header
marenz2569 Dec 11, 2024
8decd44
clang-tidy suggestions
marenz2569 Dec 11, 2024
c3dc155
unit test InstructionGroups parsing
marenz2569 Dec 11, 2024
2b7e2c8
add newline in file
marenz2569 Dec 11, 2024
d6b84aa
remove unneeded functions
marenz2569 Dec 12, 2024
09797a6
wrapp asmjit cpufeatures to refactor payload isAvailable function
marenz2569 Dec 13, 2024
6ecbf51
wrapp x86 model information in X86Model class. test X86Model class. t…
marenz2569 Dec 14, 2024
71e4291
fix mingw build
marenz2569 Dec 14, 2024
e1f8d44
test function selection
marenz2569 Dec 16, 2024
1101ea5
fix windows test build
marenz2569 Dec 16, 2024
08fbfa1
Merge remote-tracking branch 'origin/master' into marenz.refactor-fun…
marenz2569 Dec 19, 2024
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
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
9732bdb59717274f666e9c1497289d1f9a0d7858
57259a1c5dce3b90a71520abc068af8aab37bb56
5 changes: 2 additions & 3 deletions include/firestarter/CPUTopology.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#pragma once

#include <optional>
#include <ostream>
#include <set>

extern "C" {
Expand Down Expand Up @@ -64,10 +63,10 @@ class CPUTopology {
virtual ~CPUTopology();

/// Print information about the number of packages, cores and threads.
void printSystemSummary(std::ostream& Stream) const;
void printSystemSummary() const;

/// Print information about the cache hierarchy.
void printCacheSummary(std::ostream& Stream) const;
void printCacheSummary() const;

/// Get the size of the first instruction cache.
[[nodiscard]] auto instructionCacheSize() const -> std::optional<unsigned>;
Expand Down
12 changes: 7 additions & 5 deletions include/firestarter/Config/Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

#pragma once

#include "firestarter/Config/InstructionGroups.hpp"

#include <chrono>
#include <cstdint>
#include <optional>
Expand Down Expand Up @@ -70,7 +72,7 @@ struct Config {
/// The optional cpu bind that allow pinning to specific cpus.
std::optional<std::set<uint64_t>> CpuBinding;
/// The optional selected instruction groups. If this is empty the default will be choosen.
std::string InstructionGroups;
std::optional<InstructionGroups> Groups;
/// The file where the dump register feature will safe its output to.
std::string DumpRegistersOutpath;
/// The name of the optimization algorithm.
Expand All @@ -82,10 +84,10 @@ struct Config {
int Argc;
/// The requested number of threads firestarter should run with. 0 means all threads.
std::optional<unsigned> RequestedNumThreads;
/// The selected function id. 0 means automatic selection.
unsigned FunctionId;
/// The line count of the payload. 0 means default.
unsigned LineCount = 0;
/// The selected function id.
std::optional<unsigned> FunctionId;
/// The optional line count of the payload.
std::optional<unsigned> LineCount;
/// The number of gpus firestarter should stress. Default is -1 means all gpus.
int Gpus = 0;
/// The matrix size which should be used. 0 means automatic detections.
Expand Down
81 changes: 81 additions & 0 deletions include/firestarter/Config/InstructionGroups.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/******************************************************************************
* FIRESTARTER - A Processor Stress Test Utility
* Copyright (C) 2024 TU Dresden, Center for Information Services and High
* Performance Computing
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/\>.
*
* Contact: [email protected]
*****************************************************************************/

#pragma once

#include <sstream>
#include <string>
#include <utility>
#include <vector>

namespace firestarter {

/// Struct to parse selected from a string. The format is a comma delimited list of instruction value pairs. The values
/// are unsigned integers.
struct InstructionGroups {
using InternalType = std::vector<std::pair<std::string, unsigned>>;

InstructionGroups() = default;

explicit InstructionGroups(InternalType Groups)
: Groups(std::move(Groups)) {}

explicit operator const InternalType&() const noexcept { return Groups; }

friend auto operator<<(std::ostream& Stream, const InstructionGroups& IGroups) -> std::ostream&;

/// Parse the instruction group string. It is a comma delimited list of instruction value pairs. The values are
/// unsigned integers.
/// \arg Groups The instruction groups as a string.
[[nodiscard]] static auto fromString(const std::string& Groups) -> InstructionGroups;

/// Combine instructions and values for these instructions into the combined instruction groups.
/// \arg Instructions The vector of instructions
/// \arg Values The vector of values
/// \returns The combined instruction groups
[[nodiscard]] static auto fromInstructionAndValues(const std::vector<std::string>& Instructions,
const std::vector<unsigned>& Values) -> InstructionGroups;

/// The vector of used instructions that are saved in the instruction groups
[[nodiscard]] auto intructions() const -> std::vector<std::string>;

private:
/// The parsed instruction groups
std::vector<std::pair<std::string, unsigned>> Groups;
};

inline auto operator<<(std::ostream& Stream, const InstructionGroups& Groups) -> std::ostream& {
std::stringstream Ss;

for (auto const& [Key, Value] : static_cast<InstructionGroups::InternalType>(Groups)) {
Ss << Key << ":" << Value << ",";
}

auto S = Ss.str();
if (!S.empty()) {
S.pop_back();
}

Stream << S;
return Stream;
}

} // namespace firestarter
38 changes: 38 additions & 0 deletions include/firestarter/CpuFeatures.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/******************************************************************************
* FIRESTARTER - A Processor Stress Test Utility
* Copyright (C) 2024 TU Dresden, Center for Information Services and High
* Performance Computing
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/\>.
*
* Contact: [email protected]
*****************************************************************************/

#pragma once

namespace firestarter {

/// Abstract class that defines the methods required to check if cpu features are available.
class CpuFeatures {
public:
CpuFeatures() = default;
virtual ~CpuFeatures() = default;

/// Check if this class has all features which are given in the argument.
/// \arg Features The features which should be check if they are available.
/// \returns true if this class has all features given in the argument.
[[nodiscard]] virtual auto hasAll(const CpuFeatures& Features) const -> bool = 0;
};

} // namespace firestarter
42 changes: 42 additions & 0 deletions include/firestarter/CpuModel.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/******************************************************************************
* FIRESTARTER - A Processor Stress Test Utility
* Copyright (C) 2024 TU Dresden, Center for Information Services and High
* Performance Computing
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/\>.
*
* Contact: [email protected]
*****************************************************************************/

#pragma once

namespace firestarter {

/// Abstract class that defines the methods required to check if one cpu model is equal to another
class CpuModel {
public:
CpuModel() = default;
virtual ~CpuModel() = default;

/// \arg Other The model to which operator < should be checked.
/// \return true if this is less than other
[[nodiscard]] virtual auto operator<(const CpuModel& Other) const -> bool = 0;

/// Check if two models match.
/// \arg Other The model to which equality should be checked.
/// \return true if this and the other model match
[[nodiscard]] virtual auto operator==(const CpuModel& Other) const -> bool = 0;
};

} // namespace firestarter
101 changes: 0 additions & 101 deletions include/firestarter/Environment/Environment.hpp

This file was deleted.

40 changes: 0 additions & 40 deletions include/firestarter/Environment/X86/Platform/SkylakeConfig.hpp

This file was deleted.

Loading
Loading