Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
goliaro committed Nov 15, 2024
1 parent 3246967 commit 3a330ee
Showing 1 changed file with 0 additions and 53 deletions.
53 changes: 0 additions & 53 deletions src/runtime/file_loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -915,56 +915,3 @@ void FileDataLoader::load_weights_parallel(FFModel *ff,
f.get_void_result();
}
}

void FileDataLoader::load_weights_parallel(FFModel *ff,
Context ctx,
Runtime *runtime) {
std::vector<Future> futures;

for (Layer *l : ff->layers) {
if (l->numWeights < 1 || l->name == NULL || strlen(l->name) < 1) {
continue;
}
for (int i = 0; i < l->numWeights; i++) {
Tensor weight = l->weights[i];
if (weight == NULL) {
continue;
}

// Create task arguments
WeightLoadTaskArgs args(ff, this, l, i);

switch (weight->data_type) {
case DT_HALF: {
TaskLauncher launcher(
LOAD_HALF_WEIGHT_TASK_ID,
TaskArgument(&args, sizeof(WeightLoadTaskArgs)));
futures.push_back(runtime->execute_task(ctx, launcher));
break;
}
case DT_FLOAT: {
TaskLauncher launcher(
LOAD_FLOAT_WEIGHT_TASK_ID,
TaskArgument(&args, sizeof(WeightLoadTaskArgs)));
futures.push_back(runtime->execute_task(ctx, launcher));
break;
}
case DT_INT4:
case DT_INT8: {
TaskLauncher launcher(
LOAD_QUANT_WEIGHT_TASK_ID,
TaskArgument(&args, sizeof(WeightLoadTaskArgs)));
futures.push_back(runtime->execute_task(ctx, launcher));
break;
}
default:
assert(false && "Unsupported data type");
}
}
}

// Wait for all tasks to complete
for (Future &f : futures) {
f.get_void_result();
}
}

0 comments on commit 3a330ee

Please sign in to comment.