Skip to content

Commit

Permalink
fix sizing and get result
Browse files Browse the repository at this point in the history
  • Loading branch information
victoryang00 committed Jan 25, 2024
1 parent 4225d9a commit 135801a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 22 deletions.
2 changes: 1 addition & 1 deletion include/wamr_exec_env.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct WAMRExecEnv { // multiple
//
// /* Previous thread's exec env of a WASM module instance. */
// struct WASMExecEnv *prev;
ssize_t cur_count{};
uint32 cur_count{};

/* Note: field module_inst, argv_buf, native_stack_boundary,
susƒend_flags, aux_stack_boundary, aux_stack_bottom, and
Expand Down
2 changes: 1 addition & 1 deletion include/wamr_export.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ enum sync_op {
};

struct sync_op_t {
size_t tid;
uint32 tid;
uint32 ref;
enum sync_op sync_op;
};
Expand Down
7 changes: 0 additions & 7 deletions src/checkpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,11 @@
#include "aot_runtime.h"
#include "logging.h"
#include "wamr.h"
#include "wamr_wasi_context.h"
#include "wasm_runtime.h"
#include <condition_variable>
#include <cstdio>
#include <cxxopts.hpp>
#include <filesystem>
#include <fstream>
#include <mutex>
#include <sstream>
#include <string>
#include <thread>
#include <tuple>
#if !defined(_WIN32)
#include "thread_manager.h"
#include <arpa/inet.h>
Expand Down
22 changes: 11 additions & 11 deletions src/wamr_export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ int gettid() { return GetCurrentThreadId(); }

void insert_sync_op(wasm_exec_env_t exec_env, uint32 *mutex, enum sync_op locking) {
printf("insert sync on offset %d, as op: %d\n", *mutex, locking);
struct sync_op_t sync_op = {.tid = exec_env->cur_count, .ref = *mutex, .sync_op = locking};
struct sync_op_t sync_op = {.tid = ((uint32)exec_env->cur_count), .ref = *mutex, .sync_op = locking};
wamr->sync_ops.push_back(sync_op);
}

Expand All @@ -290,11 +290,11 @@ void lightweight_checkpoint(WASMExecEnv *exec_env) {
if (((AOTFrame *)exec_env->cur_frame)) {
fid = (((AOTFrame *)exec_env->cur_frame)->func_index);
}
// LOGV(DEBUG) << "checkpoint " << gettid() << " func(" << fid << ")";
// if (fid == -1) {
// LOGV(DEBUG) << "skip checkpoint";
// return;
// }
// LOGV(DEBUG) << "checkpoint " << gettid() << " func(" << fid << ")";
// if (fid == -1) {
// LOGV(DEBUG) << "skip checkpoint";
// return;
// }

std::unique_lock as_ul(wamr->as_mtx);
wamr->lwcp_list[gettid()]++;
Expand All @@ -306,11 +306,11 @@ void lightweight_uncheckpoint(WASMExecEnv *exec_env) {
if (((AOTFrame *)exec_env->cur_frame)) {
fid = (((AOTFrame *)exec_env->cur_frame)->func_index);
}
// LOGV(DEBUG) << "uncheckpoint " << gettid() << " func(" << fid << ")";
// if (fid == -1) {
// LOGV(DEBUG) << "skip uncheckpoint";
// return;
// }
// LOGV(DEBUG) << "uncheckpoint " << gettid() << " func(" << fid << ")";
// if (fid == -1) {
// LOGV(DEBUG) << "skip uncheckpoint";
// return;
// }
std::unique_lock as_ul(wamr->as_mtx);
if (wamr->lwcp_list[gettid()] == 0) {
// someone has reset our counter
Expand Down
4 changes: 2 additions & 2 deletions src/wamr_native.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ static void dgemm_wrapper(wasm_exec_env_t exec_env, int32_t m, int32_t n, int32_
// fprintf(stderr, "CUBLAS matrix mul took: %f [s]\n", miliseconds / 1000);
#else
auto begin = clock();
cblas_dgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc);
cblas_dgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, m, n, k, alpha, a, m, b, k, beta, c, m);
auto end = clock();
auto time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
// fprintf(stderr, "CPU matrix mul took: %f [s]\n", time_spent);
fprintf(stderr, "CPU matrix mul took: %f [s]\n", time_spent);
#endif
#endif
}
Expand Down

0 comments on commit 135801a

Please sign in to comment.