Skip to content

Commit

Permalink
Merge pull request #66 from comparch-security/multi-thread-prA
Browse files Browse the repository at this point in the history
add multi-thread inner and memory
  • Loading branch information
wsong83 authored Apr 25, 2024
2 parents dea7bf3 + 41bda03 commit f288e52
Show file tree
Hide file tree
Showing 11 changed files with 880 additions and 19 deletions.
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,26 @@ regression: $(REGRESSION_TESTS_RST)
clean-regression:
-rm $(REGRESSION_TESTS_LOG) $(REGRESSION_TESTS_EXE) $(REGRESSION_TESTS_RST)

PARALLEL_REGRESSION_TESTS = multi-l2-msi

PARALLEL_REGRESSION_TESTS_EXE = $(patsubst %, regression/%, $(PARALLEL_REGRESSION_TESTS))

$(PARALLEL_REGRESSION_TESTS_EXE): %:%.cpp $(CACHE_OBJS) $(UTIL_OBJS) $(CRYPTO_LIB) $(CACHE_HEADERS)
$(CXX) $(CXXFLAGS) $< $(CACHE_OBJS) $(UTIL_OBJS) $(CRYPTO_LIB) -o $@

parallel-regression: $(PARALLEL_REGRESSION_TESTS_EXE)
$^
clean-parallel-regression:
-rm $(PARALLEL_REGRESSION_TESTS_EXE)

libflexicas.a: $(CACHE_OBJS) $(UTIL_OBJS) $(CRYPTO_LIB)
ar rvs $@ $(CACHE_OBJS) $(UTIL_OBJS) $(CRYPTO_LIB)

.PHONY: regression

clean:
$(MAKE) clean-regression
$(MAKE) clean-parallel-regression
-rm $(UTIL_OBJS) $(CACHE_OBJS)

.PHONY: clean
4 changes: 2 additions & 2 deletions cache/cache_multi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class CacheSkewedMultiThread : public CacheSkewed<IW, NW, P, MT, DT, IDX, RPC, D
auto [status, mtx, cv] = get_set_control(*ai, *s);
std::unique_lock lk(*mtx, std::defer_lock);
lk.lock();
/* Wait until the high priority thread ends (lower the priority of the set) */
/** Wait until the high priority thread ends (lower the priority of the set) */
cv->wait(lk, [idx, status, priority] { return ((*status)[idx] < priority);} );
(*status)[*s] |= priority;
lk.unlock();
Expand All @@ -164,7 +164,7 @@ class CacheSkewedMultiThread : public CacheSkewed<IW, NW, P, MT, DT, IDX, RPC, D

if(need_replace && !hit) replace(addr, ai, s, w);

/* if don't replace, then *ai=P, else if replace occurs, then 0<=(*ai)< P */
/** if don't replace, then *ai=P, else if replace occurs, then 0<=(*ai)< P */
for(uint32_t i = 0; i < P; i++){
if(i != *ai){
uint32_t s = indexer.index(addr, i);
Expand Down
2 changes: 1 addition & 1 deletion cache/coherence.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class InnerCohPortBase
public:
InnerCohPortBase(policy_ptr policy) : policy(policy) {}

std::pair<uint32_t, policy_ptr> connect(CohClientBase *c, bool uncached = false) {
virtual std::pair<uint32_t, policy_ptr> connect(CohClientBase *c, bool uncached = false) {
if(uncached) {
return std::make_pair(-1, policy);
} else {
Expand Down
Loading

0 comments on commit f288e52

Please sign in to comment.