Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass stack_frame to hyperobject lookup #13

Draft
wants to merge 4 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,12 @@ endif()

# Add compile flags for Cheetah-runtime compilation that should be
# excluded from bitcode compilation
if (CHEETAH_HAS_MAVX_FLAG)
list(APPEND CHEETAH_COMPILE_FLAGS -mavx)
if (DEFINED CHEETAH_ARCH_FLAGS)
list(APPEND CHEETAH_COMPILE_FLAGS ${CHEETAH_ARCH_FLAGS})
else()
if (CHEETAH_HAS_MAVX_FLAG)
list(APPEND CHEETAH_COMPILE_FLAGS -mavx)
endif()
endif()

if (APPLE)
Expand Down
15 changes: 10 additions & 5 deletions runtime/cilk2c_inlined.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,17 @@ unsigned __cilkrts_get_worker_number(void) {
return 0;
}

void *__cilkrts_reducer_lookup(void *key, size_t size,
void *identity_ptr, void *reduce_ptr) {
void *__cilkrts_reducer_lookup_in_frame(struct __cilkrts_stack_frame *frame,
void *key, size_t size,
void *identity_ptr, void *reduce_ptr) {
// If we're outside a cilkified region, then the key is the view.
if (__cilkrts_need_to_cilkify)
return key;
struct local_hyper_table *table = get_hyper_table();
// The null test will normally be optimized out.
__cilkrts_worker *w;
if (frame)
w = frame->fh->worker; // Never null
else if (!(w = __cilkrts_get_tls_worker()))
return key;
struct local_hyper_table *table = get_local_hyper_table(w);
struct bucket *b = find_hyperobject(table, (uintptr_t)key);
if (__builtin_expect(!!b, true)) {
// Return the existing view.
Expand Down
2 changes: 1 addition & 1 deletion runtime/local-reducer-api.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

static inline struct local_hyper_table *
get_local_hyper_table(__cilkrts_worker *w) {
if (NULL == w->hyper_table) {
if (__builtin_expect(NULL == w->hyper_table, 0)) {
w->hyper_table = __cilkrts_local_hyper_table_alloc();
}
return w->hyper_table;
Expand Down