diff --git a/src/mem/cache/compressors/frequent_values.cc b/src/mem/cache/compressors/frequent_values.cc index c296ef7d6b..1c16c3b4e4 100644 --- a/src/mem/cache/compressors/frequent_values.cc +++ b/src/mem/cache/compressors/frequent_values.cc @@ -36,7 +36,6 @@ #include "base/intmath.hh" #include "base/logging.hh" #include "debug/CacheComp.hh" -#include "mem/cache/prefetch/associative_set_impl.hh" #include "params/FrequentValuesCompressor.hh" namespace gem5 diff --git a/src/mem/cache/prefetch/access_map_pattern_matching.cc b/src/mem/cache/prefetch/access_map_pattern_matching.cc index 14fb5c3c48..34e9c48dd4 100644 --- a/src/mem/cache/prefetch/access_map_pattern_matching.cc +++ b/src/mem/cache/prefetch/access_map_pattern_matching.cc @@ -29,7 +29,6 @@ #include "mem/cache/prefetch/access_map_pattern_matching.hh" #include "debug/HWPrefetch.hh" -#include "mem/cache/prefetch/associative_set_impl.hh" #include "params/AMPMPrefetcher.hh" #include "params/AccessMapPatternMatching.hh" diff --git a/src/mem/cache/prefetch/access_map_pattern_matching.hh b/src/mem/cache/prefetch/access_map_pattern_matching.hh index c4aceceade..90ffdc6634 100644 --- a/src/mem/cache/prefetch/access_map_pattern_matching.hh +++ b/src/mem/cache/prefetch/access_map_pattern_matching.hh @@ -38,8 +38,9 @@ #ifndef __MEM_CACHE_PREFETCH_ACCESS_MAP_PATTERN_MATCHING_HH__ #define __MEM_CACHE_PREFETCH_ACCESS_MAP_PATTERN_MATCHING_HH__ -#include "mem/cache/prefetch/associative_set.hh" +#include "base/cache/associative_cache.hh" #include "mem/cache/prefetch/queued.hh" +#include "mem/cache/tags/tagged_entry.hh" #include "mem/packet.hh" #include "sim/clocked_object.hh" @@ -109,7 +110,7 @@ class AccessMapPatternMatching : public ClockedObject } }; /** Access map table */ - AssociativeSet accessMapTable; + AssociativeCache accessMapTable; /** * Number of good prefetches diff --git a/src/mem/cache/prefetch/associative_set.hh b/src/mem/cache/prefetch/associative_set.hh deleted file mode 100644 index e3d79a4bca..0000000000 --- a/src/mem/cache/prefetch/associative_set.hh +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Copyright (c) 2024 Arm Limited - * All rights reserved - * - * The license below extends only to copyright in the software and shall - * not be construed as granting a license to any other intellectual - * property including but not limited to intellectual property relating - * to a hardware implementation of the functionality of the software - * licensed hereunder. You may use the software subject to the license - * terms below provided that you ensure that this notice is replicated - * unmodified and in its entirety in all distributions of the software, - * modified or unmodified, in source code or in binary form. - * - * Copyright (c) 2018 Metempsy Technology Consulting - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __CACHE_PREFETCH_ASSOCIATIVE_SET_HH__ -#define __CACHE_PREFETCH_ASSOCIATIVE_SET_HH__ - -#include - -#include "base/cache/associative_cache.hh" -#include "mem/cache/replacement_policies/base.hh" -#include "mem/cache/tags/indexing_policies/base.hh" -#include "mem/cache/tags/tagged_entry.hh" - -namespace gem5 -{ - -/** - * Associative container based on the previosuly defined Entry type - * Each element is indexed by a key of type Addr, an additional - * bool value is used as an additional tag data of the entry. - */ -template -class AssociativeSet : public AssociativeCache -{ - static_assert(std::is_base_of_v, - "Entry must derive from TaggedEntry"); - - public: - /** - * Public constructor - * @param name Name of the cache - * @param num_entries total number of entries of the container, the number - * of sets can be calculated dividing this balue by the 'assoc' value - * @param assoc number of elements in each associative set - * @param rpl_policy replacement policy - * @param idx_policy indexing policy - * @param init_val initial value of the elements of the set - */ - AssociativeSet(const char *name, const size_t num_entries, - const size_t associativity_, - replacement_policy::Base *repl_policy, - typename Entry::IndexingPolicy *indexing_policy, - Entry const &init_val = Entry()); - - private: - // The following APIs are excluded since they lack the secure bit - using AssociativeCache::findEntry; - using AssociativeCache::insertEntry; - using AssociativeCache::getPossibleEntries; - using AssociativeCache::replPolicy; - using AssociativeCache::indexingPolicy; -}; - -} // namespace gem5 - -#endif//__CACHE_PREFETCH_ASSOCIATIVE_SET_HH__ diff --git a/src/mem/cache/prefetch/associative_set_impl.hh b/src/mem/cache/prefetch/associative_set_impl.hh deleted file mode 100644 index ad9c4db755..0000000000 --- a/src/mem/cache/prefetch/associative_set_impl.hh +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright (c) 2024 Arm Limited - * All rights reserved - * - * The license below extends only to copyright in the software and shall - * not be construed as granting a license to any other intellectual - * property including but not limited to intellectual property relating - * to a hardware implementation of the functionality of the software - * licensed hereunder. You may use the software subject to the license - * terms below provided that you ensure that this notice is replicated - * unmodified and in its entirety in all distributions of the software, - * modified or unmodified, in source code or in binary form. - * - * Copyright (c) 2018 Metempsy Technology Consulting - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __CACHE_PREFETCH_ASSOCIATIVE_SET_IMPL_HH__ -#define __CACHE_PREFETCH_ASSOCIATIVE_SET_IMPL_HH__ - -#include "base/intmath.hh" -#include "mem/cache/prefetch/associative_set.hh" - -namespace gem5 -{ - -template -AssociativeSet::AssociativeSet(const char *name, - const size_t num_entries, - const size_t associativity_, - replacement_policy::Base *repl_policy, - typename Entry::IndexingPolicy *indexing_policy, - Entry const &init_val) - : AssociativeCache(name, num_entries, associativity_, - repl_policy, indexing_policy, init_val) -{ -} - -} // namespace gem5 - -#endif//__CACHE_PREFETCH_ASSOCIATIVE_SET_IMPL_HH__ diff --git a/src/mem/cache/prefetch/delta_correlating_prediction_tables.cc b/src/mem/cache/prefetch/delta_correlating_prediction_tables.cc index b46cea0684..0d245979a2 100644 --- a/src/mem/cache/prefetch/delta_correlating_prediction_tables.cc +++ b/src/mem/cache/prefetch/delta_correlating_prediction_tables.cc @@ -29,7 +29,6 @@ #include "mem/cache/prefetch/delta_correlating_prediction_tables.hh" #include "debug/HWPrefetch.hh" -#include "mem/cache/prefetch/associative_set_impl.hh" #include "params/DCPTPrefetcher.hh" #include "params/DeltaCorrelatingPredictionTables.hh" diff --git a/src/mem/cache/prefetch/indirect_memory.cc b/src/mem/cache/prefetch/indirect_memory.cc index 22a162fae7..ea52023008 100644 --- a/src/mem/cache/prefetch/indirect_memory.cc +++ b/src/mem/cache/prefetch/indirect_memory.cc @@ -29,7 +29,6 @@ #include "mem/cache/prefetch/indirect_memory.hh" #include "mem/cache/base.hh" - #include "mem/cache/prefetch/associative_set_impl.hh" #include "params/IndirectMemoryPrefetcher.hh" namespace gem5 diff --git a/src/mem/cache/prefetch/indirect_memory.hh b/src/mem/cache/prefetch/indirect_memory.hh index 7ed4953393..5693b0955a 100644 --- a/src/mem/cache/prefetch/indirect_memory.hh +++ b/src/mem/cache/prefetch/indirect_memory.hh @@ -41,9 +41,10 @@ #include +#include "base/cache/associative_cache.hh" #include "base/sat_counter.hh" -#include "mem/cache/prefetch/associative_set.hh" #include "mem/cache/prefetch/queued.hh" +#include "mem/cache/tags/tagged_entry.hh" namespace gem5 { @@ -122,7 +123,7 @@ class IndirectMemory : public Queued } }; /** Prefetch table */ - AssociativeSet prefetchTable; + AssociativeCache prefetchTable; /** Indirect Pattern Detector entrt */ struct IndirectPatternDetectorEntry : public TaggedEntry diff --git a/src/mem/cache/prefetch/irregular_stream_buffer.cc b/src/mem/cache/prefetch/irregular_stream_buffer.cc index 8d634fafbf..ce1f78d0c8 100644 --- a/src/mem/cache/prefetch/irregular_stream_buffer.cc +++ b/src/mem/cache/prefetch/irregular_stream_buffer.cc @@ -29,7 +29,6 @@ #include "mem/cache/prefetch/irregular_stream_buffer.hh" #include "debug/HWPrefetch.hh" -#include "mem/cache/prefetch/associative_set_impl.hh" #include "params/IrregularStreamBufferPrefetcher.hh" namespace gem5 diff --git a/src/mem/cache/prefetch/irregular_stream_buffer.hh b/src/mem/cache/prefetch/irregular_stream_buffer.hh index 9b0022fbd3..a67bb7b143 100644 --- a/src/mem/cache/prefetch/irregular_stream_buffer.hh +++ b/src/mem/cache/prefetch/irregular_stream_buffer.hh @@ -38,10 +38,11 @@ #ifndef __MEM_CACHE_PREFETCH_IRREGULAR_STREAM_BUFFER_HH__ #define __MEM_CACHE_PREFETCH_IRREGULAR_STREAM_BUFFER_HH__ +#include "base/cache/associative_cache.hh" #include "base/callback.hh" #include "base/sat_counter.hh" -#include "mem/cache/prefetch/associative_set.hh" #include "mem/cache/prefetch/queued.hh" +#include "mem/cache/tags/tagged_entry.hh" namespace gem5 { @@ -73,7 +74,7 @@ class IrregularStreamBuffer : public Queued bool lastAddressSecure; }; /** Map of PCs to Training unit entries */ - AssociativeSet trainingUnit; + AssociativeCache trainingUnit; /** Address Mapping entry, holds an address and a confidence counter */ struct AddressMapping @@ -109,9 +110,9 @@ class IrregularStreamBuffer : public Queued }; /** Physical-to-Structured mappings table */ - AssociativeSet psAddressMappingCache; + AssociativeCache psAddressMappingCache; /** Structured-to-Physical mappings table */ - AssociativeSet spAddressMappingCache; + AssociativeCache spAddressMappingCache; /** * Counter of allocated structural addresses, increased by "chunkSize", * each time a new structured address is allocated diff --git a/src/mem/cache/prefetch/pif.cc b/src/mem/cache/prefetch/pif.cc index 1d7681a073..cd3e90aa72 100644 --- a/src/mem/cache/prefetch/pif.cc +++ b/src/mem/cache/prefetch/pif.cc @@ -31,7 +31,6 @@ #include #include "debug/HWPrefetch.hh" -#include "mem/cache/prefetch/associative_set_impl.hh" #include "params/PIFPrefetcher.hh" namespace gem5 diff --git a/src/mem/cache/prefetch/pif.hh b/src/mem/cache/prefetch/pif.hh index c29327e63b..673c257e58 100644 --- a/src/mem/cache/prefetch/pif.hh +++ b/src/mem/cache/prefetch/pif.hh @@ -40,9 +40,10 @@ #include #include +#include "base/cache/associative_cache.hh" #include "base/circular_queue.hh" -#include "mem/cache/prefetch/associative_set.hh" #include "mem/cache/prefetch/queued.hh" +#include "mem/cache/tags/tagged_entry.hh" namespace gem5 { @@ -144,7 +145,7 @@ class PIF : public Queued * The index table is a small cache-like structure that facilitates * fast search of the history buffer. */ - AssociativeSet index; + AssociativeCache index; /** * A Stream Address Buffer (SAB) tracks a window of consecutive diff --git a/src/mem/cache/prefetch/signature_path.cc b/src/mem/cache/prefetch/signature_path.cc index 589ee3f84a..640ffd5110 100644 --- a/src/mem/cache/prefetch/signature_path.cc +++ b/src/mem/cache/prefetch/signature_path.cc @@ -32,7 +32,6 @@ #include #include "debug/HWPrefetch.hh" -#include "mem/cache/prefetch/associative_set_impl.hh" #include "params/SignaturePathPrefetcher.hh" namespace gem5 diff --git a/src/mem/cache/prefetch/signature_path.hh b/src/mem/cache/prefetch/signature_path.hh index 26a5fa034e..e2dacd5448 100644 --- a/src/mem/cache/prefetch/signature_path.hh +++ b/src/mem/cache/prefetch/signature_path.hh @@ -40,9 +40,10 @@ #ifndef __MEM_CACHE_PREFETCH_SIGNATURE_PATH_HH__ #define __MEM_CACHE_PREFETCH_SIGNATURE_PATH_HH__ +#include "base/cache/associative_cache.hh" #include "base/sat_counter.hh" -#include "mem/cache/prefetch/associative_set.hh" #include "mem/cache/prefetch/queued.hh" +#include "mem/cache/tags/tagged_entry.hh" #include "mem/packet.hh" namespace gem5 @@ -84,7 +85,7 @@ class SignaturePath : public Queued {} }; /** Signature table */ - AssociativeSet signatureTable; + AssociativeCache signatureTable; /** A stride entry with its counter */ struct PatternStrideEntry @@ -150,7 +151,7 @@ class SignaturePath : public Queued }; /** Pattern table */ - AssociativeSet patternTable; + AssociativeCache patternTable; /** * Generates a new signature from an existing one and a new stride diff --git a/src/mem/cache/prefetch/signature_path_v2.cc b/src/mem/cache/prefetch/signature_path_v2.cc index b89b62c5bd..2725b8f800 100644 --- a/src/mem/cache/prefetch/signature_path_v2.cc +++ b/src/mem/cache/prefetch/signature_path_v2.cc @@ -43,7 +43,6 @@ #include #include "debug/HWPrefetch.hh" -#include "mem/cache/prefetch/associative_set_impl.hh" #include "params/SignaturePathPrefetcherV2.hh" namespace gem5 diff --git a/src/mem/cache/prefetch/signature_path_v2.hh b/src/mem/cache/prefetch/signature_path_v2.hh index 518bb0da26..f2b727716b 100644 --- a/src/mem/cache/prefetch/signature_path_v2.hh +++ b/src/mem/cache/prefetch/signature_path_v2.hh @@ -41,7 +41,7 @@ #ifndef __MEM_CACHE_PREFETCH_SIGNATURE_PATH_V2_HH__ #define __MEM_CACHE_PREFETCH_SIGNATURE_PATH_V2_HH__ -#include "mem/cache/prefetch/associative_set.hh" +#include "base/cache/associative_cache.hh" #include "mem/cache/prefetch/signature_path.hh" #include "mem/packet.hh" @@ -68,7 +68,7 @@ class SignaturePathV2 : public SignaturePath {} }; /** Global History Register */ - AssociativeSet globalHistoryRegister; + AssociativeCache globalHistoryRegister; double calculateLookaheadConfidence(PatternEntry const &sig, PatternStrideEntry const &lookahead) const override; diff --git a/src/mem/cache/prefetch/spatio_temporal_memory_streaming.cc b/src/mem/cache/prefetch/spatio_temporal_memory_streaming.cc index db8d374a9e..cc69bfc4b1 100644 --- a/src/mem/cache/prefetch/spatio_temporal_memory_streaming.cc +++ b/src/mem/cache/prefetch/spatio_temporal_memory_streaming.cc @@ -29,7 +29,6 @@ #include "mem/cache/prefetch/spatio_temporal_memory_streaming.hh" #include "debug/HWPrefetch.hh" -#include "mem/cache/prefetch/associative_set_impl.hh" #include "params/STeMSPrefetcher.hh" namespace gem5 diff --git a/src/mem/cache/prefetch/spatio_temporal_memory_streaming.hh b/src/mem/cache/prefetch/spatio_temporal_memory_streaming.hh index e378afacab..641fb86a14 100644 --- a/src/mem/cache/prefetch/spatio_temporal_memory_streaming.hh +++ b/src/mem/cache/prefetch/spatio_temporal_memory_streaming.hh @@ -43,10 +43,11 @@ #include +#include "base/cache/associative_cache.hh" #include "base/circular_queue.hh" #include "base/sat_counter.hh" -#include "mem/cache/prefetch/associative_set.hh" #include "mem/cache/prefetch/queued.hh" +#include "mem/cache/tags/tagged_entry.hh" namespace gem5 { @@ -154,9 +155,9 @@ class STeMS : public Queued }; /** Active Generation Table (AGT) */ - AssociativeSet activeGenerationTable; + AssociativeCache activeGenerationTable; /** Pattern Sequence Table (PST) */ - AssociativeSet patternSequenceTable; + AssociativeCache patternSequenceTable; /** Data type of the Region Miss Order Buffer entry */ struct RegionMissOrderBufferEntry diff --git a/src/mem/cache/prefetch/stride.cc b/src/mem/cache/prefetch/stride.cc index 66c4c9a0d3..aaa9ea42a7 100644 --- a/src/mem/cache/prefetch/stride.cc +++ b/src/mem/cache/prefetch/stride.cc @@ -53,7 +53,6 @@ #include "base/random.hh" #include "base/trace.hh" #include "debug/HWPrefetch.hh" -#include "mem/cache/prefetch/associative_set_impl.hh" #include "mem/cache/replacement_policies/base.hh" #include "params/StridePrefetcher.hh" diff --git a/src/mem/cache/prefetch/stride.hh b/src/mem/cache/prefetch/stride.hh index 982c289a04..a0ccb3f0c4 100644 --- a/src/mem/cache/prefetch/stride.hh +++ b/src/mem/cache/prefetch/stride.hh @@ -51,12 +51,13 @@ #include #include +#include "base/cache/associative_cache.hh" #include "base/sat_counter.hh" #include "base/types.hh" -#include "mem/cache/prefetch/associative_set.hh" #include "mem/cache/prefetch/queued.hh" #include "mem/cache/replacement_policies/replaceable_entry.hh" #include "mem/cache/tags/indexing_policies/set_associative.hh" +#include "mem/cache/tags/tagged_entry.hh" #include "mem/packet.hh" #include "params/StridePrefetcherHashedSetAssociative.hh" @@ -144,7 +145,7 @@ class Stride : public Queued int stride; SatCounter8 confidence; }; - typedef AssociativeSet PCTable; + using PCTable = AssociativeCache; std::unordered_map> pcTables; /**