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

Warnings #408

Merged
merged 63 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
ec1a657
Fix most warning and add comments
dANW34V3R Feb 27, 2024
6593341
More fixes
dANW34V3R Feb 27, 2024
43e266b
Fixup tests
dANW34V3R Feb 28, 2024
6b1544b
Handle output of system calls
dANW34V3R Feb 28, 2024
823b7f1
Fix warning for tests in release mode
dANW34V3R Feb 28, 2024
b69318f
Fix commitMicroOps
dANW34V3R Feb 28, 2024
998b8cf
Add default binary
dANW34V3R Mar 6, 2024
a824732
Fix AT_FCWD on Mac
dANW34V3R Mar 6, 2024
0bcbf17
Quash armclang warning
dANW34V3R Mar 13, 2024
a3252c0
Quash armclang float.hh
dANW34V3R Mar 13, 2024
1773f5d
Conditionally include filesystem.h
dANW34V3R Mar 14, 2024
fafb331
Update jenkins comparison values
dANW34V3R Mar 14, 2024
8eb411d
Add pedantic warnings and only give warnings for SimEng
dANW34V3R Mar 14, 2024
c27d3cf
Fix pedantic warnings
dANW34V3R Mar 14, 2024
8ace4dd
Update default binary's path to be absolute. Needed if binary called …
dANW34V3R Mar 15, 2024
c5a4372
Update jenkins comparison values
dANW34V3R Mar 15, 2024
83441d0
Update jenkins for tx2 run
dANW34V3R Mar 15, 2024
796f5bf
Update unit tests
dANW34V3R Mar 15, 2024
c810db5
Update tests to use dynamic stack pointers
dANW34V3R Mar 15, 2024
25b6ccd
Update command line string for OSTest
dANW34V3R Mar 15, 2024
e72941d
Fix cmdLine
dANW34V3R Mar 15, 2024
34d9e96
Turn warnings into errors
dANW34V3R Mar 15, 2024
b01493e
Remove extra semicolons
dANW34V3R Mar 18, 2024
be847ae
Prevent unused tuple member warning
dANW34V3R Mar 18, 2024
23eb995
Clang format
dANW34V3R Mar 18, 2024
ab0a3b6
Pedantic warnings for all tests
dANW34V3R Mar 18, 2024
4c74f63
Build in release mode for CI
dANW34V3R Mar 18, 2024
9ed5edc
Fix warnings in tests
dANW34V3R Mar 19, 2024
8226395
TEMP add Wextra
dANW34V3R Mar 19, 2024
379362a
Change char* to uint8*
dANW34V3R Mar 19, 2024
7aef61e
Remove cast and update initialiser
dANW34V3R Mar 19, 2024
52160f8
Clean up CMake
dANW34V3R Mar 19, 2024
592ff3a
Cleanup
dANW34V3R Mar 20, 2024
6747b0d
Fixes for AppleClang
dANW34V3R Mar 21, 2024
da4d460
Fix pop pragma
dANW34V3R Mar 21, 2024
acf78c0
Clang format
dANW34V3R Mar 21, 2024
b0e2e47
Fixes for SST warnings
dANW34V3R Mar 21, 2024
0c6cc73
Address PR comments
dANW34V3R Mar 22, 2024
f1a3211
PR comments
dANW34V3R Mar 28, 2024
e3f8df9
Address PR comments
dANW34V3R Apr 11, 2024
664476f
Address PR comments
dANW34V3R Apr 11, 2024
3f5632d
Address PR comments
dANW34V3R Apr 29, 2024
68874aa
Remove hex
dANW34V3R May 10, 2024
b4b72c7
Address PR comments
dANW34V3R May 10, 2024
b3da40d
Revert type change
dANW34V3R May 21, 2024
2c5a7d7
Check for warnings when state change not fully initialised
dANW34V3R May 21, 2024
50d040d
Recreate warning to test fixes
dANW34V3R May 21, 2024
753fe5b
Fix SST test framework warnings
dANW34V3R May 22, 2024
bcd9a49
Remove double default
dANW34V3R May 22, 2024
2ffbbe6
Update unit tests to use default program
dANW34V3R May 22, 2024
4c18a4e
Remove bracket from macro fixing all SST tests
dANW34V3R May 23, 2024
30ca287
Add comments to SST framework changes
dANW34V3R May 23, 2024
06562c9
Update default value for expectedBounds
dANW34V3R May 23, 2024
028e0ca
Update use of output when calling realpath
dANW34V3R May 23, 2024
8ad4293
Add brackets to expect macro
dANW34V3R May 24, 2024
7fa166f
Update docs
dANW34V3R May 24, 2024
462f616
Remove TODO
dANW34V3R May 31, 2024
e303bd3
Updated reservation station size data types to be more appropriate fo…
Jun 3, 2024
3801d70
Changed vecTbl to correctly operate with unsigned variables
Jun 3, 2024
5c10446
Removed accidental upstream of test file and added to gitignore
Jun 3, 2024
ceb98f8
Add TODO for SST test framework
dANW34V3R Jun 4, 2024
b09b0de
Alter comments and remove redundant assertion
dANW34V3R Jun 4, 2024
08376f1
Remove unused function from SST test suite
dANW34V3R Jun 4, 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
Prev Previous commit
Next Next commit
TEMP add Wextra
  • Loading branch information
dANW34V3R committed Mar 19, 2024
commit 822639562c2aea6d1a7092d8232a290d3597919d
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ set(CMAKE_MACOSX_RPATH 1)
# Enable PIC for libraries
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# Enable additional compiler warnings for all targets
#add_compile_options(-Wall)
# Enable additional compiler warnings for SimEng only targets
set(SIMENG_COMPILE_OPTIONS -Wall -pedantic -Werror) #-Wextra

# Disable RTTI for all targets
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>)
Expand Down
6 changes: 3 additions & 3 deletions src/include/simeng/CoreInstance.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
// Program used when no executable is provided; counts down from
// 1024*1024, with an independent `orr` at the start of each branch.
// TODO unsure of why this is producing a warning when it is used
[[maybe_unused]] static uint32_t hex_[] = {
static const uint32_t hex_[] = {
FinnWilkinson marked this conversation as resolved.
Show resolved Hide resolved
0x320C03E0, // orr w0, wzr, #1048576
0x320003E1, // orr w0, wzr, #1
0x71000400, // subs w0, w0, #1
Expand Down Expand Up @@ -76,10 +76,10 @@ class CoreInstance {
std::shared_ptr<char> getProcessImage() const;

/** Getter for the size of the created process image. */
const uint64_t getProcessImageSize() const;
uint64_t getProcessImageSize() const;
jj16791 marked this conversation as resolved.
Show resolved Hide resolved

/* Getter for heap start. */
const uint64_t getHeapStart() const;
uint64_t getHeapStart() const;

private:
/** Generate the appropriate simulation objects as parameterised by the
Expand Down
16 changes: 14 additions & 2 deletions src/include/simeng/arch/aarch64/helpers/float.hh
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,29 @@ RegisterValue scvtf_FixedPoint(
* Returns single value of type D. */
template <typename D, typename N>
D fcvtzu_integer(srcValContainer& sourceValues) {
// Ensure type of N so that we know behaviour of type conversions
static_assert((std::is_same<float, N>() || std::is_same<double, N>()) &&
ABenC377 marked this conversation as resolved.
Show resolved Hide resolved
"N not of valid type float or double");
N input = sourceValues[0].get<N>();
D result = static_cast<D>(0);
// TODO do we need to static assert D to be uint32 or uint64
N input = sourceValues[0].get<N>(); // float
D result = static_cast<D>(0); // uint

// Check for nan and less than 0
if (!std::isnan(input) && (input > static_cast<N>(0))) {
if (std::isinf(input)) {
// Account for Infinity
result = std::numeric_limits<D>::max();
} else if (input >= (N)std::numeric_limits<D>::max()) {
// max() will be either 4294967295 or 18446744073709551615
// Casting to float results in the following (incorrect) values 4294967296
// (+1) or 18446744073709551616 (+1)
//
// Casting to double results in no erroneous conversion.

//
//
// the following values 4294967295 or 18446744073709551615

// Account for the source value being larger than the
// destination register can support
result = std::numeric_limits<D>::max();
Expand Down
4 changes: 1 addition & 3 deletions src/include/simeng/config/SimInfo.hh
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,7 @@ class SimInfo {

/** A getter function to retrieve whether or not the special files
* directories should be generated. */
static const bool getGenSpecFiles() {
return getInstance()->genSpecialFiles_;
}
static bool getGenSpecFiles() { return getInstance()->genSpecialFiles_; }
jj16791 marked this conversation as resolved.
Show resolved Hide resolved

/** A utility function to rebuild/construct member variables/classes. For use
* if the configuration used changes during simulation (e.g. during the
Expand Down
2 changes: 1 addition & 1 deletion src/include/simeng/kernel/Linux.hh
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ class Linux {
/** Return the host directory file descriptor depending on given pathname and
jj16791 marked this conversation as resolved.
Show resolved Hide resolved
* virtual dfd given to syscall. If vdfd is AT_FDCWD then AT_FDCWD is returned
*/
int64_t getHostDFD(int64_t vdfd, std::string pathname);
int64_t getHostDFD(int64_t vdfd);

/** If the given filepath points to a special file, the filepath is replaced
* to point to the SimEng equivalent. */
Expand Down
2 changes: 1 addition & 1 deletion src/include/simeng/kernel/LinuxProcess.hh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class LinuxProcess {

/** Construct a Linux process from region of instruction memory, with the
* entry point fixed at 0. */
LinuxProcess(span<char> instructions,
LinuxProcess(span<const uint8_t> instructions,
ryml::ConstNodeRef config = config::SimInfo::getConfig());

~LinuxProcess();
Expand Down
5 changes: 2 additions & 3 deletions src/lib/AlwaysNotTakenPredictor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

namespace simeng {

BranchPrediction AlwaysNotTakenPredictor::predict(uint64_t address,
BranchType type,
int64_t knownOffset) {
BranchPrediction AlwaysNotTakenPredictor::predict(
[[maybe_unused]] uint64_t address, BranchType type, int64_t knownOffset) {
jj16791 marked this conversation as resolved.
Show resolved Hide resolved
return {false, 0};
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ target_include_directories(libsimeng PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(libsimeng capstone)
# TODO TOML check this
# Only enable compiler warnings for our code
target_compile_options(libsimeng PRIVATE -Wall -pedantic -Werror)
target_compile_options(libsimeng PRIVATE ${SIMENG_COMPILE_OPTIONS})

set_target_properties(libsimeng PROPERTIES VERSION ${SimEng_VERSION})
set_target_properties(libsimeng PROPERTIES SOVERSION ${SimEng_VERSION_MAJOR})
Expand Down
11 changes: 5 additions & 6 deletions src/lib/CoreInstance.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void CoreInstance::createProcess(std::string executablePath,
} else if (assembledSource_) {
// Create a process image from the source code assembled by LLVM.
process_ = std::make_unique<kernel::LinuxProcess>(
span<char>(source_, sourceSize_), config_);
span<const char>(source_, sourceSize_), config_);
// Raise error if created process is not valid
if (!process_->isValid()) {
std::cerr << "[SimEng:CoreInstance] Could not create process based on "
Expand All @@ -108,7 +108,8 @@ void CoreInstance::createProcess(std::string executablePath,
// TODO remove once default binary in use
FinnWilkinson marked this conversation as resolved.
Show resolved Hide resolved
// Create a process image from the set of instructions held in hex_
process_ = std::make_unique<kernel::LinuxProcess>(
span<char>(reinterpret_cast<char*>(hex_), sizeof(hex_)), config_);
span<const char>(reinterpret_cast<const char*>(hex_), sizeof(hex_)),
config_);

// Raise error if created process is not valid
if (!process_->isValid()) {
Expand Down Expand Up @@ -318,12 +319,10 @@ std::shared_ptr<char> CoreInstance::getProcessImage() const {
return processMemory_;
}

const uint64_t CoreInstance::getProcessImageSize() const {
uint64_t CoreInstance::getProcessImageSize() const {
return processMemorySize_;
}

const uint64_t CoreInstance::getHeapStart() const {
return process_->getHeapStart();
}
uint64_t CoreInstance::getHeapStart() const { return process_->getHeapStart(); }

} // namespace simeng
3 changes: 2 additions & 1 deletion src/lib/arch/aarch64/ExceptionHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,8 @@ bool ExceptionHandler::init() {
static_cast<uint16_t>(arch.getSystemRegisterTag(ARM64_SYSREG_SVCR))});
regValues.push_back(RegisterValue(newSVCR, 8));

ProcessStateChange stateChange = {ChangeType::REPLACEMENT, regs, regValues};
ProcessStateChange stateChange = {
ChangeType::REPLACEMENT, regs, regValues, {}, {}};
FinnWilkinson marked this conversation as resolved.
Show resolved Hide resolved
return concludeSyscall(stateChange);
}

Expand Down
1 change: 1 addition & 0 deletions src/lib/arch/aarch64/InstructionMetadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@ InstructionMetadata::InstructionMetadata(const cs_insn& insn)
case Opcode::AArch64_INCP_XP_S:
operands[0].access = CS_AC_READ | CS_AC_WRITE;
operands[1].access = CS_AC_READ;
break; // TODO IS THIS THE CORRECT, DOES IT NEED TO FALLTHROUGH?
case Opcode::AArch64_LD1i32:
[[fallthrough]];
case Opcode::AArch64_LD1i64:
Expand Down
1 change: 1 addition & 0 deletions src/lib/arch/riscv/ExceptionHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ bool ExceptionHandler::init() {
case 131: { // tgkill
// TODO currently returns success without action
stateChange = {ChangeType::REPLACEMENT, {R0}, {0}};
break;
}
case 134: { // rt_sigaction
// TODO: Implement syscall logic. Ignored for now as it's assumed the
Expand Down
13 changes: 7 additions & 6 deletions src/lib/kernel/Linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void Linux::createProcess(const LinuxProcess& process) {
"/sys/devices/system/cpu/online", "core_id", "physical_package_id"});
}

int64_t Linux::getHostDFD(int64_t vdfd, std::string pathname) {
int64_t Linux::getHostDFD(int64_t vdfd) {
// -100 = AT_FCWD on linux. Pass back AT_FDCWD for host platform e.g. -2 for
// MAC
jj16791 marked this conversation as resolved.
Show resolved Hide resolved
if (vdfd == -100) {
Expand Down Expand Up @@ -150,7 +150,7 @@ int64_t Linux::faccessat(int64_t dfd, const std::string& filename, int64_t mode,

// Get host dirfd. May return -1 in case of no mapping, pass through to host
// faccessat to deal with this
int64_t hostDfd = Linux::getHostDFD(dfd, filename);
int64_t hostDfd = Linux::getHostDFD(dfd);

// Pass call through to host
int64_t retval = ::faccessat(hostDfd, new_pathname.c_str(), mode, flag);
Expand Down Expand Up @@ -192,7 +192,7 @@ int64_t Linux::newfstatat(int64_t dfd, const std::string& filename, stat& out,

// Get host dirfd. May return -1 in case of no mapping, pass through to host
// fstatat to deal with this
int64_t hostDfd = Linux::getHostDFD(dfd, filename);
int64_t hostDfd = Linux::getHostDFD(dfd);

// Pass call through to host
struct ::stat statbuf;
Expand Down Expand Up @@ -415,8 +415,9 @@ int64_t Linux::munmap(uint64_t addr, size_t length) {
return 0;
}

uint64_t Linux::mmap(uint64_t addr, size_t length, int prot, int flags, int fd,
off_t offset) {
uint64_t Linux::mmap(uint64_t addr, size_t length, [[maybe_unused]] int prot,
[[maybe_unused]] int flags, [[maybe_unused]] int fd,
[[maybe_unused]] off_t offset) {
LinuxProcessState* lps = &processStates_[0];
std::shared_ptr<struct vm_area_struct> newAlloc(new vm_area_struct);
if (addr == 0) { // Kernel decides allocation
Expand Down Expand Up @@ -502,7 +503,7 @@ int64_t Linux::openat(int64_t dfd, const std::string& filename, int64_t flags,
// Get host dirfd. May return -1 in case of no mapping, pass through to host
// openat to deal with this
// TODO should this be new_pathname (resp. filename)
int64_t hDfd = Linux::getHostDFD(dfd, filename);
int64_t hDfd = Linux::getHostDFD(dfd);

// Pass call through to host
int64_t hostFd = ::openat(hDfd, new_pathname.c_str(), newFlags, mode);
Expand Down
3 changes: 2 additions & 1 deletion src/lib/kernel/LinuxProcess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ LinuxProcess::LinuxProcess(const std::vector<std::string>& commandLine,
}

// TODO can this be marked as only usable by test? or is it used by SST??
jj16791 marked this conversation as resolved.
Show resolved Hide resolved
LinuxProcess::LinuxProcess(span<char> instructions, ryml::ConstNodeRef config)
LinuxProcess::LinuxProcess(span<const uint8_t> instructions,
ryml::ConstNodeRef config)
: STACK_SIZE(config["Process-Image"]["Stack-Size"].as<uint64_t>()),
HEAP_SIZE(config["Process-Image"]["Heap-Size"].as<uint64_t>()) {
// Set program command string to a relative path of "Default"
Expand Down
4 changes: 2 additions & 2 deletions test/unit/aarch64/ArchitectureTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ class AArch64ArchitectureTest : public testing::Test {
})YAML");

// fdivr z1.s, p0/m, z1.s, z0.s
std::array<uint8_t, 4> validInstrBytes = {0x01, 0x80, 0x8c, 0x65};
const std::array<uint8_t, 4> validInstrBytes = {0x01, 0x80, 0x8c, 0x65};
std::array<uint8_t, 4> invalidInstrBytes = {0x20, 0x00, 0x02, 0x8c};
FinnWilkinson marked this conversation as resolved.
Show resolved Hide resolved

std::unique_ptr<Architecture> arch;
kernel::Linux kernel;
kernel::LinuxProcess process = kernel::LinuxProcess(
span((char*)validInstrBytes.data(), validInstrBytes.size()));
span(validInstrBytes.data(), validInstrBytes.size()));
};

TEST_F(AArch64ArchitectureTest, predecode) {
Expand Down