mirror of
https://github.com/riscv-software-src/riscv-isa-sim.git
synced 2025-10-14 02:07:30 +08:00
Merge pull request #2097 from riscv-software-src/fix-werror
Actually use -Werror in CI again
This commit is contained in:
@@ -8,7 +8,9 @@ rm -rf build
|
||||
mkdir build
|
||||
cd build
|
||||
mkdir install
|
||||
CXXFLAGS="-Wnon-virtual-dtor" CFLAGS="-Werror -Wall -Wextra -Wvla" $DIR/../configure --prefix=`pwd`/install
|
||||
CFLAGS="-Werror -Wall -Wextra -Wvla"
|
||||
CXXFLAGS="-Wnon-virtual-dtor $CFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS" CFLAGS="$CFLAGS" $DIR/../configure --prefix=`pwd`/install
|
||||
make -j"$(nproc 2> /dev/null || sysctl -n hw.ncpu)"
|
||||
make check
|
||||
make install install-hdrs-list.h
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define _RISCV_BULKNORMDOT_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include "softfloat.h"
|
||||
|
||||
struct bulk_norm_out_t {
|
||||
@@ -56,6 +56,9 @@ template <typename U, typename M, typename E> class FloatFormat {
|
||||
virtual bool nan() const = 0;
|
||||
virtual bool sigNan() const = 0;
|
||||
virtual bool special() const = 0;
|
||||
|
||||
public:
|
||||
virtual ~FloatFormat() = default;
|
||||
};
|
||||
|
||||
/** Template for an IEEE-754 floating-point format class */
|
||||
@@ -178,8 +181,8 @@ class ofp8_e4m3 final : public IEEEFloatFormat<uint8_t, uint8_t, uint8_t, 4, 3>
|
||||
*/
|
||||
template<typename ValueTypeLHS, typename ValueTypeRHS, typename SigProdType> bulk_norm_out_t bulk_norm_dot_no_mult(const DotConfig cfg, const ValueTypeLHS* a, const ValueTypeRHS* b, const SigProdType* prod_sigs)
|
||||
{
|
||||
int approx_prod_exp[cfg.n];
|
||||
int flushed_prods[cfg.n];
|
||||
std::vector<int> approx_prod_exp(cfg.n);
|
||||
std::vector<int> flushed_prods(cfg.n);
|
||||
|
||||
bool any_pos_inf = false;
|
||||
bool any_neg_inf = false;
|
||||
@@ -299,27 +302,27 @@ template<typename ValueTypeLHS, typename ValueTypeRHS, typename SigProdType> bul
|
||||
static inline bulk_norm_out_t bulk_norm_dot_bf16(const DotConfig cfg, const bf16_t* a, const bf16_t* b)
|
||||
{
|
||||
// product are extracted so that the no-mult version can be more easily matched against the RTL implementation
|
||||
uint16_t prod_sigs[cfg.n];
|
||||
std::vector<uint16_t> prod_sigs(cfg.n);
|
||||
|
||||
// compute products, normalize to largest exponent, accumulate
|
||||
for (int i = 0; i < cfg.n; i++) {
|
||||
prod_sigs[i] = a[i].sig() * (uint16_t) b[i].sig();
|
||||
}
|
||||
|
||||
return bulk_norm_dot_no_mult<bf16_t, bf16_t, uint16_t>(cfg, a, b, prod_sigs);
|
||||
return bulk_norm_dot_no_mult<bf16_t, bf16_t, uint16_t>(cfg, a, b, &prod_sigs[0]);
|
||||
}
|
||||
|
||||
template <typename L, typename R>
|
||||
bulk_norm_out_t bulk_norm_dot_ofp8(const DotConfig cfg, const L* a, const R* b)
|
||||
{
|
||||
// products are extracted so that the no-mult version can be more easily matched against the RTL implementation
|
||||
uint16_t prod_sigs[cfg.n];
|
||||
std::vector<uint16_t> prod_sigs(cfg.n);
|
||||
|
||||
// compute products, normalize to largest exponent, accumulate
|
||||
for (int i = 0; i < cfg.n; i++) {
|
||||
prod_sigs[i] = a[i].sig() * (uint16_t) b[i].sig();
|
||||
}
|
||||
return bulk_norm_dot_no_mult<L, R, uint16_t>(cfg, a, b, prod_sigs);
|
||||
return bulk_norm_dot_no_mult<L, R, uint16_t>(cfg, a, b, &prod_sigs[0]);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -2141,7 +2141,7 @@ inaccessible_csr_t::inaccessible_csr_t(processor_t* const proc, const reg_t addr
|
||||
csr_t(proc, addr) {
|
||||
}
|
||||
|
||||
void inaccessible_csr_t::verify_permissions(insn_t insn, bool write) const {
|
||||
void inaccessible_csr_t::verify_permissions(insn_t insn, bool UNUSED write) const {
|
||||
if (state->v)
|
||||
throw trap_virtual_instruction(insn.bits());
|
||||
else
|
||||
|
@@ -72,6 +72,12 @@ processor_t *sim_t::get_core(const std::string& i)
|
||||
return get_core(p);
|
||||
}
|
||||
|
||||
static void do_write(int fd, const void* buf, size_t n)
|
||||
{
|
||||
auto res = write(fd, buf, n);
|
||||
(void) res;
|
||||
}
|
||||
|
||||
static void clear_str(bool noncanonical, int fd, std::string target_str)
|
||||
{
|
||||
if (noncanonical)
|
||||
@@ -83,7 +89,7 @@ static void clear_str(bool noncanonical, int fd, std::string target_str)
|
||||
clear_motion += ' ';
|
||||
}
|
||||
clear_motion += '\r';
|
||||
(void) write(fd, clear_motion.c_str(), clear_motion.size() + 1);
|
||||
do_write(fd, clear_motion.c_str(), clear_motion.size() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +102,7 @@ static void send_key(bool noncanonical, int fd, keybuffer_t key_code, const int
|
||||
{
|
||||
key_motion += (char) ((key_code >> (i * BITS_PER_CHAR)) & 0xff);
|
||||
}
|
||||
(void) write(fd, key_motion.c_str(), len);
|
||||
do_write(fd, key_motion.c_str(), len);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +150,7 @@ static std::string readline(int fd)
|
||||
cursor_pos--;
|
||||
s.erase(cursor_pos, 1);
|
||||
if (noncanonical)
|
||||
(void) write(fd, s.c_str(), s.size() + 1);
|
||||
do_write(fd, s.c_str(), s.size() + 1);
|
||||
// move cursor by left arrow key
|
||||
for (unsigned i = 0; i < s.size() - cursor_pos; i++) {
|
||||
send_key(noncanonical, fd, KEYCODE_LEFT, 3);
|
||||
@@ -176,7 +182,7 @@ static std::string readline(int fd)
|
||||
history_index = std::min(history_commands.size(), history_index + 1);
|
||||
s = history_commands[history_commands.size() - history_index];
|
||||
if (noncanonical)
|
||||
(void) write(fd, s.c_str(), s.size() + 1);
|
||||
do_write(fd, s.c_str(), s.size() + 1);
|
||||
cursor_pos = s.size();
|
||||
}
|
||||
key_buffer = 0;
|
||||
@@ -192,7 +198,7 @@ static std::string readline(int fd)
|
||||
s = history_commands[history_commands.size() - history_index];
|
||||
}
|
||||
if (noncanonical)
|
||||
(void) write(fd, s.c_str(), s.size() + 1);
|
||||
do_write(fd, s.c_str(), s.size() + 1);
|
||||
cursor_pos = s.size();
|
||||
}
|
||||
key_buffer = 0;
|
||||
@@ -221,7 +227,7 @@ static std::string readline(int fd)
|
||||
break;
|
||||
case KEYCODE_ENTER:
|
||||
if (noncanonical)
|
||||
(void) write(fd, &ch, 1);
|
||||
do_write(fd, &ch, 1);
|
||||
if (s.size() > initial_s_len && (history_commands.size() == 0 || s != history_commands[history_commands.size() - 1])) {
|
||||
history_commands.push_back(s);
|
||||
}
|
||||
@@ -236,7 +242,7 @@ static std::string readline(int fd)
|
||||
s.insert(cursor_pos, 1, ch);
|
||||
cursor_pos++;
|
||||
if (noncanonical)
|
||||
(void) write(fd, s.c_str(), s.size() + 1);
|
||||
do_write(fd, s.c_str(), s.size() + 1);
|
||||
// send left arrow key to move cursor
|
||||
for (unsigned i = 0; i < s.size() - cursor_pos; i++) {
|
||||
send_key(noncanonical, fd, KEYCODE_LEFT, 3);
|
||||
|
Reference in New Issue
Block a user