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

Fix: offload kernels #18

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion perf.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
cd datasets
./gen.sh
cd ..
cd pipeline/eval
./run_all.sh
./run_all.sh
20 changes: 11 additions & 9 deletions pipeline/config_all/qwen2-72B/2048.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,23 @@
"model_configs": {
"gpu_num": 8,
"run_layer": 80,
"allocate_kv_data_batch": 1480,
"allocate_kv_data_batch": 1382,
"frame_page_size": 16,
"max_batch_size": 6144,
"max_batch_size": 2048,
"gpu_mem": 68719476736,
"page_mem_size": 32768
},
"pipeline_configs": {
"gemm_op_tag": [
"128_128_32_64_64_32_1_5_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_2_5_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_1_5_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_2_5_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_3_5_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_3_5_RowMajor_RowMajor_RowMajor",
"128_256_32_64_64_32_1_3_RowMajor_RowMajor_RowMajor"
"128_128_32_64_64_32_3_5_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_1_4_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_1_5_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_1_4_RowMajor_RowMajor_RowMajor",
"128_64_64_64_32_64_2_3_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_2_5_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_1_5_RowMajor_RowMajor_RowMajor",
"128_64_64_64_32_64_2_3_RowMajor_RowMajor_RowMajor",
"128_256_32_64_64_32_2_3_RowMajor_RowMajor_RowMajor"
],
"global_batch_size": 2048,
"nanobatch_1_size": 640,
Expand Down
20 changes: 11 additions & 9 deletions pipeline/config_all/qwen2-72B/nanobatch-only.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,23 @@
"model_configs": {
"gpu_num": 8,
"run_layer": 80,
"allocate_kv_data_batch": 1480,
"allocate_kv_data_batch": 1300,
"frame_page_size": 16,
"max_batch_size": 6144,
"max_batch_size": 2048,
"gpu_mem": 68719476736,
"page_mem_size": 32768
},
"pipeline_configs": {
"gemm_op_tag": [
"128_128_32_64_64_32_1_5_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_2_5_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_1_5_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_2_5_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_3_5_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_3_5_RowMajor_RowMajor_RowMajor",
"128_256_32_64_64_32_1_3_RowMajor_RowMajor_RowMajor"
"128_128_32_64_64_32_3_5_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_1_4_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_1_5_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_1_4_RowMajor_RowMajor_RowMajor",
"128_64_64_64_32_64_2_3_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_2_5_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_1_5_RowMajor_RowMajor_RowMajor",
"128_64_64_64_32_64_2_3_RowMajor_RowMajor_RowMajor",
"128_256_32_64_64_32_2_3_RowMajor_RowMajor_RowMajor"
],
"global_batch_size": 2048,
"nanobatch_1_size": 640,
Expand Down
20 changes: 11 additions & 9 deletions pipeline/config_all/qwen2-72B/non-overlap.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,23 @@
"model_configs": {
"gpu_num": 8,
"run_layer": 80,
"allocate_kv_data_batch": 1480,
"allocate_kv_data_batch": 1300,
"frame_page_size": 16,
"max_batch_size": 6144,
"max_batch_size": 2048,
"gpu_mem": 68719476736,
"page_mem_size": 32768
},
"pipeline_configs": {
"gemm_op_tag": [
"128_128_32_64_64_32_1_5_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_2_5_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_1_5_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_2_5_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_3_5_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_3_5_RowMajor_RowMajor_RowMajor",
"128_256_32_64_64_32_1_3_RowMajor_RowMajor_RowMajor"
"128_128_32_64_64_32_3_5_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_1_4_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_1_5_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_1_4_RowMajor_RowMajor_RowMajor",
"128_64_64_64_32_64_2_3_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_2_5_RowMajor_RowMajor_RowMajor",
"128_128_32_64_64_32_1_5_RowMajor_RowMajor_RowMajor",
"128_64_64_64_32_64_2_3_RowMajor_RowMajor_RowMajor",
"128_256_32_64_64_32_2_3_RowMajor_RowMajor_RowMajor"
],
"global_batch_size": 2048,
"nanobatch_1_size": 640,
Expand Down
3 changes: 2 additions & 1 deletion pipeline/eval/eval-ablation/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ def main():
continue

skip_cycles = 2000 if int(output_len) < 10 else 10000
output_prefix = os.path.join(type_result_base, f"{input_len}-{output_len}-{rate}")
# Construct the command
command = [
"python", "serve_8B.py",
f"--config_path=../config_all/llama2-70B/{pipeline_type}.json",
f"--trace_path={trace_path}",
f"--output_prefix={os.path.join(type_result_base, f"{input_len}-{output_len}-{rate}")}",
f"--output_prefix={output_prefix}",
f"--skip_cycles={skip_cycles}",
f"--empty_weight=True",
f"--run_cycles=1500"
Expand Down
6 changes: 3 additions & 3 deletions pipeline/eval/run_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ for eval_folder in ${eval_folders[@]}; do
echo "Running $eval_folder"
cd $eval_folder

python run.py --trace_base ../../datasets/traces --executor_base ../utils/
python run.py --trace_base ../../../datasets/traces --executor_base ../../utils/

cd $current_dir
done

python baseline_data.py
python summary.py
python baseline_data.py .
python summarize.py
python plot_all.py
2 changes: 1 addition & 1 deletion pipeline/eval/summarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
from datetime import datetime

base_dir = "/code/pllm/compute-bound/eval/"
base_dir = "./"
save_dir = base_dir + "eval_results/"
offline_const = base_dir + "eval-fix-offline/results/"
offline_real = base_dir + "eval-real-offline/results/"
Expand Down
1 change: 1 addition & 0 deletions pipeline/src/offloadKernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ __device__ void pageCopy(half* input, half* output, int page_mem_size){

__global__ void moveKVcacheKernel(int finished_req_num, int32_t * finished_index,
int32_t* kv_indptr, int32_t* kv_indices, half* host_ptr, half* kv_data, int page_mem_size, bool host_to_gpu){
page_mem_size /= sizeof(half);
for (int i = 0; i < finished_req_num; i++){
int idx = finished_index[i];
int start = kv_indptr[idx];
Expand Down