Parallelize Max (#16745)

It gives up to 7.5% improvement in LLaMA 7B case.
This commit is contained in:
Yi-Hong Lyu 2023-07-19 15:23:48 -07:00 committed by GitHub
parent 24566058b3
commit 6e895fe70a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -855,7 +855,12 @@ struct Max_8::ComputeImpl {
}};
int input_count = inst.Node().InputArgCount().front();
UntypedBroadcastVariadic(input_count, *context, typed_allocator, funcs);
// TODO: Parallelize across spans in UntypedBroadcastVariadic to avoid specific logic here
if (input_count == 2) {
UntypedBroadcastTwo(*context, funcs, 1.0);
} else {
UntypedBroadcastVariadic(input_count, *context, typed_allocator, funcs);
}
return Status::OK();
}