From 9e10a68f5b05abc485eb4ffadf938f7307437e94 Mon Sep 17 00:00:00 2001 From: Aaron Chan Date: Fri, 19 Jul 2024 16:15:43 -0500 Subject: [PATCH 1/2] Vector Uop Generator Bug (#184) The following [code](https://github.com/AaronGChan/riscv-perf-model/blob/5f86ada39301c3181e47236a3c592a5961a48e99/core/Decode.cpp#L274): ```vec_uop_gen_->getNumUopsRemaining() > 1``` doesn't perform correctly for LMUL=2, because the `num_uops_to_generate_` will be decremented to 1 on the `setInst` of `VectorUopGenerator`, so the 2nd uop is never generated. This PR fixes logic and counting of Uops based on the parent instruction. --- core/Decode.cpp | 5 +---- core/VectorUopGenerator.cpp | 9 +++++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/core/Decode.cpp b/core/Decode.cpp index 7186aa13..2e481bc3 100644 --- a/core/Decode.cpp +++ b/core/Decode.cpp @@ -268,10 +268,7 @@ namespace olympia ILOG("Vector uop gen: " << inst); vec_uop_gen_->setInst(inst); - // Original instruction will act as the first UOp - inst->setUOpID(0); // set UOpID() - - while(vec_uop_gen_->getNumUopsRemaining() > 1) + while(vec_uop_gen_->getNumUopsRemaining() >= 1) { const InstPtr uop = vec_uop_gen_->generateUop(); if (insts->size() < num_to_decode_) diff --git a/core/VectorUopGenerator.cpp b/core/VectorUopGenerator.cpp index d9237d76..3b32d6a2 100644 --- a/core/VectorUopGenerator.cpp +++ b/core/VectorUopGenerator.cpp @@ -25,19 +25,20 @@ namespace olympia // Does the instruction have tail elements? const uint32_t num_elems = current_VCSRs->vl / current_VCSRs->sew; inst->setTail(num_elems < current_VCSRs->vlmax); - if(num_uops_to_generate_ > 1) { + // Original instruction will act as the first UOp + inst->setUOpID(0); // set UOpID() current_inst_ = inst; current_inst_->setUOpCount(num_uops_to_generate_); ILOG("Inst: " << current_inst_ << " is being split into " << num_uops_to_generate_ << " UOPs"); - // Inst counts as the first uop - --num_uops_to_generate_; } else { ILOG("Inst: " << inst << " does not need to generate uops"); } + // Inst counts as the first uop + --num_uops_to_generate_; } const InstPtr VectorUopGenerator::generateUop() @@ -96,4 +97,4 @@ namespace olympia reset_(); } } -} // namespace olympia +} // namespace olympia \ No newline at end of file From 403f9ac8026764a5d5be64cbf104c1301a8cf60d Mon Sep 17 00:00:00 2001 From: bdutro Date: Tue, 23 Jul 2024 10:37:02 -0400 Subject: [PATCH 2/2] Update to latest stf_lib (#188) Fixes #185 --- CMakeLists.txt | 1 + stf_lib | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 09e6c25b..5280e24e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,7 @@ include_directories(${SPARTA_INCLUDE_DIRS}) # Set up STF library set (STF_LIB_BASE ${PROJECT_SOURCE_DIR}/stf_lib) set (DISABLE_STF_DOXYGEN ON) +set (DISABLE_STF_TESTS ON) if (CMAKE_BUILD_TYPE MATCHES "^[Rr]elease") set (FULL_LTO true) diff --git a/stf_lib b/stf_lib index 69d48b1b..b874cc0c 160000 --- a/stf_lib +++ b/stf_lib @@ -1 +1 @@ -Subproject commit 69d48b1bab14a410c859aa3591b4eb175323ec98 +Subproject commit b874cc0c8dc6a7e95fe00c2f9cd8e4504270d395