Skip to content

Commit

Permalink
Use slamp_push and slamp_pop instead of function call for dep mod wit…
Browse files Browse the repository at this point in the history
…h context
  • Loading branch information
vgene committed Apr 9, 2024
1 parent 8505f85 commit cfff641
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/runtime/Events/configs/DepModule_TrackContext_Events.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ events:
target_loop_invoc: []
target_loop_iter: []
target_loop_exit: []
func_entry: [function_id] # optional if tracking context
func_exit: [function_id] # optional if tracking context
func_call_push: [inst_id] # optional if tracking context
func_call_pop: [] # optional if tracking context
finished: []

# func_entry: [function_id] # optional if tracking context
# func_exit: [function_id] # optional if tracking context
4 changes: 4 additions & 0 deletions src/runtime/Events/configs/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ events:
function_id: 32
func_exit:
function_id: 32
func_call_push:
inst_id: 32
func_call_pop:
# no arg
points_to_inst:
inst_id: 32
ptr: 64
Expand Down
21 changes: 19 additions & 2 deletions src/runtime/SLAMPcustom/consumer/consumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ enum class UnifiedAction : char {
FUNC_EXIT,
POINTS_TO_INST,
POINTS_TO_ARG,
FUNC_CALL_PUSH,
FUNC_CALL_POP,
FINISHED
};

Expand Down Expand Up @@ -1273,7 +1275,8 @@ void consume_loop(DoubleQueue &dq,
}

void consume_loop_dep_with_context(DoubleQueue &dq,
DependenceWithContextModule &depMod) CONSUME_LOOP_ATTRIBUTES {
DependenceWithContextModule &depMod)
CONSUME_LOOP_ATTRIBUTES {
uint64_t rdtsc_start = 0;
uint64_t counter = 0;
uint32_t loop_id;
Expand Down Expand Up @@ -1414,6 +1417,17 @@ void consume_loop_dep_with_context(DoubleQueue &dq,
depMod.func_exit(func_id);
break;
};
case Action::FUNC_CALL_PUSH: {
uint32_t caller_id;
dq.unpack_32(caller_id);
depMod.func_entry(caller_id);
break;
};
case Action::FUNC_CALL_POP: {
depMod.func_exit(0);
break;
};

#ifdef UNIFIED_WORKFLOW
case Action::FREE:
case Action::LOOP_ENTRY:
Expand Down Expand Up @@ -1718,7 +1732,10 @@ int main(int argc, char **argv) {
std::cout << "Running in " << THREAD_COUNT << " threads" << std::endl;
for (unsigned i = 0; i < THREAD_COUNT; i++) {
threads.emplace_back(
[&](unsigned id) { consume_loop_dep_with_context(*dqs[id], *depMods[id]); }, i);
[&](unsigned id) {
consume_loop_dep_with_context(*dqs[id], *depMods[id]);
},
i);
}

for (auto &t : threads) {
Expand Down
2 changes: 2 additions & 0 deletions src/runtime/frontend/custom_produce.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ enum UnifiedAction : char {
FUNC_EXIT,
POINTS_TO_INST,
POINTS_TO_ARG,
FUNC_CALL_PUSH,
FUNC_CALL_POP,
FINISHED
};

Expand Down
13 changes: 11 additions & 2 deletions src/runtime/frontend/frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ static uint32_t ext_fn_inst_id = 0;
#define PRODUCE_STORE(size, instr, addr)
#endif

#ifndef PRODUCE_FUNC_CALL_PUSH
#define PRODUCE_FUNC_CALL_PUSH(inst_id)
#endif

#ifndef PRODUCE_FUNC_CALL_POP
#define PRODUCE_FUNC_CALL_POP()
#endif

static volatile char *lc_dummy = NULL;

PRODUCE_QUEUE_DEFINE();
Expand Down Expand Up @@ -342,8 +350,9 @@ void memalign_callback(void *ptr, size_t alignment, size_t size) {

// FIXME: a bunch of unused functions
void SLAMP_main_entry(uint32_t argc, char **argv, char **env) {}
void SLAMP_push(const uint32_t instr) {}
void SLAMP_pop() {}
void SLAMP_push(const uint32_t instr) { PRODUCE_FUNC_CALL_PUSH(instr); }
void SLAMP_pop() { PRODUCE_FUNC_CALL_POP(); }

void SLAMP_allocated(uint64_t addr) {}

void SLAMP_callback_stack_alloca(uint32_t instr, void *ptr, uint64_t array_size,
Expand Down

0 comments on commit cfff641

Please sign in to comment.