Compare commits

...

1 Commits

Author SHA1 Message Date
Sean McBride 249ab17214 chore: wasmception cleanup
3 years ago

@ -104,7 +104,9 @@
"wasm_module_instance.h": "c",
"wasm_stack.h": "c",
"wasm_table.h": "c",
"sledge_abi.h": "c"
"sledge_abi.h": "c",
"__bit_reference": "cpp",
"filesystem": "cpp"
},
"files.exclude": {
"**/.git": true,

@ -1 +1 @@
Subproject commit 90b535a67ca09421e55b74de06f4a8a817131a8c
Subproject commit 3aca5263d346065173d35437c319d6d3d61204b9

@ -0,0 +1,32 @@
#!/bin/bash
# git checkout wasmception
# git submodule update --recursive
# make libsledge
# make build
# make -C runtime clean all
# rm runtime/bin/*.so
cd awsm
cargo build --release
cd ..
touch wasm32-unknown-unknown-wasm-clang
wrapper_file=wasm32-unknown-unknown-wasm-clang
cat > "$wrapper_file" << EOT
#!/bin/sh
exec /home/sean/projects/sledge/awsm/wasmception/dist/bin/clang --target=wasm32-unknown-unknown-wasm --sysroot=/home/sean/projects/sledge/awsm/wasmception/sysroot "\$@"
EOT
chmod +x wasm32-unknown-unknown-wasm-clang
sudo install wasm32-unknown-unknown-wasm-clang /usr/bin
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-8 1000
sudo update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-8 1000
make -C applications clean all
make -f test.mk all
cd ./tests/gocr/by_dpi && SLEDGE_NWORKERS=1 ./run.sh -e=fifo_nopreemption.env

@ -1,7 +1,8 @@
CFILES := src/*.c
INCLUDES := -Iinclude/
CFLAGS := -fPIC -O3
# CFLAGS := -fPIC -O3
CFLAGS := -fPIC -O0 -g
# CFI Sanitizer
# CFLAGS+=-fvisibility=default -fsanitize=cfi
@ -24,19 +25,19 @@ dist:
mkdir dist
dist/memory_instructions.o: src/memory_instructions.c dist
clang ${CFLAGS} -c ${INCLUDES} -o $@ $<
clang-8 ${CFLAGS} -c ${INCLUDES} -o $@ $<
dist/numeric_instructions.o: src/numeric_instructions.c dist
clang ${CFLAGS} -c ${INCLUDES} -o $@ $<
clang-8 ${CFLAGS} -c ${INCLUDES} -o $@ $<
dist/table_instructions.o: src/table_instructions.c dist
clang ${CFLAGS} -c ${INCLUDES} -o $@ $<
clang-8 ${CFLAGS} -c ${INCLUDES} -o $@ $<
dist/variable_instructions.o: src/variable_instructions.c dist
clang ${CFLAGS} -c ${INCLUDES} -o $@ $<
clang-8 ${CFLAGS} -c ${INCLUDES} -o $@ $<
dist/instantiation.o: src/instantiation.c dist
clang ${CFLAGS} -c ${INCLUDES} -o $@ $<
clang-8 ${CFLAGS} -c ${INCLUDES} -o $@ $<
dist/libsledge.a: dist/memory_instructions.o dist/numeric_instructions.o dist/table_instructions.o dist/variable_instructions.o dist/instantiation.o
ar rcs dist/libsledge.a $^

@ -6,7 +6,7 @@ endif
endif
# Compiler Settings
CC=clang
CC=clang-8
CFLAGS=-std=c18 -pthread
# We use several non-standard glibc / Linux features:
@ -14,10 +14,10 @@ CFLAGS=-std=c18 -pthread
CFLAGS+=-D_GNU_SOURCE
# Release Flags
CFLAGS+=-O3 -flto
# CFLAGS+=-O3 -flto
# Debugging Flags
# CFLAGS+=-O0 -g
CFLAGS+=-O0 -g
# CFI Sanitizer
# CFLAGS+=-fvisibility=default -fsanitize=cfi

@ -45,7 +45,7 @@ sandbox_perf_log_print_entry(struct sandbox *sandbox)
sandbox->duration_of_state[SANDBOX_RUNNING_SYS], sandbox->duration_of_state[SANDBOX_RUNNING_USER],
sandbox->duration_of_state[SANDBOX_ASLEEP], sandbox->duration_of_state[SANDBOX_RETURNED],
sandbox->duration_of_state[SANDBOX_COMPLETE], sandbox->duration_of_state[SANDBOX_ERROR],
runtime_processor_speed_MHz, sandbox->memory->abi.size);
runtime_processor_speed_MHz, 0);
}
static inline void

@ -95,7 +95,7 @@ wasm_read(int32_t filedes, int32_t buf_offset, int32_t nbyte)
/* Non-blocking copy on stdin */
if (filedes == 0) {
char * buffer = current_sandbox_get_ptr_void(buf_offset, nbyte);
char *buffer = current_sandbox_get_ptr_void(buf_offset, nbyte);
struct http_request *current_request = &current_sandbox->http_request;
if (current_request->body_length <= 0) return 0;
int bytes_to_read = nbyte > current_request->body_length ? current_request->body_length : nbyte;
@ -136,8 +136,8 @@ int32_t
wasm_write(int32_t fd, int32_t buf_offset, int32_t buf_size)
{
struct sandbox *s = current_sandbox_get();
char * buffer = current_sandbox_get_ptr_void(buf_offset, buf_size);
struct vec_u8 * response = &s->response;
char *buffer = current_sandbox_get_ptr_void(buf_offset, buf_size);
struct vec_u8 *response = &s->response;
if (fd == STDERR_FILENO) { write(STDERR_FILENO, buffer, buf_size); }
@ -291,7 +291,7 @@ wasm_writev(int32_t fd, int32_t iov_offset, int32_t iovcnt)
int sum = 0;
for (int i = 0; i < iovcnt; i++) {
int32_t len = iov[i].len;
void * ptr = current_sandbox_get_ptr_void(iov[i].base_offset, len);
void *ptr = current_sandbox_get_ptr_void(iov[i].base_offset, len);
printf("%.*s", len, (char *)ptr);
sum += len;
@ -303,7 +303,7 @@ wasm_writev(int32_t fd, int32_t iov_offset, int32_t iovcnt)
struct iovec vecs[iovcnt];
for (int i = 0; i < iovcnt; i++) {
int32_t len = iov[i].len;
void * ptr = current_sandbox_get_ptr_void(iov[i].base_offset, len);
void *ptr = current_sandbox_get_ptr_void(iov[i].base_offset, len);
vecs[i] = (struct iovec){ ptr, len };
}

@ -37,7 +37,7 @@ run_samples() {
# Scrape the perf window size from the source if possible
# TODO: Make a util function
local -r perf_window_path="$(path_join "$__run_sh__base_path" ../../include/perf_window_t.h)"
local -r perf_window_path="$(path_join "$__run_sh__base_path" ../../runtime/include/perf_window_t.h)"
local -i perf_window_buffer_size
if ! perf_window_buffer_size=$(grep "#define PERF_WINDOW_BUFFER_SIZE" < "$perf_window_path" | cut -d\ -f3); then
printf "Failed to scrape PERF_WINDOW_BUFFER_SIZE from ../../include/perf_window.h\n"

@ -0,0 +1,14 @@
client-cifar10:
cat ./cifar10/airplane1.bmp | http :10019
client-ekf:
cat ./ekf/ekf_raw.dat | http :10000
client-gocr:
cat ./gocr/hyde.pnm | http :10006
client-lpd:
cat ./lpd/Cars0.png | http :10012
client-resize:
cat ./resize/shrinking_man_large.jpg | http :10018

@ -44,6 +44,7 @@ initialize_globals() {
# Read into buffer array, splitting on commas
readarray -t -d, buffer < <(echo -n "$line")
workload="${buffer[1]}"
echo "$workload"
# Update workload mix structures
workloads+=("$workload")
port+=(["$workload"]=$(get_port "$workload"))
@ -53,9 +54,9 @@ initialize_globals() {
get_port() {
local name="$1"
{
echo "["
# echo "["
cat ./spec.json
echo "]"
# echo "]"
} | jq ".[] | select(.name == \"$name\") | .port"
}

@ -5,8 +5,8 @@
"port": 10018,
"expected-execution-us": 2777,
"relative-deadline-us": 4166,
"http-req-size": 4096,
"http-resp-size": 128,
"http-req-size": 1024000,
"http-resp-size": 1024000,
"http-resp-content-type": "text/plain",
"admissions-percentile": 90
},
@ -16,8 +16,8 @@
"port": 10019,
"expected-execution-us": 2777,
"relative-deadline-us": 4443,
"http-req-size": 4096,
"http-resp-size": 128,
"http-req-size": 1024000,
"http-resp-size": 1024000,
"http-resp-content-type": "text/plain",
"admissions-percentile": 90
},
@ -27,8 +27,8 @@
"port": 10020,
"expected-execution-us": 2777,
"relative-deadline-us": 4721,
"http-req-size": 4096,
"http-resp-size": 128,
"http-req-size": 1024000,
"http-resp-size": 1024000,
"http-resp-content-type": "text/plain",
"admissions-percentile": 90
},
@ -38,8 +38,8 @@
"port": 10021,
"expected-execution-us": 2777,
"relative-deadline-us": 4999,
"http-req-size": 4096,
"http-resp-size": 128,
"http-req-size": 1024000,
"http-resp-size": 1024000,
"http-resp-content-type": "text/plain",
"admissions-percentile": 90
},
@ -49,8 +49,8 @@
"port": 10022,
"expected-execution-us": 2777,
"relative-deadline-us": 5276,
"http-req-size": 4096,
"http-resp-size": 128,
"http-req-size": 1024000,
"http-resp-size": 1024000,
"http-resp-content-type": "text/plain",
"admissions-percentile": 90
},
@ -60,8 +60,8 @@
"port": 10023,
"expected-execution-us": 2777,
"relative-deadline-us": 5554,
"http-req-size": 4096,
"http-resp-size": 128,
"http-req-size": 1024000,
"http-resp-size": 1024000,
"http-resp-content-type": "text/plain",
"admissions-percentile": 90
},

@ -0,0 +1,3 @@
#!/bin/sh
exec /home/sean/projects/sledge/awsm/wasmception/dist/bin/clang --target=wasm32-unknown-unknown-wasm --sysroot=/home/sean/projects/sledge/awsm/wasmception/sysroot "$@"
Loading…
Cancel
Save